-->
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: Using where clause on mapping a collection
PostPosted: Mon Nov 28, 2005 4:56 am 
Newbie

Joined: Mon Aug 22, 2005 1:23 pm
Posts: 1
Hi,
please can someone post an example on how to use the where clause on mapping a class collection?

I have these two classes:

Code:
User {
   ...
   private IList messages = new ArrayList();
   public IList Messages {
      get { return messages; }
      set { messages = value;
   }
   ...
}

Message {
   ...
   private bool deleted = false;
   public bool Deleted {
      get { return deleted; }
      set { deleted = value; }
   }
   ...
}


Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
   <class name="yyy.User, yyy" table="Users">
           ...
      <bag name="Messages" where="deleted = 0" inverse="true" lazy="true" order-by="IDMessage" cascade="all">
         <key column="IDUser"/>
         <one-to-many class="yyy.Message, yyy"/>
      </bag>
   </class>
</hibernate-mapping>


But this doesn't work... can you help me?

Tnx


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 4:46 am 
Regular
Regular

Joined: Fri Jun 11, 2004 6:27 am
Posts: 81
Location: Yaroslavl, Russia
Is it working w/o "where" attribute? What are the sympthoms after all? Try to catch SQL (either with hibernate.show_sql=true, or usinq SQL trace utility) and look at it.

_________________
Best,
Andrew Mayorov // BYTE-force


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.