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?

2
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
asked
2 answers
1

Hi Tim,

 

in the core.java 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 
	 */
	@Deprecated
	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.

answered
1

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

answered