-->
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: Why is not type safe 3.6.x ??Query.list()???
PostPosted: Wed Feb 01, 2012 10:48 pm 
Newbie

Joined: Fri Jan 13, 2012 11:16 pm
Posts: 6
Why is not type safe 3.6.x ??Query.list()???

And how do I write type safe code to call Hibernate Query.list()??


Top
 Profile  
 
 Post subject: Re: Why is not type safe 3.6.x ??Query.list()???
PostPosted: Thu Feb 02, 2012 4:26 am 
Newbie

Joined: Wed Mar 10, 2010 3:12 am
Posts: 3
Hello.

As query can hold any types, I think it's not possible to get it typed with hibernate3 query model (perhaps in h4?) ... Nevertheless you may use this kind of util that I used:

Code:
@SuppressWarnings("unchecked")
public static <T> List<T> typedList(final Query query) throws HibernateException {
   return query.list();
}


Top
 Profile  
 
 Post subject: Re: Why is not type safe 3.6.x ??Query.list()???
PostPosted: Thu Feb 02, 2012 7:05 am 
Newbie

Joined: Fri Jan 13, 2012 11:16 pm
Posts: 6
diurnambule wrote:
Hello.

As query can hold any types, I think it's not possible to get it typed with hibernate3 query model (perhaps in h4?) ... Nevertheless you may use this kind of util that I used:

Code:
@SuppressWarnings("unchecked")
public static <T> List<T> typedList(final Query query) throws HibernateException {
   return query.list();
}


I found it is impossible in h4.
So do it as yours.


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.