[jboss-user] [EJB 3.0] - setter updates the DB

merabi do-not-reply at jboss.com
Mon Apr 2 09:38:56 EDT 2007


Hi fellaz.

my company decided to develop a web app using EJB 3.0 but I'm facing a prob.

I hav a Entity as follows:

@Entity
public class StatusMassAd implements Serializable {
	@Id
	@Column(name="massAd_id")
	private int id;

	private int status;

	public int getId() {
		return id;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
}

When I use this entity to "setStatus", it updated the DB record after transaction ended.
The book I have says (or I assume it says) that the EJB will NOT update the DB unless I call the EntityManager's "merge" method.

I would like to update the DB ONLY if the merge method is called.

Anyone know how I can stop updating the DB when I use "setters"?


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

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



More information about the jboss-user mailing list