|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xenonsoft.bridgetown.test.aop.transaction.CreateTracksBusinessLogic
This is a plain old Java object, but behaves like a Data Access Object with a real life dependency on a Hibernate session object.
The Bridgetown IoC assembler injects the Hibernate
session object into the POJO before the business logic
method is invoked createTracks().
The AOP proxy assembler invokes an transaction
interceptor TransactionMethodInterceptor
around the business logic method
so it does not necessarily need to implement try/catch
code around the data access at all.
The transaction interceptor demarcates the
transaction boundaries around the method with the
help of a TSM ITransactionServiceManager
If an a Hibernate exception is raised, then the transaction interceptor calls the TSM to rollback the transaction. If the business logic method proceed normally, and thus does not return abnormally. The interceptor, then, invokes the TSM to commit the transaction.
This is the power of IoC container and an AOP proxy implementation!
| Field Summary | |
protected net.sf.hibernate.Session |
session
|
| Constructor Summary | |
CreateTracksBusinessLogic()
|
|
| Method Summary | |
java.util.List |
createTracks()
Business method to create favourite tracks |
net.sf.hibernate.Session |
getSession()
Gets the session |
void |
setSession(net.sf.hibernate.Session session)
Sets the session |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected net.sf.hibernate.Session session
| Constructor Detail |
public CreateTracksBusinessLogic()
| Method Detail |
public net.sf.hibernate.Session getSession()
public void setSession(net.sf.hibernate.Session session)
session - The session to set.
public java.util.List createTracks()
throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException - if thrown will rollback the Hibernate transaction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||