DdlGenerator constructor needs no arguments?

安稳与你 提交于 2019-12-07 14:18:16

问题


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?


回答1:


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);


来源:https://stackoverflow.com/questions/20623040/ddlgenerator-constructor-needs-no-arguments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!