net.mlw.vlh.adapter.hibernate3
Class HibernateAdapter

java.lang.Object
  extended bynet.mlw.vlh.adapter.AbstractValueListAdapter
      extended bynet.mlw.vlh.adapter.hibernate3.HibernateAdapter
All Implemented Interfaces:
ValueListAdapter

public class HibernateAdapter
extends AbstractValueListAdapter

This adapter wraps the functionality of Hibernate. Add extra functionality such as paging, focusing and validating of current result set. "Hibernate is a powerful, ultra-high performance object/relational persistence and query service for Java. Hibernate lets you develop persistent classes following common Java idiom - including association, inheritance, polymorphism, composition and the Java collections framework. The Hibernate Query Language, designed as a "minimal" object-oriented extension to SQL, provides an elegant bridge between the object and relational worlds. Hibernate also allows you to express queries using native SQL or Java-based Criteria and Example queries. Hibernate is now the most popular object/relational mapping solution for Java." -http://www.hibernate.org/

Version:
$Revision: 1.2 $ $Date: 2006/03/29 19:47:49 $
Author:
Matthew L. Wilson, Andrej Zachar

Field Summary
 
Fields inherited from interface net.mlw.vlh.ValueListAdapter
DO_FILTER, DO_FOCUS, DO_NOTHING, DO_PAGE, DO_SORT
 
Constructor Summary
HibernateAdapter()
           
 
Method Summary
 String getDefaultFocusPropertyObjectAlias()
           
 String getHql()
          Gets the hql used to retrieve the data.
protected  ValueList getListBackedValueList(ValueListInfo info, List list)
           
 long getMaxRowsForFocus()
          Maximum rows to search with Focus
 String getNamedQuery()
          Returns the namedQuery.
protected  org.hibernate.SessionFactory getSessionFactory()
          Return the Hibernate SessionFactory used by this DAO.
 StatementBuilder getStatementBuilder()
           
 ValueList getValueList(String name, ValueListInfo info)
          Gets a ValueList
 boolean isFocusOptimalization()
           
 boolean isRemoveEmptyStrings()
           
 void setAllowCreate(boolean allowCreate)
          Sets: If a new Session should be created if no thread-bound found.
 void setDefaultFocusPropertyObjectAlias(String defaultFocusPropertyObjectAlias)
          The name of object use to get focus property in hibernate hql syntax SELECT defaultFocusPropertyObjectAlias.getFocusProperty ...
 void setFocusOptimalization(boolean focusOptimalization)
          Enable or disable optimalization of the query for focus property.
 void setHql(String hql)
          Sets the hql used to retrieve the data.
 void setHsql(String hql)
          Deprecated. use setHql(String)
 void setMaxRowsForFocus(long maxRowsForFocus)
          Maximum rows to search with Focus
 void setNamedQuery(String namedQuery)
          Sets the namedQuery.
 void setRemoveEmptyStrings(boolean isPrefilterEmpty)
          Enable or Disable String length checking of given filters values.
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Set the Hibernate SessionFactory to be used by this DAO.
 void setStatementBuilder(StatementBuilder statementBuilder)
           
 void setValidator(ObjectValidator validator)
           If is set, it use special ScrollableResultsDecorator, that enable or disable to add object in final list.
 
Methods inherited from class net.mlw.vlh.adapter.AbstractValueListAdapter
getAdapterType, getDefaultNumberPerPage, getDefaultSortColumn, getDefaultSortDirectionInteger, setAdapterType, setDefaultNumberPerPage, setDefaultSortColumn, setDefaultSortDirection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateAdapter

public HibernateAdapter()
Method Detail

isFocusOptimalization

public boolean isFocusOptimalization()
Returns:
Returns the focusOptimalization.

setFocusOptimalization

public void setFocusOptimalization(boolean focusOptimalization)
Enable or disable optimalization of the query for focus property.

Parameters:
focusOptimalization - true - enable query with short select, false - query with full select

setValidator

public void setValidator(ObjectValidator validator)

If is set, it use special ScrollableResultsDecorator, that enable or disable to add object in final list.

NOTE:

Also, it respects the total count of entries that overlap your paged list.

Parameters:
validator - The validator to set.

isRemoveEmptyStrings

public boolean isRemoveEmptyStrings()
Returns:
Returns the isPrefilterEmpty.

setRemoveEmptyStrings

public void setRemoveEmptyStrings(boolean isPrefilterEmpty)
Enable or Disable String length checking of given filters values. If filter value is null or empty is removed from query.

Parameters:
isPrefilterEmpty - true-remove null and empty, false - remove only null filters.

getValueList

public ValueList getValueList(String name,
                              ValueListInfo info)
Description copied from interface: ValueListAdapter
Gets a ValueList

Parameters:
info - The ValueList information
name - The name of the ValueList
Returns:
The ValueList
See Also:
ValueListAdapter.getValueList(java.lang.String, net.mlw.vlh.ValueListInfo)

getListBackedValueList

protected ValueList getListBackedValueList(ValueListInfo info,
                                           List list)
Parameters:
info -
list -
Returns:
DefaultListBackValueList instance

setSessionFactory

public final void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set the Hibernate SessionFactory to be used by this DAO.

Parameters:
sessionFactory - The Hibernate SessionFactory to be used by this DAO.

getSessionFactory

protected final org.hibernate.SessionFactory getSessionFactory()
Return the Hibernate SessionFactory used by this DAO.

Returns:
The Hibernate SessionFactory used by this DAO.

setHsql

public void setHsql(String hql)
Deprecated. use setHql(String)

Sets the hql used to retrieve the data.

Parameters:
hql - The hql to set.

setHql

public void setHql(String hql)
Sets the hql used to retrieve the data.

Parameters:
hql - The hql to set.

getNamedQuery

public String getNamedQuery()
Returns the namedQuery.

Returns:
Returns the namedQuery.

setNamedQuery

public void setNamedQuery(String namedQuery)
Sets the namedQuery.

NOTE: by using this you can not enable sorting, filtering, paging of the data, and focusing of rows.

Parameters:
namedQuery - The namedQuery to set.

getHql

public String getHql()
Gets the hql used to retrieve the data.

Returns:
Returns the hql.

setAllowCreate

public void setAllowCreate(boolean allowCreate)
Sets: If a new Session should be created if no thread-bound found.

Parameters:
allowCreate - The allowCreate to set.

getMaxRowsForFocus

public long getMaxRowsForFocus()
Maximum rows to search with Focus

Returns:
Returns the maxRowsForFocus.

setMaxRowsForFocus

public void setMaxRowsForFocus(long maxRowsForFocus)
Maximum rows to search with Focus

Parameters:
maxRowsForFocus - The maxRowsForFocus to set.

getDefaultFocusPropertyObjectAlias

public String getDefaultFocusPropertyObjectAlias()
Returns:
Returns the defaultFocusPropertyObject.

setDefaultFocusPropertyObjectAlias

public void setDefaultFocusPropertyObjectAlias(String defaultFocusPropertyObjectAlias)
The name of object use to get focus property in hibernate hql syntax SELECT defaultFocusPropertyObjectAlias.getFocusProperty ...

Parameters:
defaultFocusPropertyObjectAlias - The defaultFocusPropertyObjectAlias to set.

getStatementBuilder

public StatementBuilder getStatementBuilder()
Returns:
Returns the statementBuilder.

setStatementBuilder

public void setStatementBuilder(StatementBuilder statementBuilder)
Parameters:
statementBuilder - The statementBuilder to set.


Copyright © 2003-2006 mlavilson. All Rights Reserved.