-->
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: Problem finding not referenced entities and inheritance
PostPosted: Thu Jun 03, 2004 8:51 am 
Newbie

Joined: Thu Jun 03, 2004 7:31 am
Posts: 2
I search for not referenced child objects of a many-to-one association mapping with a query like this:

Code:
select c
from Parent p
right join p.child c
where p is null


It expands to SQL similar to this and works fine:
Code:
select * from parent p
right outer join child c on p.child_id=c.id
where p.id is null


Problems arise when using inheritance.
See the following query where Parent2 is mapped as a subclass of Parent (one table per class hierarchy) with a new introduced child2-property.
Code:
select c2
from Parent2 p2
right join p2.child2 c2
where p2 is null


It never returns any result as it expands to SQL like this:
Code:
select * from parent p
right outer join child c on p.child_id=c.id
where p.type in ('P2')   // test discriminator for Parent2 subclass
and p.id is null


The discriminator test prevents the query from selecting results. Is there another way to find unreferenced c2 objects? I can't use a bidirectional reference because the child table is proprietary and can't be altered.

best regards
Apex


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 10:57 am 
Newbie

Joined: Thu Aug 05, 2004 10:51 am
Posts: 2
Hi,

I've got exactly the same problem. I hope you've got a solution for it already.


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.