package eu.dnetlib.dummy;

/**
 * Interface for Dummy daos to test the use of JTA transaction in Spring.
 * 
 * @author lexis
 */
public interface DummyDAOInterface {

	/**
	 * Tries to save the given DummyObject instance.
	 * 
	 * @param obj
	 *            DummyObject to save
	 * @param fail
	 *            true if we want the operation to throw an Exception, leading to a rollback.
	 */
	void save(final DummyObject obj, boolean fail);

	/**
	 * Tries to save the given DummyObject instance. This method has been introduced to test if JTA transaction worked
	 * when Jdbc connection are not hidden by the spring JDBC template.
	 * 
	 * @see DummyDAO
	 * @param obj
	 *            DummyObject to save
	 * @param fail
	 *            true if we want the operation to throw an Exception, leading to a rollback.
	 */
	void saveUsingConnection(final DummyObject obj, boolean fail);

	/**
	 * Deletes all content from datasources used by this DAO.
	 */
	void deleteAllContents();
}
