cascade-update not working in my case


pavansailendra04@...
 

Class log
{
private int id;
@Persistent(column = "userId", defaultFetchGroup = "true")
@Extensions({@Extension(vendorName = "datanucleus", key = "cascade-update", value = "false")})
private User user;
}


Class User {
@Persistent(primaryKey = "true", valueStrategy = IdGeneratorStrategy.IDENTITY)
private int userId;
}

Every log has related user.

When updating or inserting log, we dont want to update user properties .
For example

Log log = new Log();
user.setRegion("CA")
log.set(user);

persist(log);

User region is getting updated even if cascade-update is false. [Cascade-persist is working!!]

Can some one please help on this ?

I debugged the code https://github.com/datanucleus/datanucleus-rdbms/blob/0812934216a04a63e953e173ebf4398250cc8150/src/main/java/org/datanucleus/store/rdbms/mapping/java/PersistableMapping.java#L598 cascade persist check is there but could not find any check for cascade-update. Should we persist data in different way ?

Join main@datanucleus.groups.io to automatically receive all group messages.