DdlGenerator constructor needs no arguments?
Asked Answered
A

1

3

I wanted to unit test my database operation and I found this code. However, I get the followin error:

[CityGame] $ test
[info] Compiling 2 Java sources to /Users/pmichna/Documents/code/citygame/target/scala-2.10/test-classes...
[error] /Users/pmichna/Documents/code/citygame/test/models/BaseModelTest.java:31: error: constructor DdlGenerator in class DdlGenerator cannot be applied to given types;
[error]         ddl = new DdlGenerator((SpiEbeanServer) server, new MySqlPlatform(), config);
[error]               ^
[error]   required: no arguments
[error]   found: SpiEbeanServer,MySqlPlatform,ServerConfig
[error]   reason: actual and formal argument lists differ in length
[error] 1 error
[error] (test:compile) javac returned nonzero exit code
[error] Total time: 2 s, completed 2013-12-17 00:21:23

Has the implementation of DdlGenerator changed?

Amidase answered 16/12, 2013 at 23:26 Comment(0)
G
7

Yes, the implementation has changed. The constructor takes no argument but instead there is a setup() method that should be used. This lead to something like this :

EbeanServer server = Ebean.getServer(serverName);
ServerConfig config = new ServerConfig();
DdlGenerator ddl = new DdlGenerator();
ddl.setup((SpiEbeanServer) server, new MySqlPlatform(), config);
Garb answered 17/12, 2013 at 7:53 Comment(2)
Thanks! Where do you find this information? I looked through Ebean JacaDoc and couldn't anything...Amidase
I looked at the source code of play. It uses the DdlGenerator to initiate the evolutions scripts. See here : github.com/playframework/playframework/blob/master/framework/…Garb

© 2022 - 2024 — McMap. All rights reserved.