-->
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: Attribute von Komponenten mit Criteria suchen
PostPosted: Tue May 09, 2006 11:05 am 
Newbie

Joined: Tue Mar 21, 2006 7:18 pm
Posts: 13
Hallo,

ich benutze Hibernate 3.1 und habe Probleme Attribute von Komponenten durch die Criteria API zu suchen.

Die Klasse Annotation hat eine Referenz auf die Klasse Position. Die Position ist als Komponent der Klasse Annotation auf die gleiche Tabelle gemappt.

Wenn ich eine Anfrage schreibe wie:
Criteria lCrit = lSession.createCriteria(Annotation.class).createCriteria("position").add(Restrictions.like("x", "12"));

dann kriege ich die folgende Exception:
org.hibernate.QueryException: could not resolve property: x of: dms.Annotation

Er sucht anscheinend das Attribut x in der Klasse Annotation anstatt in Position.

Wo liegt der Fehler?

Vielen Dank im Vorraus

Jakob

hier das Mapping:

<class name="dms.Annotation" table="ANNOTATION">
<id column="ID" name="id"/>
<discriminator column="ANNOTATION_TYPE" type="string"/>
<version column="VERSION" name="version"/>
....

<component class="dms.Position" name="position">
<property name="x">
<column name="X"/>
</property>
<property name="y">
<column name="Y"/>
</property>
</component>
....


Top
 Profile  
 
 Post subject: Solve problem!
PostPosted: Fri May 19, 2006 9:51 am 
Newbie

Joined: Fri May 19, 2006 9:46 am
Posts: 1
Code:
Criteria criteria = lSession.createCriteria(Annotation.class)
                                .add(Restrictions.ilike("position.x", "12"));


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.