Java Database Application Library

Get JDAL (Java Database Application Library) at Fast, secure and Free Open Source software downloads

Service Tier

The service tier is mainly declarative. I mean, it doesn´t include Java code. The reason is that the application itself is too simple and this tier supposes a redundant indirection that could be omitted. This will occur frequently in the type of applications for which the library is thought, especially if the business logic focuses on the domain models themselves.

We use this layer only to to distinguish transactions in execution from PersistentService methods, a simple wrapper to Daos.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
		default-lazy-init="false" default-init-method="init">
	<!-- Tx Advice -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <!-- the transactional semantics... -->
      <!-- all methods starting with 'get' and 'load' are read-only -->
      <tx:method name="get*" read-only="true"/>
      <tx:method name="load*" read-only="true"/>
      <!-- other methods use the default transaction settings -->
      <tx:method name="*"/>
    <!-- Make all methods on package service transactional  -->
     <aop:pointcut id="serviceOperation" 
     	expression="execution(* org.jdal.samples.library.service.*.*(..)) or execution(* info.joseluismartin.service.*.*(..))"/>
     <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation"/>
  <bean id="persistentService" class="info.joseluismartin.logic.PersistentManager">
  	<property name="dao" ref="basicDao"/>
  <bean id="bookService" class="info.joseluismartin.logic.PersistentManager">
  	<property name="dao" ref="bookDao"/>
  <bean id="authorService" class="org.jdal.samples.library.logic.AuthorManager">
  	<property name="dao" ref="authorDao"/>
  <bean id="categoryService" class="info.joseluismartin.logic.PersistentManager">
  	<property name="dao" ref="categoryDao"/>

Finally we have to perform the Presentation Layer