How does Mendix know the original values of an object in case of a rollback on a changed object that was already in the database?

Hi,   For instance if I edit an object that is stored in the database and then rollback the changes i did. How does Mendix know what the original values of the object are? Are the original values stored somewhere in the client or is the object retrieved again from database to present the original values in the Client?   Thanks!   Tim
2 answers

Hi Tim,


in the is stated:

	 * Rollback changes of the object with the given id (asynchronously).
	 * When the object's state is NORMAL: Removes the object from the cache, all performed changes without commit will be lost.
	 * When the object's state is NEW: Removes the object from the database.
	 * @param context the context.
	 * @param id the identifier of the object to rollback.
	 * @return returns the Future object.
	 * @throws CoreException 
	public static Future<IMendixObject> rollbackAsync(IContext context, IMendixIdentifier id) throws CoreException
		return component.core().rollbackAsync(context, id);


Which would mean, that the object in cache (with changes) is simply deleted. Any new use of the object will trigger a retrieve from DB, with the unadjusted values.


You might want to have a look at this learning path, especially the part about transactions: Mendix Academy - Manage Mendix Runtime and DB Interaction