-->
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: How to map a List<Integer> Property
PostPosted: Thu Dec 29, 2005 3:54 am 
Newbie

Joined: Sun May 01, 2005 12:04 pm
Posts: 6
Location: Munich, Germany
My question is how do I map a typed list, e.g. List<Integer> property of a bean?

How does this look like in the HBM file?

Thanx!
Sven

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1

Mapping documents:
<hibernate-mapping>

<class name="de.vpe.idea.model.Idea" table="IDEAS">
<id name="id" column="IDEA_ID">
<generator class="native"/>
</id>
</class>

<property name="owner"/>
<property name="title"/>
<property name="text"/>
<property name="timestamp" type="timestamp" />
<property name="ratings"/>


<set name="comments" table="IdeaComment">
<key column="ideaId"/>
<many-to-many column="commentId" unique="true" class="de.vpe.idea.model.Comment"/>
</set>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
not yet
Full stack trace of any exception that occurs:
none
Name and version of the database you are using:
mysql will be used
The generated SQL (show_sql=true):
none
Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject: check the docs
PostPosted: Tue Jan 10, 2006 12:32 am 
Newbie

Joined: Thu Jan 05, 2006 7:33 pm
Posts: 13
hi hansamann

theres good docs about collections in general and lists specifically at:
http://www.hibernate.org/hib_docs/v3/re ... ns-indexed

basically, you:

- choose a collection type (in this case List)
- choose the content type (in this case Integer)
- map it

Code:
eg

<list name="myIntegers" table="myIntegerListTable">
    <key column="someNameForYourKeyColumn"/>
    <element type="integer"/>
</list>


If the content type is a simple type (not a reference to another entity) you use the <element> tag.

happy hibernating

Michael


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.