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,