cascade-update not working in my case
pavansailendra04@...
Class log 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 ?
|
|
pavansailendra04@...
I have debugged and tried adding another field.
Class log { private int id; @Persistent(column = "userId", defaultFetchGroup = "true") @Extensions({@Extension(vendorName = "datanucleus", key = "cascade-update", value = "false")}) private User[] user; } Added user array instead of user. Now the casade-update seems to be working. https://github.com/datanucleus/datanucleus-rdbms/blob/4.0/src/main/java/org/datanucleus/store/rdbms/mapping/java/ArrayMapping.java#L237 Any specific reason why it is not implemented for normal objects. Implemented for collections, maps and arrays only
|
|
Maybe, since not a core JDO feature, nobody had time to implement it for 1-1 relations. Maybe there was no resource.
|
|
pavansailendra04@...
Thanks Andy for the confirmation. Can we achieve the same the functionality through any other existing feature?
|
|
I didn't "confirm" anything. I simply said maybe it wasn't completed.
Either way, in v6.0 that option is renamed "cascade-attach" since it provides for JPA CascadeType.MERGE (which is basically JDO "attach"). As a result "cascade-persist" will cater for both inserts and updates.
|
|