-->
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: query for an object o where o.c equals a given List
PostPosted: Mon Sep 19, 2005 5:12 am 
Newbie

Joined: Tue Jun 21, 2005 5:23 am
Posts: 8
Hi

Im sorry, but i really got no clue how to resolve my problem.
(Pseudocode)

class A {
List<B> bs;
}

now i query 2 entities of b:
B b1 = myquery("constraints ... ")
B b2 = myquery("constraints ... ")

My question now is: How to find the entity of A, where a.bs contains b1 and b2 and nothing else.

My best idea till yet:
// pseudocode - just out of my mind
"where :b1 in elements (a.bs) and :b1. in elements(a.bs) and a.bs.size = 2"

I seen the "all elements" syntax inside the hib doku. No explanation, but its mentioned 2 times ;o)

So i thought it could be something like:
List example = new ArrayList();
example.add(b1).add(b2)

and now query like
":example = all elements(a.bs)"
setEntity("example",example);

Im not even sure if something like that could be possibible to work. It simply fails because hib does not know how to handle the ArrayList.

Would be fine, when youe could help me little bit ;o)
thx
Bernhard Neuhauser

Hibernate version: 3.0.5
Database: PostgreSQL 8.0


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.