-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate/JPA2 TypedQuery error in Jboss7
PostPosted: Thu Dec 01, 2011 3:24 pm 
Newbie

Joined: Thu Jan 14, 2010 12:33 pm
Posts: 4
Hi all, I am getting the "Cannot create TypedQuery for query with more than one return" error that was fixed in release 3.6.8 (HHH-6591) when running my JPA2 (hibernate provider) application under jboss7 (7.0.2)

my application does not contain any hibernate jars in it's WEB-INF\lib directory, and solely depends on jboss,
I can do some queries, but not this one

Code:
@NamedQuery(name = "Carrier.findAllCarriers", query = "SELECT c, ir21.version, ir21.subVersion, ir21.updatedDatetime, ir21.userVdas.userId FROM Carrier c, Ir21Data ir21"),
   
em.createNamedQuery("Carrier.findAllCarriers", Carrier.class).getResultList();



I get the TypedQuery error :-(

I think jboss7 is using the latest hibernate because I see the following jar in it's modules dir

jboss_home\modules\org\jboss\as\jpa\hibernate\3\jboss-as-jpa-hibernate3-7.0.2.Final.jar
jboss_home\modules\org\jboss\as\jpa\hibernate\4\jboss-as-jpa-hibernate4-7.0.2.Final.jar

and

jboss_home\modules\org\hibernate\main\hibernate-core-4.0.0.CR2.jar
jboss_home\modules\org\hibernate\main\hibernate-commons-annotations-4.0.0.CR2.jar
jboss_home\modules\org\hibernate\main\hibernate-entitymanager-4.0.0.CR2.jar
jboss_home\modules\org\hibernate\main\hibernate-infinispan-4.0.0.CR2.jar


can someone help me and tell me how I can execute the namedquery?

thanks


Top
 Profile  
 
 Post subject: Re: Hibernate/JPA2 TypedQuery error in Jboss7
PostPosted: Wed Jan 11, 2012 3:29 am 
Newbie

Joined: Wed Jan 11, 2012 3:25 am
Posts: 1
I am quite sure you already figured this one out, but let me write it down just in case somebody did not.
Don't use TypedQuery, use just a normal Query (that is, use createNamedQuery without second parameter). You have to type the result to the class you in fact will effectively get but this way no problem occurrs.

I noticed this bug was still not fixed in 3.6.7, 3.6.8 and I didn't try 4.0.0 but I read somewhere it has the same issue.
Probably a tough bug to fix :(


Top
 Profile  
 
 Post subject: Re: Hibernate/JPA2 TypedQuery error in Jboss7
PostPosted: Wed Jan 11, 2012 10:55 am 
Newbie

Joined: Thu Jan 14, 2010 12:33 pm
Posts: 4
yes, thx for reply, I have been using code like

@SuppressWarnings("unchecked")
public List<Ir21Data> findAllIr21Datas()
{
Query query = em.createNamedQuery("Ir21Data.findAll");
List<Ir21Data> ir21Datas = query.getResultList();

return ir21Datas;
}
in order to keep eclipse from showing me various warnings, even with a cast,
i add @SuppressWarnings whcih i'd rather not.

I just like the TypedQuery and hope I can use it in future


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.