-->
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.  [ 7 posts ] 
Author Message
 Post subject: Get owner list of a list item
PostPosted: Thu Jan 22, 2004 8:09 am 
Beginner
Beginner

Joined: Thu Dec 25, 2003 8:08 am
Posts: 26
I'm trying to figure out how to find out what is the owner list of a list item.

My list mapping is:
Code:
  /**
   * @return m_listItems
   * @hibernate.list
   *  lazy="true"
   *  cascade="all"
   * @hibernate.collection-key
   *  column="ListId"
   * @hibernate.collection-index
   *  column="I"
   * @hibernate.collection-one-to-many
   *  class="com.mercado.s2002.businessmng.objects.rules.RuleBO"
   */
  public List getList() {
    return m_listItems;
  }


Now, suppose I have a list item (RuleBO) persistent instance, how can I find out which list holds it? I know the DB holds the list ID but I can't find out how to request it from Hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 8:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You need to use a bidirectional mapping. Please look at the "Parent Child Relationships" chapter in the reference manual.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 8:50 am 
Beginner
Beginner

Joined: Thu Dec 25, 2003 8:08 am
Posts: 26
The documentation states:
"Please note that Hibernate does not support bidirectional one-to-many associations with an indexed collection (list, map or array) as the "many" end."

So, what is the mapping I should use?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 8:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There is a workaround with explicitly mapped index properties. Search the forum.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 10:24 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If you find it, tell us, I'll add it to the wiki area

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 10:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
It was this one I think: http://forum.hibernate.org/viewtopic.php?t=926946&highlight=bidirectional+list+index


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 11:00 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Tks I'll check that

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.