package siprp.database.cayenne.providers;

import org.apache.cayenne.access.DataContext;

public class MainDAO
{
	protected static DataContext context = null;
	
	public MainDAO()
	{
		if( context == null )
		{
			context = DataContext.createDataContext();
		}
	}
	
	public void commit()
	{
		context.commitChanges();
	}
	
	public void rollback()
	{
		context.rollbackChanges();
		context.unregisterObjects( context.uncommittedObjects() );
	}
	
	public DataContext getContext()
	{
		return context;
	}
	
}
