Determining whether object isNew and Autocommitted

2
In reference to https://community.mendix.com/questions/4733/When-are-persistent-objects-that-are-not-committed-removed-from-memory What I mean is: If you have a Before Commit Event and in this circumstance a relationship between a parent and a child, the Child is the owner of the relationship and you commit the Child, this forces the Parent to auto-save for use of the Child. That means there is a copy of your intended New Object and when you save you make a second copy of it. How can I determine that an object is new and auto committed??
asked
2 answers
1

Edit according to reply:

You don't actually make a copy of it, it's still the same object if you commit it again. It just overwrites the object. Normally you should just commit the object that the association points to at the same time as you commit the object with the association though.

You can figure out the state of the object in a Java action (see apidocs but you really shouldn't need this. You don't have to worry about the state objects are in.

It is recommended to just commit the parent object yourself rather than relying on autocommit. Note that when your session ends or the server shuts down and the object still hasn't been properly committed, it will be removed.

answered
0

What I mean is: If you have a Before Commit Event and in this circumstance a relationship between a parent and a child, the Child is the owner of the relationship and you commit the Child, this forces the Parent to auto-save for use of the Child. That means there is a copy of your intended New Object and when you save you make a second copy of it.

How can I determine that an object is new and auto committed??

answered