-->
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.  [ 4 posts ] 
Author Message
 Post subject: Simple way to persist a List of strings?
PostPosted: Mon Nov 15, 2004 5:11 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Hibernate version:
latest

I was wondering if there is a simple way to persist a List of string attached to an object?

ie:
Object A {
private List stringsList;

}

I'd rather not have to create an Object that only holds a string to persist in my collection if I don't have to. Id like the all-delete-orphan semantics on the List.

Thanks,
David


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 5:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Please read the documentation.

http://www.hibernate.org/hib_docs/refer ... s-ofvalues

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 5:35 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
try this:

<list name="strings" table="string_list" cascade="all-delete-orphan">
<key column="parent_id"/>
<element type="string" column="string_col"/>
</list>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 5:39 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Excellent I will give that a try. And Max I've read the docs many times but there is a LOT of information to try and keep track of, which is why there are really nice people like you and ccanning to help everyone else out =)

Thanks^
David


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