Hello,
When I try to do the following (the map is below):
Code:
Criteria crit = session.createCriteria(User.class);
crit.createCriteria("departments").add(Expression.eq("departmentName", departmentName));
List result = crit.list();
I get this execption:
Code:
net.sf.hibernate.AssertionFailure an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
net.sf.hibernate.AssertionFailure TRAS0014I: The following exception was logged net.sf.hibernate.AssertionFailure: not an association
at net.sf.hibernate.collection.AbstractCollectionPersister.getElementPersister(AbstractCollectionPersister.java:707)
at net.sf.hibernate.type.PersistentCollectionType.getAssociatedClass(PersistentCollectionType.java:221)
at net.sf.hibernate.impl.CriteriaImpl.getClassForPath(CriteriaImpl.java:282)
I am using the version 2.1.1. Is it possible to execute this criteria with this version?
Thanks, Claudio (Apologize for my english)
------------
Code:
<hibernate-mapping>
<class name="com.giux.persistence.User"
table="app_users"
dynamic-update="false"
dynamic-insert="false">
<id
name="id"
column="id"
type="java.lang.Long"
unsaved-value="null">
<generator class="native"></generator>
</id>
Blah, Blah property definitions
<bag name="departments" table="app_usersdepartments" lazy="false" inverse="false">
<key>
<column name="userId" not-null="true"/>
</key>
<composite-element class="com.giux.persistence.UserDepartment">
<property name="userName" type="string"></property>
<property name="departmentName" type="string"></property>
<many-to-one name="department" class="com.giux.persistence.Department">
<column name="departmentId" not-null="true"/>
</many-to-one>
</composite-element>
</bag>
</class>
</hibernate-mapping>