| reading new primary key of inserted object [message #641362] |
Thu, 25 November 2010 03:18  |
Manuel Messages: 5 Registered: October 2010 |
Junior Member |
|
|
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  |
James Sutherland Messages: 1844 Registered: July 2009 |
Senior Member |
|
|
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.
James : Wiki : Book : Blog
|
|
|
Powered by
FUDForum. Page generated in 0.01459 seconds