Deprecated Garbage Collections – Kenny Lee Chee Wei

A truckload of garbage by Kenny Lee Chee Wei

Spring Hibernate DAO Implementation with interface

leave a comment »


Assuming we have a module called Account Management in our project called foo,

We might can make use of the following package structure.

  1. foo.service.AccountManagement
  2. foo.service.AccountManagementImpl
  3. foo.dao.AccountDAO
  4. foo.dao.hibernate.AccountDAOImpl (In this case hibernate)
  5. foo.model.Account

Sample Spring-Hibernate Hierarchy UML

Spring Wiring

<bean id="accountDAO" class="rb.dao.hibernate.AccountDAOImpl"></bean>

<bean id="accountManagement" class="foo.service.AccountManagementImpl">
<property name="accountDAO">
<ref bean="accountDAO"/>

So note that you can replace the accountDAO with some other implementation class, probably using pure JDBC or ibatis.


As the experts say, always code to interfaces to cater for different implementations.

Written by kennii

August 7, 2007 at 9:52 am

Posted in Java, Spring Framework

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: