net.sf.oness.common.model.dao.hibernate
Class HibernateDao

java.lang.Object
  extended byorg.springframework.orm.hibernate.support.HibernateDaoSupport
      extended bynet.sf.oness.common.model.dao.hibernate.HibernateDaoSupport
          extended bynet.sf.oness.common.model.dao.hibernate.HibernateDao
All Implemented Interfaces:
AuditableDao, AuditingDao, Dao, FinderDao, org.springframework.beans.factory.InitializingBean

public class HibernateDao
extends HibernateDaoSupport
implements Dao

Dao that uses Hibernate for persistence

Version:
$Revision: 1.18 $
Author:
Carlos Sanchez

Field Summary
static java.lang.String WHERE_NOT_DELETED
           
 
Fields inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
logger
 
Constructor Summary
HibernateDao(java.lang.Class theClass)
          Create a HibernateDao for the class specified
HibernateDao(java.lang.String className)
          Create a HibernateDao for the class with name specified by className
 
Method Summary
 AuditableBusinessObject create(AuditableBusinessObject bo)
          Create a new object, the id value will be ignored
 void delete(java.io.Serializable id)
          Not implemented
 java.util.Collection filterNotDeleted(java.util.Collection collection)
          Filter a persistent collection, getting not deleted values.
 PaginatedList find(AuditableBusinessObject bo, int firstElement, int maxElements)
          Find objects with properties matching those of value.
 java.util.List findAll()
          Return all persistent instances of the given class
 java.util.List findById(java.util.Collection ids)
          Find a List of objects by their identifiers.
 AuditableBusinessObject findById(java.io.Serializable id)
          Find an object by its identifier.
 AuditableBusinessObject findWithDetails(java.io.Serializable id)
          Find an object and all related entities by its identifier.
protected  AuditableBusinessObject load(java.io.Serializable id)
          Return the persistent instance with the given identifier, assuming that the instance exists.
 AuditableBusinessObject update(AuditableBusinessObject bo)
          Update an object
 
Methods inherited from class net.sf.oness.common.model.dao.hibernate.HibernateDaoSupport
filter, findByProperty, findByPropertyContent, loadAndClone
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
afterPropertiesSet, closeSessionIfNecessary, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, initDao, setHibernateTemplate, setSessionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHERE_NOT_DELETED

public static final java.lang.String WHERE_NOT_DELETED
See Also:
Constant Field Values
Constructor Detail

HibernateDao

public HibernateDao(java.lang.Class theClass)
Create a HibernateDao for the class specified

Throws:
net.sf.hibernate.HibernateException

HibernateDao

public HibernateDao(java.lang.String className)
             throws java.lang.ClassNotFoundException
Create a HibernateDao for the class with name specified by className

Parameters:
className -
Throws:
java.lang.ClassNotFoundException
net.sf.hibernate.HibernateException
Method Detail

load

protected AuditableBusinessObject load(java.io.Serializable id)
Return the persistent instance with the given identifier, assuming that the instance exists.

Parameters:
id - a valid identifier of an existing persistent instance of the class
Returns:

findById

public AuditableBusinessObject findById(java.io.Serializable id)
Description copied from interface: AuditableDao
Find an object by its identifier. This should return only the specified entity, not the associated ones. This method returns the same object passed as argument.

Specified by:
findById in interface AuditableDao
Parameters:
id - identifier
Returns:
the value with that id, may have properties not initialized
See Also:
AuditableDao.findById(java.io.Serializable)

findById

public java.util.List findById(java.util.Collection ids)
Description copied from interface: FinderDao
Find a List of objects by their identifiers. This should return only the specified entity, not the associated ones.

Specified by:
findById in interface FinderDao
Parameters:
ids - collection of identifiers
Returns:
the values with that ids
See Also:
net.sf.oness.common.model.dao.AuditableDao#findById(java.util.Collection)

findWithDetails

public AuditableBusinessObject findWithDetails(java.io.Serializable id)
Description copied from interface: AuditableDao
Find an object and all related entities by its identifier.

Specified by:
findWithDetails in interface AuditableDao
Parameters:
id - identifier
Returns:
the value with that id and all properties initialized
See Also:
AuditableDao.findWithDetails(java.io.Serializable)

create

public AuditableBusinessObject create(AuditableBusinessObject bo)
Description copied from interface: AuditableDao
Create a new object, the id value will be ignored

Specified by:
create in interface AuditableDao
Parameters:
bo -
Returns:
the value created (with id, transactionTime and needed properties initialized)
See Also:
net.sf.oness.common.model.dao.AuditableDao#create(net.sf.oness.common.model.bo.Auditable)

update

public AuditableBusinessObject update(AuditableBusinessObject bo)
Description copied from interface: AuditableDao
Update an object

Specified by:
update in interface AuditableDao
Parameters:
bo - value to update
Returns:
the updated value
See Also:
net.sf.oness.common.model.dao.AuditableDao#update(net.sf.oness.common.model.bo.Auditable)

find

public PaginatedList find(AuditableBusinessObject bo,
                          int firstElement,
                          int maxElements)
Description copied from interface: FinderDao
Find objects with properties matching those of value. This should not return the associated entities. Properties whose value is null and Collections are ignored.

Specified by:
find in interface FinderDao
Parameters:
bo - parameters to filter on
firstElement - the first result, numbered from 0
maxElements - the maximum number of results
Returns:
See Also:
net.sf.oness.common.model.dao.FinderDao#find(net.sf.oness.common.model.bo.Auditable, int, int)

delete

public void delete(java.io.Serializable id)
Not implemented

Specified by:
delete in interface AuditingDao
Parameters:
id - The id of the value to delete
Throws:
java.lang.UnsupportedOperationException
See Also:
net.sf.oness.common.model.dao.AuditableDao#delete(java.io.Serializable)

findAll

public java.util.List findAll()
Return all persistent instances of the given class

Specified by:
findAll in interface FinderDao
Returns:
List of objects

filterNotDeleted

public java.util.Collection filterNotDeleted(java.util.Collection collection)
Filter a persistent collection, getting not deleted values. Allow efficient access to very large lazy collections. (Executing the filter does not initialize the collection.)

Parameters:
collection - a persistent collection to filter
Returns:
Collection the resulting collection
See Also:
Session.filter()


Copyright © 2003-2005 ONess Project. All Rights Reserved.