-->
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: Simple update required - thoughts on implementation please
PostPosted: Tue Jun 01, 2010 7:15 pm 
Newbie

Joined: Tue Jun 01, 2010 6:53 pm
Posts: 1
Hi ,

I have inherited a web based application which uses Hibernate , Spring MVC and Velocity. I am not very experienced in any of these topics but can do a good job of reverse engineering learning - which has allowed me to do pretty much everything i require...anyhows i need to send emails from the system to a selected group of people and store this information ( subject , message, date, persons sent to etc) I have achieved this by creating two tables ;

issue_group_email (id, subject, message, datesent, user[user sending] )
issue_group_email_contacts ( id, issueGroupEmailId [linking to previous table], driverID [linking to drivers table])

I have created an appropriate Model Class, IssueGroupEmail which has the four fields in its table plus a field "drivers" of type List <Driver> . I was really impressed when Hibernate automagically saved not only my record in the first table but also every child record in the second table....problem is I now need to record the email address of the driver when the email is being sent. I can see that I can alter the issue_group_email_contacts table and add a new field, sentEmailAddress, but i cant seem to get my head around how to get hibernate to persist this field. Below is a snippet of the code which i am using and which i believe is storing the child records currently.

Code:
@OneToMany(cascade=CascadeType.ALL)
   @JoinTable(
         name="issue_group_email_contacts",
         joinColumns = @JoinColumn( name="issueGroupEmailId"),
         inverseJoinColumns = @JoinColumn( name="driverId")
   )
   public List<Driver> getDrivers() {
      return drivers;
   }
   public void setDrivers(List<Driver> drivers) {
      this.drivers = drivers;
   }



I am thinking that i will have to model the child records with a IssueGroupEmailContacts Class in java in order to set/get this information. Is this correct?


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.