[jboss-user] [JBoss Seam] - Persistence Question

anescu do-not-reply at jboss.com
Fri Jun 8 07:27:10 EDT 2007


Hi, I have this situation:

I have a Seam generated application (so I use lots of the generated code)

I enter on the edit screen of entity B from the list. 
B has a combo box of entity A. Near this combo box there is a link that sends me to the edit screen of the instance of A (A1) that is referred in the instance of B (B1).
I placed an attribute on entity A (transient) and on the edit screen, a combo box that allows me to create a new instance of A.
So, the flow would be this:
If I check the checkbox, I must "clone" A1 into A2, insert A2 into the DB, update B1.setA( A2 ), then update it into the DB.
If i don't check the box, then update A1.

I do this in the AHome class, in the update method:

public String update()
  | {
  | 	A a= getInstance();
  | 	B b = bHome.getInstance();
  | 	if( a.isSaveAsNew() )
  | 	{
  | 		A newA = a.duplicate();
  | 		B.setA(newA);
  | (1)
  | 		return persist();
  | 	}
  | 	else
  | 		return super.update();
  | }

But, the problem is that A1 also gets updated, and I don't want this to happen. I read on the forum something about FlushType.MANUAL. But I don't start a conversation, so what else can I do?

I tried different methods, even to set the newA as the instance, but always a gets updated.

Anyone, any idea?

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

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



More information about the jboss-user mailing list