-->
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: how to use criteria with sub-properties
PostPosted: Fri Oct 24, 2008 3:26 am 
Newbie

Joined: Fri Oct 24, 2008 2:47 am
Posts: 1
Hi all,

I would like to create a like query and filter on sub-properties. I did not find an answer in this forum although I found one topic that is related to my problem:

http://forum.hibernate.org/viewtopic.ph ... ubproperty

Mapping files:

Employment.hbm.xml => has many-to-one relation with Employee;
Employee.hbm.xml => has property "FullName";

code:

ICriteria criteria = base.Session.CreateCriteria(typeof(PID.Domain.Employment));
criteria.Add(Expression.Eq("SystemState", true));

criteria.Add(Expression.Like("Employee.FullName", EmployeeName, MatchMode.Anywhere));

When I list the criteria, I get an error "QueryException: could not resolve property".

The problem is that hibernate reads "Employee.FullName" as a single propery while FullName is a sub-propery.

When I use Expression.Eq, subproperties give no errors, only when I use Expression.Like I get this error.

Can someone tell me how to filter on sub-properties?


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.