I have a play application everything is working fine with the H2 database.
In H2 DB, as far as I understood, the default strategy for auto-generated ids is to use sequence, and the sequences are created and used correctly, with nextval being called and the insert sql query specifies my id field with the value returned from nextval, as expected ;-)
Pointing to DB2, first of all I noticed that the default behavior for DB2 is to use IDENTITY. I was having issues when using the GENERATED ALWAYS AS IDENTITY (my id was not being set after the insert call, even though it should as far as I understood - DB2 v10.5 and jdbc 4.0, so support for RETURN_GENERATED_KEYS exists).
Since I didn't manage to understand/solve that issue, I was trying to use SEQUENCE on DB2 instead of IDENTITY (since DB2 supports both). So I changed my DB creating the sequences and removing the generated always as identity from the tables. Also, I included the annotation accordingly in my models:
@Entity
public class Application extends Model {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="application_seq")
public long id;
...
Nevertheless, the annotation appears to be ignored, and the insert does not contain the id, and the nextval is never called (when pointing to DB2... when pointing to H2 it does).
Anyone knows what can be causing my issues? Anyone knows if play framework is ignoring this annotation in favor of the default for each DB based on the driver or anything like that? Any other ideas?
Anyone using play framework with DB2? :-)
Thanks!
--
---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
descriptor.setIdGeneratorName(genName);
this.dbIdentity.setSupportsGetGeneratedKeys(true);
this.dbIdentity.setSupportsSequence(true);
"DB2/LINUXX8664" in my case, and the comparison fails because it is case sensitive:
else if (dbProductName.contains("db2")) {
return new DB2Platform();
}
if (dbName.equals("db2")) {
return new DB2Platform();
}
in the DatabasePlatformFactory.byDatabaseName() method :-(
so now I got a java.lang.RuntimeException: database platform db2 is not known?