Hi,
how do I "reset" (set foreign key field to NULL) a assocation in a OneToOne
relationship ?
I tried to set it to "null" and then execute merge, but the UPDATE command
does not include this.
e.g.
// ----------------------------
@Entity
class M
{
@Id
long id ;
....
}
// ----------------------------
@Entity
class P
{
@Id
long id ;
int x;
int y;
@OneToOne // optional should be true by default
M myM ;
public void setMyM (M theM)
{ myM = theM ; }
}
....
P p = em.find (....)
p.setX ();
p.setY ();
// release association
p.setMyM ((M)null) ;
em.merge(p) ;
X,Y are updated, but field P.M_ID (foreign key field P=>M) stays unchanged.
How to do this, merge oder by an update command ?
Thanks a lot in advance
NR