com.xenonsoft.bridgetown.test.aop.transaction
Class CreateTracksBusinessLogic

java.lang.Object
  extended bycom.xenonsoft.bridgetown.test.aop.transaction.CreateTracksBusinessLogic

public class CreateTracksBusinessLogic
extends java.lang.Object

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!

Version:
$Id: CreateTracksBusinessLogic.java,v 1.2 2005/03/29 23:42:21 peter_pilgrim Exp $
Author:
Peter Pilgrim, 14-Mar-2005 16:02:29

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

session

protected net.sf.hibernate.Session session
Constructor Detail

CreateTracksBusinessLogic

public CreateTracksBusinessLogic()
Method Detail

getSession

public net.sf.hibernate.Session getSession()
Gets the session

Returns:
Returns the session.

setSession

public void setSession(net.sf.hibernate.Session session)
Sets the session

Parameters:
session - The session to set.

createTracks

public java.util.List createTracks()
                            throws net.sf.hibernate.HibernateException
Business method to create favourite tracks

Returns:
list of collection of favoured MP3.
Throws:
net.sf.hibernate.HibernateException - if thrown will rollback the Hibernate transaction


Copyright © 2005 XeNoNSoFT.com. All Rights Reserved.