Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] MySQL & AUTO_INCREMENT

Jaka,
Hi, I haven't used strategy=GenerationType.AUTO, however the following custom generator annotations work for me on Oracle - if this helps.

@Id
@SequenceGenerator(name="EL_SEQUENCE_CELL", sequenceName="EL_CELL_SEQ", allocationSize=25)
@GeneratedValue(generator="EL_SEQUENCE_CELL")
private BigInteger id;

in
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.common.ddlgen/src/org/eclipse/persistence/example/jpa/server/business/Cell.java
using no jdbc override properties in
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.common.ddlgen/src/META-INF/persistence.xml

thank you
/michael

Jaka Janc(ar wrote:
Hi!

I'm trying to use MySQL's auto_increment feature.

My Entity has a property annotated like this:

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;

When creating EntityManagerFactory, I pass in:

commonConfig.put(PersistenceUnitProperties.TARGET_DATABASE, TargetDatabase.MySQL);
commonConfig.put(PersistenceUnitProperties.NATIVE_SQL, "true");

But I still keep getting the exception:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'mydb.SEQUENCE' doesn't exist

Whay else must I do?

Regards,
Jaka
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top