Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
1.2.4 JPA.em().createNativeQuery(que ryString).getResultList() ERROR!!!!
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ferreira  
View profile  
 More options Mar 15 2012, 3:23 pm
From: Ferreira <s3rg10f3rr3...@gmail.com>
Date: Thu, 15 Mar 2012 12:23:12 -0700 (PDT)
Local: Thurs, Mar 15 2012 3:23 pm
Subject: 1.2.4 JPA.em().createNativeQuery(queryString). getResultList() ERROR!!!!

Hi, can some one tell me why this doen't work?
thanks in advance

this works fine but is to much information

String queryString="SELECT FROM User as u INNER JOIN Skill as sk";
 List<Object[]> list = JPA.em().createNativeQuery(queryString
).getResultList();

but when i try to get just from a user, it doesn't work

 Execution exception

*PersistenceException* occured :
org.hibernate.exception.SQLGrammarException: could not execute query
String queryString ="SELECT uhs.*, sk.* FROM UserHasSkills uhs"+
"LEFT JOIN User us ON us.id = uhs.id"+
"LEFT JOIN skill sk ON sk.id = uhs.skill_id"+
"WHERE uhs.user_id=1";

List<Object[]> list =
JPA.em().createNativeQuery(queryString).getResultList();


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stikkos  
View profile  
 More options Mar 15 2012, 3:41 pm
From: Stikkos <stik...@gmail.com>
Date: Thu, 15 Mar 2012 19:41:11 +0000
Local: Thurs, Mar 15 2012 3:41 pm
Subject: Re: [play-framework] 1.2.4 JPA.em().createNativeQuery(queryString). getResultList() ERROR!!!!

Do you have a property called skill_id or user_id in the UserHasSkills entity? Or are these the name of the database column?
In your query you need to use the entity parameter names (and not the DB column names).

On 15 Mar 2012, at 19:23, Ferreira wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stikkos  
View profile  
 More options Mar 15 2012, 3:42 pm
From: Stikkos <stik...@gmail.com>
Date: Thu, 15 Mar 2012 19:42:44 +0000
Local: Thurs, Mar 15 2012 3:42 pm
Subject: Re: [play-framework] 1.2.4 JPA.em().createNativeQuery(queryString). getResultList() ERROR!!!!

Sorry, just noticed that you are calling createNativeQuery so ignore my last comment.

can you execute the query directly in a SQL client?

On 15 Mar 2012, at 19:41, Stikkos wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicolas Leroux  
View profile  
 More options Mar 15 2012, 3:46 pm
From: Nicolas Leroux <leroux.nico...@gmail.com>
Date: Thu, 15 Mar 2012 20:46:07 +0100
Local: Thurs, Mar 15 2012 3:46 pm
Subject: Re: [play-framework] 1.2.4 JPA.em().createNativeQuery(queryString). getResultList() ERROR!!!!

You are missing white space between your strings. It should be:

String queryString ="SELECT uhs.*, sk.* FROM UserHasSkills uhs "+
"LEFT JOIN User us ON us.id = uhs.id "+
"LEFT JOIN skill sk ON sk.id = uhs.skill_id "+"WHERE uhs.user_id=1";

On Mar 15, 2012, at 8:42 PM, Stikkos wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ferreira  
View profile  
 More options Mar 15 2012, 4:16 pm
From: Ferreira <s3rg10f3rr3...@gmail.com>
Date: Thu, 15 Mar 2012 13:16:06 -0700 (PDT)
Local: Thurs, Mar 15 2012 4:16 pm
Subject: Re: 1.2.4 JPA.em().createNativeQuery(queryString). getResultList() ERROR!!!!

Thanks every one


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »