-->
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: about Criteria using ...
PostPosted: Wed Jul 11, 2007 3:40 am 
Newbie

Joined: Thu Jun 21, 2007 12:33 pm
Posts: 7
Hi everyone, i have some questions with the createCriteria sentence, supose this code:

Criteria query = s.createCriteria(NameOfMyClass.class);

...

//now imagine nameAttribute is a foreign key to another table

query.createCriteria("nameAttribute");

Correct me if i'm wrong, but if i don't add any restriction to this new criteria, the join clause won't appear in the final SQL query?

The last question:
if i make this:

Criteria query = s.createCriteria(NameOfMyClass.class);
query.createCriteria("nameAttribute");

query.add(someRestricion)
if(anyCondition){
How can i access to the nameAttribute criteria recently created??
because if i add some restriction hibernate will add in the actual criteria context
}

I admit any suggestion


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 6:33 am 
Newbie

Joined: Thu Jun 21, 2007 12:33 pm
Posts: 7
I haven't seen a method in the Criteria Interface for obtain a Criteria created, so I fixed my problem saving inside an auxiliar variable

Criteria c = myOtherCriteria.createCriteria("anyAttribute");
c.add(...);


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.