-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: How to use JPA with Hibernate Entity manager
PostPosted: Fri Apr 04, 2008 12:17 pm 
Newbie

Joined: Thu May 03, 2007 7:53 am
Posts: 15
Hi,

I am facing a problem, I want to use JPA QL in order to use outer join with on clause (on report query).
I am using JBOSS and EJB3 so I get entitymanager and I call createQuery method then query.getResultList().
But entitymanager seems to use HQL and not JPA QL because I have org.hibernate.hql.ast.QuerySyntax exception.

How can I force to use JPA QL ?

Regards,


Top
 Profile  
 
 Post subject: Re: How to use JPA with Hibernate Entity manager
PostPosted: Mon Apr 07, 2008 3:17 am 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
jmp wrote:
But entitymanager seems to use HQL and not JPA QL because I have org.hibernate.hql.ast.QuerySyntax exception.


Just use the right import:
Code:
import javax.persistence.Query;


Carlo


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 07, 2008 5:08 am 
Newbie

Joined: Thu May 03, 2007 7:53 am
Posts: 15
Thanks Carlo, but this is what i am doing.
This is the reason why I can call query.getResultList() method.

Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 07, 2008 1:41 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Are you sure you don't have a simple syntax error?
JPA QL is based on HQL, so if it works in JPA it should work in HQL;
HQL should be more powerful, having some extensions which are not part of the JPA standard.
see:
http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/queryhql.html

You may have found a bug, but you don't need to specify the language flavour.

Sanne


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 3:37 am 
Newbie

Joined: Thu May 03, 2007 7:53 am
Posts: 15
Excuse me Sanne, but with JPA QL you can set on clause on outer join where as in HQL you cannot.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.