Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink ignores GeneratedValue(strategy=GenerationType.IDENTITY)
EclipseLink ignores GeneratedValue(strategy=GenerationType.IDENTITY) [message #1714001] Mon, 09 November 2015 10:59 Go to next message
Jacek Kryszyn is currently offline Jacek KryszynFriend
Messages: 1
Registered: November 2015
Junior Member

I have a problem which I described on StackOverflow in question nr 33600187 (I can't paste the link since I'm new). Basically my problem is that although my entities id is annotated with @GeneratedValue(strategy=GenerationType.IDENTITY) , EclipseLink doesn't save the entity to the database. I use PostgreSQL and my id column is of serial type.

I get the following log:

2015-11-08T23:37:20.748+0100|Finer: client acquired: 133317409 2015-11-08T23:37:20.760+0100|Finer: TX binding to tx mgr, status=MARKED_ROLLBACK 2015-11-08T23:37:20.761+0100|Finer: acquire unit of work: 1890544759 2015-11-08T23:37:20.762+0100|Finest: persist() operation called on: com.amleto.server.model.entities.FacebookDebug@7e0498c2. 2015-11-08T23:37:20.763+0100|Finer: TX beginTransaction, status=MARKED_ROLLBACK 2015-11-08T23:37:20.764+0100|Finest: Execute query DataModifyQuery(name="SEQ_GEN_IDENTITY" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + #PREALLOC_SIZE WHERE SEQ_NAME = #SEQ_NAME") 2015-11-08T23:37:20.766+0100|Finest: Connection acquired from connection pool [default]. 2015-11-08T23:37:20.767+0100|Finest: reconnecting to external connection pool 2015-11-08T23:37:20.771+0100|Fine: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind => [1, SEQ_GEN_IDENTITY] 2015-11-08T23:37:20.883+0100|Warning: Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.postgresql.util.PSQLException: ERROR: relation "sequence" does not exist Position: 8 Error Code: 0 Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind => [1, SEQ_GEN_IDENTITY]

Can you please look at it and comment? I can't get it to work.
Re: EclipseLink ignores GeneratedValue(strategy=GenerationType.IDENTITY) [message #1714046 is a reply to message #1714001] Mon, 09 November 2015 14:33 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
The key piece in the StackOverflow question that you didn't post here is that you set the target-database property to "Database" rather than "PostgreSQL". The database generic platform cannot use PostgreSQL specific functionality such as identity, and so is using a sequence instead.

Change your target to PostgreSQL or switch to using a table or sequence generation strategy.
Previous Topic:Generated count queries with CriteriaBuilder
Next Topic:JAXB: Represent nested Model Group Schema Components with a java object hierarchy
Goto Forum:

Current Time: Mon Feb 26 05:42:18 GMT 2024

Powered by FUDForum. Page generated in 0.03095 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top