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: use of <element> tag . please explaint it with an example
PostPosted: Tue May 11, 2010 6:42 pm 
Newbie

Joined: Tue May 11, 2010 6:38 pm
Posts: 5
Hi,

I'm looking through this hibernate documentation:

http://www.hibernate.org/hib_docs/v3/re ... ml_single/

Hibernate documentation doesnt clearly explain the use of <element> tag.

it would be great if anyone could offer explanation with examples ?


Top
 Profile  
 
 Post subject: Re: use of <element> tag . please explaint it with an example
PostPosted: Wed May 12, 2010 12:44 pm 
Newbie

Joined: Tue May 11, 2010 6:38 pm
Posts: 5
Here it is

store collection basic types, custom types, components and references to other entities

Example:

Code:
public class Person {
   private Long personId;
   private Collection<String> names;

   public Long setPersonId(Long personId){
    this.personId = personId;
   }

   public Long getPersonId(Long personId){
      return this.personId;
   }

   public Collection<String> getNames() {
      return names;
   }

   public void setNames(Collection<String> names) {
      this.names = names;
   }
}


Mapping file

Quote:
<bag name="names"
table="name"
lazy="true"
<key column="personid"/>
<element column="name" type="string"/>
</bag>


POST is closed


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.