How to configure buildSelectQueryForIdentity() [message #386590] |
Fri, 03 April 2009 09:16  |
Eclipse User |
|
|
|
Hi,
I need to change behavior for JPA annotation
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
The new IDENTITY values are obtained via SELECT @@IDENTITY. But I need to
change it to SELECT SCOPE_IDENTITY().
So I made new classs
public class MySQLServerPlatform extends SQLServerPlatform {
@Override
public ValueReadQuery buildSelectQueryForIdentity() {
ValueReadQuery valueReadQuery = new ValueReadQuery("select
scope_identity()");
return valueReadQuery;
}
}
added <property name="eclipselink.target-database"
value="cz.mediaservis.metro.entity.MySQLServerPlatform"/> to
persistence.xml
and after persisting I got exception
Exception EclipseLink-4011 (Eclipse Persistence Services - 1.1.0.r3634):
org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Error preallocating sequence numbers. The sequence
table information is not complete.
Probably I did something wrong. Could you plese help?
Thx
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.14073 seconds