Skip to main content

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

PersistenceUnitProperties.NATIVE_SQL property has nothing to do with auto increment; Use Identity instead of Auto:

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



----- Original Message ----- From: "Jaka Jancar" <jaka@xxxxxxxxx>
To: "EclipseLink User Discussions" <eclipselink-users@xxxxxxxxxxx>
Sent: Thursday, March 19, 2009 4:58 PM
Subject: [eclipselink-users] MySQL & AUTO_INCREMENT


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