| Author |
@NamedNativeQuery and choosing the correct resultClass
|
Tom Kowalski
Ranch Hand
Joined: Feb 17, 2009
Posts: 72
|
|
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...
|
SCJP, SCWCD, OCUP
|
 |
James Sutherland
Ranch Hand
Joined: Oct 01, 2007
Posts: 553
|
|
Nothing, just do not include a resultClass. resultClass is only for SQL queries that are used to build Entity objects.
|
TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
|
 |
Tom Kowalski
Ranch Hand
Joined: Feb 17, 2009
Posts: 72
|
|
|
Thanks a lot for the answer ! ^^
|
 |
xsunil kumar
Ranch Hand
Joined: Dec 14, 2009
Posts: 125
|
|
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.
|
 |
James Sutherland
Ranch Hand
Joined: Oct 01, 2007
Posts: 553
|
|
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
|
 |
Zaztz Zuraidah
Greenhorn
Joined: Apr 15, 2010
Posts: 1
|
|
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);
|
 |
 |
|
|
subject: @NamedNativeQuery and choosing the correct resultClass
|
|
|