-->
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: arbitrary SQL WHERE condition
PostPosted: Tue Feb 14, 2006 4:02 am 
Beginner
Beginner

Joined: Fri Feb 10, 2006 8:33 am
Posts: 32
Hi GURUS

I have a class with mapping somting like this:

Code:
<class name="model.ClassificationConsumer" table="object_relations" [color=red]where="code_object1=1 and code_object2=1"[/color]>
.
.
</class>


and when I do

createQuery("from ClassificationConsumer")


everything is Ok

But when i haveanother class where:
Code:
<class .....
.....
<set name="ClassificationConsumer" lazy="true" cascade="all-delete-orphan">
                    <key column="id_object1" not-null="true"/>
                   
                    <one-to-many class="model.ClassificationConsumer" />
                </set>
</class>



thist arbitrary SQL WHERE condition
Code:
where="code_object1=1 and code_object2=1
do not work

Tel me WHY


Top
 Profile  
 
 Post subject: Workaround
PostPosted: Wed Feb 15, 2006 2:54 pm 
Newbie

Joined: Wed Feb 15, 2006 2:47 pm
Posts: 1
Hi

I've the same problem!

A possible workaround to this would be to put the where condition also in the <set ...> tag like this:

Code:
<set name="ClassificationConsumer" lazy="true" cascade="all-delete-orphan" where="code_object1=1 and code_object2=1">
    <key column="id_object1" not-null="true"/>
    <one-to-many class="model.ClassificationConsumer" />
</set>


This works for me, hope it helps you too.

But, if anyone knows, why the where condition does not work in the class, tell us.


Barklett


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.