playframework - Play Framework 2.4 Ebean Id Generation -


until have been using play 2.3.9 , migrating play 2.4.1 when use old version of play saving entity works new verion id not generated. setup new project scratch , tried realize works , auto generated database has id field auto increments while old project has database uses sequences. have been trying configure play/ebean use sequences have not been succesfull far.

i took here http://www.avaje.org/topic-97.html , gave try still not working. suggestions appreciated.

my config looks this:

ebean.default.identitygeneration=sequence ebean.default.supportsgetgeneratedkeys=false ebean.default.supportssequences=true ebean.default.debug.sql=true 

i tried

ebean.default.identitygeneration=generator 

i put lines directly in application.conf fooled around serverconfigstartup way of configuring ebean no luck.

anyways, got work, if has same problem following fixes it:

public class myserverconfigstartup implements serverconfigstartup { @override public void onstart(serverconfig serverconfig) {     postgresplatform postgresplatform = new postgresplatform();     dbidentity dbidentity = postgresplatform.getdbidentity();     dbidentity.setsupportsgetgeneratedkeys(false);     dbidentity.setsupportssequence(true);     dbidentity.setidtype(idtype.generator);     serverconfig.setdatabaseplatform(postgresplatform); } 

}


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -