vlad wrote:
Quote:
I want to restrict update DTE_MASTERS when i am inserting ..can some body please guide me through this
Can you try to rephrase it because it's not clear what you are asking.
DTE_MASTERS IS A MASTERS TABLE and dte object is used as referance object many to one in base object.I do not want to do any thing with DTE_MASTERS.
just want to insert primary key vaue in main object which ia m trying insert new
@Proxy(lazy = false)
@Table(name = "MSMAN")
public class Msman {
@Id @GeneratedValue
@Column(name="MSAMN_ID")
private int msmanId;
@ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
@JoinColumn(name = "DTE_ID")
@NotNull
private Dte raisedByDte;
public Dte getRaisedByDte() {
return raisedByDte;
}
public void setRaisedByDte(Dte raisedByDte) {
this.raisedByDte = raisedByDte;
}
}
now ia am creating am object msman.setraisedByDte(new Dte(4)); and trying to save msman object.
New row is being inserted in msman table.but it is updating all dte_masters field value to null except DTE_ID which is 4 (already existing).
Thanks in advance