Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » reading new primary key of inserted object
reading new primary key of inserted object [message #641362] Thu, 25 November 2010 03:18 Go to next message
Eclipse UserFriend
Hi,

We use an Oracle 10g database and EclipseLink 2.1.1, without JPA.
When i insert a new object into the database with the UnitOfWork-Object by calling registerNewObject and commit, the primary key (NUMBER) is generated with a database sequence called by a database trigger on insert action.

The question is:
How can i read the new generated primary key back to my application???

i'm a bit confused about this. Any ideas or hints how this works?

Regards
MS
Re: reading new primary key of inserted object [message #641473 is a reply to message #641362] Thu, 25 November 2010 10:35 Go to previous message
Eclipse UserFriend
You can use the ReturningPolicy in EclipseLink to do this.

I would recommend however that you let EclipseLink assign the value and remove the trigger, or have the trigger do nothing if the id is already assigned.

This will allow EclipseLink to preallocate the sequence values, and be much more efficient.
Previous Topic:query-by-example and trim?
Next Topic:DB2 XML Column
Goto Forum:
  


Current Time: Sun Jul 06 22:40:42 EDT 2025

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

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

Back to the top