-->
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.  [ 1 post ] 
Author Message
 Post subject: adding date/time stamp to a mapped collection of Strings
PostPosted: Thu Jul 09, 2009 11:58 am 
Newbie

Joined: Thu Jul 09, 2009 11:20 am
Posts: 1
Hello,

I am using annotations to map a basic collection of Strings to an existing entity like this:

Inside the parent entity class:

Code:
@org.hibernate.annotations.CollectionOfElements
@JoinTable (name="GoalToAchieve_entry", joinColumns=@JoinColumn(name="goalToAchieve_id"))
@org.hibernate.annotations.Sort(type = org.hibernate.annotations.SortType.NATURAL)
private SortedSet<String> entries = new TreeSet<String>();


This works fine and I have a 2-column (goalToAchieve_id and element) table resulting from the join. So I was wondering, how can I add a date/time stamp to each String of the collection, so that i can display a 3rd column with a time stamp every time a new String is added to the collection? The objective is to use a collection of simple objects (Strings) and not have to create a whole new entity (with a time/date field).

Is there a recommended way to do that? I believe even if I provide a timstamp field at the jsp interface which handles the adding of new Strings to the collection, it would still be a hibernate issue, since I need the timestamp to be persisted on the db.

Thanks in advance for any help.

Kindest regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.