| Adapting to existing database [message #514344] |
Sun, 14 February 2010 14:39  |
|
Originally posted by: ossipetz.gmail.com
Hello
I would like to get some advice. I am currently moving from hibernate to
eclipselink/JPA
My current task is to connect to an existing database that contains a
lot of logic. E.g. reading data is done by querying database views. So
an O/R mapping (what I am used to doing with hibernate) seems quite
straightforward.
The crucial point is the saving of data: this must be done calling
stored procedure (on the oracle database 10g / 11g).
I've seen there is an annotation @NamedStoredProcedureQuery in
eclipselink to use stored procedures.
Is it possible (or advisable) to mix reading (using standard O/R mapping
methods) and writing to the database with stored procedure calls?
Or must all operations be done via procedures?
How do relations behave with procedures?
There are quite a lot of tables and writing to table may change from
procedure to straight-forward inserts in the future.
I would be happy to hear some experience or get some advice on this.
Thanks a lot!
regards
ossi
|
|
|
| Re: Adapting to existing database [message #517926 is a reply to message #514344] |
Tue, 02 March 2010 09:40  |
James Sutherland Messages: 1834 Registered: July 2009 |
Senior Member |
|
|
You can override any operation in EclipseLink using a stored procedure call. There are no JPA annotations for this yet, so you need to use a @DescriptorCustomizer and set the StoredProcedureCall into the DescriptorQueryManager. You can override any CRUD operation, as well as any mapping operation.
See,
http://wiki.eclipse.org/Configuring_a_Relational_Descriptor_ %28ELUG%29#How_to_Configure_Custom_SQL_Queries_for_Basic_Per sistence_Operations_Using_Java
James : Wiki : Book : Blog
|
|
|
Powered by
FUDForum. Page generated in 0.01546 seconds