[jboss-user] [EJB 3.0] - Re: merge one-to-one strategy

Wolfgang Knauf do-not-reply at jboss.com
Wed Nov 1 04:23:58 EST 2006


Hi,

I think you have to modify both sides of the relationship (if it is bidirectional):

E.g in your strategy 2:
public double update2 (int recId, int fundId, int investorId, double saving) {
  |  
  |      Investor investor =new Investor( investorId);
  |      Fund fund = new Fund( fundId);
  |     TimeRecord rec =
  |          em.find(Fund.class,
  |                  Integer.valueOf(fundId));
  |  
  |     rec.setSaving( saving);
  |     saving.setTimeRecord (rec);
  |     rec.setFund( fund );
  |     fund.setTimeRecord (rec);
  |     rec.setInvestor( investor );	 
  |     investor.setTimeRecord (rec);
  |      em.merge (rec);
  |  
  |      return result;
  |    }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982318#3982318

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982318



More information about the jboss-user mailing list