Hai All...
I tried many to many relationship for a person business example.The Business
class mapping is done as
@ManyToMany()
@JoinTable( name = "personbusiness",
joinColumns = @JoinColumn(name = "business_id",referencedColumnName =
"id"),
inverseJoinColumns = @JoinColumn(name = "person_id",referencedColumnName
= "id"))
public List<Person> getPersons() {
return persons;
}
public void setPersons(List<Person> persons) {
this.persons = persons;
}
The Person class mapping is done as
ManyToMany(mappedBy="persons")
public List<Business> getBusinessList() {
return businessList;
}
public void setBusinessList(List<Business> businessList) {
this.businessList = businessList;
}
The assosciated table created is personbusiness.
when adding persons to a buisness it is correctly inserting and listing from
tha association table.but when adding buisinesses to a person it is not
inserting to the association table.I have person class with business list.I
am getting the values of businesslist correctly while iterating in
personAction class.ie,
List<Business> businesstemp=person.getBusinessList();
log.debug("---------size of business
list------"+businesstemp.size());
Iterator itr=businesstemp.iterator();
while(itr.hasNext()){
Business busiitr = (Business) itr.next();
System.out.println("**********businessid***********"+busiitr
.getId());
}
But while saving using the following all the business id's in businessList
of person class are not saving in the association table personbusiness.
person = personManager.save(person);
But the otherside,all the selected person id's in persons of Business class
are inserting into the association table and it is working correctly
business = businessManager.save(business);
Plz help me
Thnks Angela
--
View this message in context:
http://www.nabble.com/Hai...-tp19387214s2369p19387214.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]