-->
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.  [ 2 posts ] 
Author Message
 Post subject: Polymorph queries and named/bound parameters - is it a bug?
PostPosted: Mon Dec 18, 2006 1:02 am 
Newbie

Joined: Thu Sep 21, 2006 12:33 am
Posts: 2
Hello! I've experienced some issues trying to implement polymorphic query in Hibernate.
The first thing I was trying

List<Class<? extends Entry>> classes = getClasses();
Query q = session.createQuery(" from " + Entry.class.getName() + " e where e.class in (:classes)");
q.setParametersList("classes", classes, Hibernate.CLASS);
return q.list();

The result was "Invalid character string format for type INTEGER."
The same result was even for the following:
Query q = session.createQuery(" from " + Entry.class.getName() + " e where e.class = ?");
q.setParameter(0, Entry.class, Hibernate.CLASS);
return q.list();

The only working code is the following:
Query q = session.createQuery(" from " + Entry.class.getName() + " e where e.class =" + Entry.class.getName());
return q.list();

Only in the last case Hibernate correctly converted class name to the discriminator value. Is it a bug in 3.1.3 or I am missing something? At least the second example worked great for me few years ago with Hibernate 2.1.6.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 20, 2007 3:31 pm 
Newbie

Joined: Wed Feb 01, 2006 10:45 am
Posts: 18
Location: Salzburg, Austria
hi,

have you solved the problem?

g,
kris

_________________
greetings,
kris


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