Forums Register Login

@NamedNativeQuery and choosing the correct resultClass

+Pie Number of slices to send: Send


Probably this is simple question, but I just can't find the answer. What should be in the place of XXXX in this query? I have been trying java.lang.String.class and java.lang.Long.class but it doesn't work...
+Pie Number of slices to send: Send
Nothing, just do not include a resultClass. resultClass is only for SQL queries that are used to build Entity objects.
+Pie Number of slices to send: Send
Thanks a lot for the answer ! ^^
+Pie Number of slices to send: Send
Hi,

I want to call one stored procedure using JPA entity manager. In my stored procedure i have some input parameters and some as out put parameters. Please suggest, how to call this.
+Pie Number of slices to send: Send
JPA does not define any specific support for stored procedures or output parameters, native queries only directly support SQL returning a ResultSet.

Depending on what JPA provider and database you are using, there are some way to execute stored procedures.

See,
http://en.wikibooks.org/wiki/Java_Persistence/Advanced_Topics#Stored_Procedures
+Pie Number of slices to send: Send
 

Tom Stachlewski wrote:Thanks a lot for the answer ! ^^



I don't get this. I am having the same problem.

How do you get the integer result then?

int count = theDao.findByNamedQuery("findCount",queryParams);

I don't even know how to spell CIA. But this tiny ad does:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 22547 times.
Similar Threads
Stored procedures JPA and mappings
Hibernate second level cache questions
How to call stored procedure from Entity Manager if there is out parameter in stored procedure.
JPA and mapping result sets to POJO:s
How to map returned cursor to a POJO / Bean in Hibernate?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:19:34.