-->
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: Constraint lost
PostPosted: Wed Mar 03, 2004 8:54 am 
Newbie

Joined: Tue Feb 17, 2004 2:51 pm
Posts: 10
Hello,

As a workaround to a previous problem:
http://forum.hibernate.org/viewtopic.php?t=928578

I have created two normal classes instead of a hierarchy, and instead of discriminator-value, I use the "where" parameter in the <class> tag.

So, I have a class hierarchy like this:

Code:
Company -------< StupidPerson -------< Address


The StupidPerson class mapping begins like this:

<class name="StupidPerson" where="intellecutallychallenged='1'"

Now if I have a query which queries on a StupidPerson property

select comp.stupidperson.name from Company as comp

the intellectuallychallenged constraint DO appear in the SQL query.

But if I query on

select comp.stupidperson.address.streetname from Company as comp

The intellectuallychallenged constraint does not appear, even if I clearly(?)
wanted that constraint.

Is this in accordance with Hibernate semantics? If, so how can I guarantee the constraints on parent entities are used when querying on child entitites?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 9:08 am 
Newbie

Joined: Tue Feb 17, 2004 2:51 pm
Posts: 10
Just to answer myself, the obvious thing is just to select any attribute from StupidPerson as well as Address.. then the constraint is there. So I guess this is something which only happen in a few scenarios when using scalar queries.


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.