-->
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: newbie criteria/association question
PostPosted: Thu Mar 10, 2005 3:01 pm 
Newbie

Joined: Wed Mar 09, 2005 10:15 pm
Posts: 10
hi all,

I'm trying to create a Criteria query that filters on an association with the criteria class. I'm able to run the query with no problems using simple properties. it's the associations that I'm having troubles with. I'm using Hibernate 2.1.7.

I have a Patient class and a set of patient status' for a given patient. I keep a record of status changes, so there's a collection of them.

Patient class
<hibernate-mapping default-cascade="none">
<class name="edu.test.persistence.PatientImpl" table="PATIENT">

<set name="patientstatusevents" order-by="PATIENT_ID" lazy="true" inverse="true">
<key>
<column name="PATIENT_ID"/>
</key>
<one-to-many class="edu.test.persistence.PatientstatuseventImpl"/>
</set>
</class>
</hibernate-mapping>


I'm able to create a criteria/query on the simple attrs, like lastName. Here's how I construct the Criteria

// Works fine
Criteria criteria = session.createCriteria(edu.test.persistence.Patient.class);
criteria.add( Expression.like("lastName", "Smith");

My problem comes trying to get a reference to the set of statusEvents. I've tried...

// stackTrace
Criteria statusEventsCriteria = criteria.createAlias("patientstatusevents", "statusEvents");

this should get me an alias to the set, but this gives me a stackTrace.

springframework.orm.hibernate.HibernateSystemException: Unknown entity class: edu.test.persistence.Patient; nested exception is net.sf.hibernate.MappingException: Unknown entity class: edu.test.persistence.Patient

this seems fairly simple and straightforward, yet I don't understand why I can't create the alias...ideas/help??

thanks jim


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 10, 2005 4:56 pm 
Newbie

Joined: Wed Mar 09, 2005 10:15 pm
Posts: 10
please disregard this post..I was able to figure it out.

thanks jim


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.