- can be called outside a trasnaction (not good), but should AVOID this, otherwise mapped entities will not be saved which causes data inconsistency.(only the primary entity gets saved unless we flush the session)
- primary object is saved ASAP, the mapped object will be saved when committing transaction or flush the session
- if object is in persist state, when calling
save()
, triggerSQL UPDATE
, otherwiseSQL INSERT
- e.g. start a tran; read a obj, modify obj, save(obj), commit tran;
- load object to persistent context, further change will be tracked and saved when transaction is committed
- similar to
save()