-->
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.  [ 4 posts ] 
Author Message
 Post subject: AnyOf in Expression
PostPosted: Thu Mar 25, 2004 5:26 am 
Beginner
Beginner

Joined: Mon Nov 24, 2003 11:47 am
Posts: 22
Our company work on two large projects (both has more than 100 database tables). One is done with Toplink and second one with Hibernate. This is very good for comparison both tools. One thing is missed in Hibernate - we are not able to use many-to-many and many-to-one relationships in Expression (only one-to-many).

However in TopLink I cannot use dot syntax (column1.column2. ...) as in Hibernate (I must use exp.get(column1).get(column2)), I may use anyOf syntax: exp.anyOf(column1).get(column2).anyOfAllowingNone(column3) ...

Will be in Hibernate similar API ? Is there only possibility in Query define join tables ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 25, 2004 8:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You mean in the Criteria API? I don't understand. Certainly it is possible...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 26, 2004 12:14 pm 
Beginner
Beginner

Joined: Mon Nov 24, 2003 11:47 am
Posts: 22
It is in Criteria ? Where ?

For example I have two tables:
Code:
Customer (
  id long
  name String,
  zipid long)
Zip (
  zipid long
  zipcode String
)


I want find all Zip objects where name is 'John'. In Toplink I will create expression with anyOf syntax: exp.anyOf("customers").get("name").equal("John")

In Hibernate I must create query: "from zip z left join z.customers c where c.name = ?" and I am not able to use Criteria syntax.

I am wrong ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 26, 2004 3:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please re-read the documentation. It is easy:

Code:
session.createCriteria(Zip.class)
    .createCriteria("customers")
        .add( Expression.eq("name", "John")  )
    .list()


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.