| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| TransactionContext |
|
| 1.0;1 |
| 1 | package org.talos.impl.repository; | |
| 2 | ||
| 3 | import org.hibernate.Session; | |
| 4 | import org.talos.exception.TalosHibernateException; | |
| 5 | ||
| 6 | /** | |
| 7 | * This class manages the current transaction of a repository. | |
| 8 | */ | |
| 9 | public interface TransactionContext { | |
| 10 | ||
| 11 | /** | |
| 12 | * Discards any changes to the persistent store. | |
| 13 | * | |
| 14 | * @throws TalosHibernateException if the rollback operation fails. | |
| 15 | * @see org.talos.Talos#rollback() | |
| 16 | * @see #commit() | |
| 17 | */ | |
| 18 | void rollback() throws TalosHibernateException; | |
| 19 | ||
| 20 | /** | |
| 21 | * Commits any changes to the persistent store. | |
| 22 | * | |
| 23 | * @throws TalosHibernateException if the changes cannot be committed | |
| 24 | * @see org.talos.Talos#commit() | |
| 25 | * @see #rollback() | |
| 26 | */ | |
| 27 | void commit() throws TalosHibernateException; | |
| 28 | ||
| 29 | /** | |
| 30 | * Gets the current Hibernate Session. This will automatically start a transaction if one isn't | |
| 31 | * started yet. | |
| 32 | * | |
| 33 | * @return the current Hibernate Session | |
| 34 | * @throws TalosHibernateException if the Session cannot be retrieved | |
| 35 | * @see #commit() | |
| 36 | * @see #rollback() | |
| 37 | */ | |
| 38 | Session getSession() throws TalosHibernateException; | |
| 39 | ||
| 40 | } |