Hi folks,
I got a domain object mapped to a database table that got an attribute of type "Class". So far so good. Now Hibernate 3.2.x stores the value of this attribute as a string containing the full qualified class name (e.g. "mypackage.MyClass").
Now when I try to look up such a domain object via the Hibernate criteria API, this fails as the parameter is bound wrong. I get following log output:
Quote:
DEBUG [StringType] binding ''MYCLASS'' to parameter: 1
[/quote]
And here is a short example:
Code:
package mypackage;
@Entity
@Table(name = "mytable")
public class MyObject {
@Column(name = "class")
private Class<? extends Serializable> classinfo;
}
Now the code for look up looks like this:
Code:
session.createCriteria(MyObject.class)
.add(Restrictions.eq("classinfo", MyOtherObject.class) )
.list();
Is there anything wrong that I do? Do I need a special type of criterion for attributes of type "Class"?
Regards,
bitbyter