bind(ServerActionManager.class).to(ServerActionManagerImpl.class);
}
private JpaPersistModule buildJpaPersistModule() {
PersistenceType persistenceType = configuration.getPersistenceType();
JpaPersistModule jpaPersistModule = new JpaPersistModule(Configuration.JDBC_UNIT_NAME);
Properties properties = new Properties();
switch (persistenceType) {
case IN_MEMORY:
properties.put("javax.persistence.jdbc.url", Configuration.JDBC_IN_MEMORY_URL);
properties.put("javax.persistence.jdbc.driver", Configuration.JDBC_IN_MEMROY_DRIVER);
properties.put("eclipselink.ddl-generation", "drop-and-create-tables");
properties.put("eclipselink.orm.throw.exceptions", "true");
jpaPersistModule.properties(properties);
return jpaPersistModule;
case REMOTE:
properties.put("javax.persistence.jdbc.url", configuration.getDatabaseUrl());
properties.put("javax.persistence.jdbc.driver", configuration.getDatabaseDriver());
break;
case LOCAL:
properties.put("javax.persistence.jdbc.url", Configuration.JDBC_LOCAL_URL);
properties.put("javax.persistence.jdbc.driver", Configuration.JDBC_LOCAL_DRIVER);
break;
}
properties.setProperty("javax.persistence.jdbc.user", configuration.getDatabaseUser());
properties.setProperty("javax.persistence.jdbc.password", configuration.getDatabasePassword());
switch (configuration.getJPATableGenerationStrategy()) {
case CREATE:
properties.setProperty("eclipselink.ddl-generation", "create-tables");
break;
case DROP_AND_CREATE:
properties.setProperty("eclipselink.ddl-generation", "drop-and-create-tables");
break;
}
properties.setProperty("eclipselink.ddl-generation.output-mode", "both");
properties.setProperty("eclipselink.create-ddl-jdbc-file-name", "DDL-create.jdbc");
properties.setProperty("eclipselink.drop-ddl-jdbc-file-name", "DDL-drop.jdbc");
jpaPersistModule.properties(properties);
return jpaPersistModule;
}