my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes Stored procedures JPA and mappings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Stored procedures JPA and mappings" Watch "Stored procedures JPA and mappings" New topic
Author

Stored procedures JPA and mappings

Matej Perse
Greenhorn

Joined: Dec 16, 2009
Posts: 2
Hi all,

I already asked this question on the Hibernate forum (https://forum.hibernate.org/viewtopic.php?f=1&t=1001537) but it sims there are a very few people answering the questions. So here it goes:

I have a question regarding the stored procedures in JPA. I have the following Entity called RenGaraza which uses two stored procedures "vrniGarazo" and "vrniGarazoPk" that do basically the same thing. The only difference is in the were part of the procedure - the resultSet is the same in both cases.



The stuff works just fine when I call the procedure directly using the first named query - "vrniGarazo":



However, I need to call the same entity via another Entity "RenDelistavb":



I have tried all kinds of mambo-jumbo like adding the ResultSetMapping to the procedure, adding different loader and so on, but could not make it to work.

I get the NullPointerException and if I do some debugging I can see that "com.sun.jdi.InvocationException occurred invoking method." error.
I additionally debuged the procedure that is called in the second case and it sims that it executes correcly even using the correct id from
the RenDelistavb and that it actually generates the resultSet, but it is not returned correctly.

I intensively debugged the hibernate code and found out that the Set<RenGaraza> is initialized correctly but there is an obvious bug
in the procedure since the Set set in the PersistentSet class is not initialized anywhere and as a consequence



produces an error:




I am using the latest version of hibernate (3.4.0.GA)


Now, obviously my question is what am I doing wrong and if it is even possible to call the original clall (RenGaraza ) in the manner I am trying to do it?
If the answer is not, is there any workaround or another solution?


Thanks for the answers.

Regards,
Matej
 
 
subject: Stored procedures JPA and mappings