-->
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: Adding criterias for joined tables
PostPosted: Fri Feb 23, 2007 12:17 pm 
Beginner
Beginner

Joined: Fri Nov 03, 2006 6:15 am
Posts: 21
Hello,

I have the following code:

Opfile opfile =
(Opfile) session
.createCriteria("com.test.beans.File")
.add(Restrictions.in("fileid", fileids))
.add(Restrictions.eq("filetype", "SE2"))
.uniqueResult();

which works just fine. Now i want to add a field which is in a table that is
joined in a one-to-one relation and i just get the instance by:


opfile.getOpdir()

as soon as i instantiate opfile the Opdir class is also available. Now, how
can i add a criteria from this joined table with .add() method for criterias?
like:

Opfile opfile =
(Opfile) session
.createCriteria("com.test.beans.File")
.add(Restrictions.in("fileid", fileids))
.add(Restrictions.eq("filetype", "SE2"))
.add(Restrictions.eq("dirfl","Y"))
.uniqueResult();

when "dirfl" is a property of the joined class Opdir?


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.