-->
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.  [ 1 post ] 
Author Message
 Post subject: Basic Criteria against many-to-one (unresolved property)
PostPosted: Wed Jan 18, 2006 9:55 am 
Beginner
Beginner

Joined: Sun Oct 09, 2005 3:21 pm
Posts: 40
Hibernate version: 3.1.rc2

Mapping documents:
Code:
<class name="Resurs" table="RESURS">

   <id name="id">
      <column name="RESURSID" sql-type="INTEGER"/>
      <generator class="identity">
      </generator>
   </id>

   <discriminator formula="(SELECT CASE WHEN t1.BETECKNING LIKE '%tarfil' THEN 'tarfil' ELSE t1.BETECKNING END FROM RESURSTYP t1 WHERE t1.RESURSTYPID = RESURSTYPID)"/>

   <many-to-one name="typ" class="Resurstyp" lazy="false" foreign-key="FK_RESTYP_RES" index="RESURS_FK RESURS_SK">
      <column name="RESURSTYPID" sql-type="INTEGER" not-null="true"/>
   </many-to-one>

                .....
</class>

<class name="Resurstyp" table="RESURSTYP">

   <cache usage="read-only"/>

   <id name="id">
      <column name="RESURSTYPID" sql-type="INTEGER"/>
      <generator class="identity">
      </generator>
   </id>

   <property name="beteckning">
      <column name="BETECKNING" length="50" not-null="true"/>
   </property>
                .....
</class>



Code between sessionFactory.openSession() and session.close():
Code:
Criteria criteria = session.createCriteria(Resurs.class);
criteria.add(Expression.eq("typ.beteckning","whatever"));
return criteria.list();



Full stack trace of any exception that occurs:
could not resolve property: typ.beteckning of: matrix.v.dataaccess.pojo.Resurs



Question is why? This has to be the most basic type of Criteria. All I am doing is trying to query on the a foreign keyed type (i.e. resurstyp).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.