Handling the exceptions:

bawltherapistSoftware and s/w Development

Dec 13, 2013 (3 years and 8 months ago)

97 views


Handling the

exceptions:

-

L
et it propagate
to upper layers
OR

wrap it in a

checked

application
exception
….


Management of identity fields
:

-

Use of surrogate
keys
...


Naming of model objects, and their properties:

-

Use of Java Bean standards…


Cleanly
injecting hibernate session factory:

-

At the startup binds to the
JNDI OR u
se of

static

singleton pattern
.


Cleanly separated DAO interfaces :

Any Hibernate Implementations extending from a BaseHibernateDao class:

-

Factoring out CRUD related common operation
s into

GenericDAO interface and have
reusable,
abstract
super

class

(which is for a particular provider, i.e.: Hibernate)

which implements the
interface
.

-

Interfaces for each entity type

which

extends
from the Generic
DAO, may contain specific entity
related

operations.

-

Each entity DAO implementations extends from the Generic DAO implementation and implements
its own DAO interface.

-

Providing a DAOFactory
interface to client which hides all the entity related

DAO

implementation
s.







A common 'unit of work' when dealing with (opening, closing, committing, etc) HibernateSession:

Handling Transactions:

-

Should be handled by the client code…

-

Provide a methods for begin & commit/r
ollback transactions within the Generic implementation.

-

Provide a method for
setting

the session

in the DAOFactory class either by wrapping the
HibernateUtil class’

method or any other mechanism



Additional Considerations:



Use of more generic approach




JPA




Annotations/XML mappings