-->
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: AssertionFailure: criteria and composite-element
PostPosted: Tue Jan 13, 2004 12:46 am 
Newbie

Joined: Mon Nov 17, 2003 11:04 am
Posts: 5
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>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 1:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The Criteria query API does not currently support queries against collections of value type instances. Use HQL instead.


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.