org.formaria.data.pojo
Class HibernatePojoDataSource

java.lang.Object
  extended by org.formaria.data.DataSource
      extended by org.formaria.data.pojo.PojoDataSource
          extended by org.formaria.data.pojo.PersistentPojoDataSource
              extended by org.formaria.data.pojo.HibernatePojoDataSource

public class HibernatePojoDataSource
extends PersistentPojoDataSource

A data source for working with Hibernate POJOs. When the application is loaded the datasources are instantiated and in the case of a PojoDataSource the PojoRoot instance specified by the root element is instantiated and configured. The configuration project involves traversing the class hierarchy and setting up PojoModel nodes or proxies for each class in the pojo hierarchy, applying Hibernate mapping configuration to the POJO adapters that are used in the application. The configuration can specify naming overrides if the names established by reflection are not suitable

Copyright (c) Formaria Ltd., 2008
License: see license.txt


Field Summary
protected  java.util.Hashtable hibernateConfiguration
           
protected  JaxpXmlParser xmlParser
           
 
Fields inherited from class org.formaria.data.pojo.PojoDataSource
adapters, overrides, pojoContext, pojoRootModel
 
Fields inherited from class org.formaria.data.DataSource
currentProject
 
Constructor Summary
HibernatePojoDataSource(Project project)
          Creates a new instance of HibernatePojoDataSource
 
Method Summary
protected  PojoModel createPojoModel(DataModel parent, java.lang.Object pojo)
          Creates and returns a new instance of HibernatePojoModel
protected  PojoModel createPojoModel(DataModel parent, java.lang.String subPath)
          Creates and returns a new instance of HibernatePojoModel
protected  XmlElement getOverrideXml(PojoAdapter adapter)
          Gets the xml element describing overrides of the class being adapted by the specified adapter.
protected  void overrideAdapter(PojoAdapter adapter)
          Overrides the specified adapter, adds the information about lazily initialized properties.
 
Methods inherited from class org.formaria.data.pojo.PersistentPojoDataSource
createAdapter, customizeProperty, instantiatePojoContext
 
Methods inherited from class org.formaria.data.pojo.PojoDataSource
createProxyAdapter, getAdapter, getPojoContext, loadTable
 
Methods inherited from class org.formaria.data.DataSource
outputModel, outputModel, outputModel, read, read, readDataSource, setUseValueAsId, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hibernateConfiguration

protected java.util.Hashtable hibernateConfiguration

xmlParser

protected JaxpXmlParser xmlParser
Constructor Detail

HibernatePojoDataSource

public HibernatePojoDataSource(Project project)
Creates a new instance of HibernatePojoDataSource

Parameters:
project - the owner project
Method Detail

getOverrideXml

protected XmlElement getOverrideXml(PojoAdapter adapter)
Gets the xml element describing overrides of the class being adapted by the specified adapter. The runtime class name might be different from the one defined in the source code because of the Hibernate proxy object.

Overrides:
getOverrideXml in class PojoDataSource
Parameters:
adapter - the adapter object
Returns:
XmlElement object describing the overrides.

overrideAdapter

protected void overrideAdapter(PojoAdapter adapter)
Overrides the specified adapter, adds the information about lazily initialized properties.

Overrides:
overrideAdapter in class PersistentPojoDataSource
Parameters:
adapter - the adapter to be overrided.

createPojoModel

protected PojoModel createPojoModel(DataModel parent,
                                    java.lang.String subPath)
Creates and returns a new instance of HibernatePojoModel

Overrides:
createPojoModel in class PersistentPojoDataSource
Parameters:
parent - the parent model of the model node which is to be created
subpath - String consisting of pojo properties, must be in the format: propertyName(arguments...)[idx]
Returns:
PojoModel object

createPojoModel

protected PojoModel createPojoModel(DataModel parent,
                                    java.lang.Object pojo)
Creates and returns a new instance of HibernatePojoModel

Overrides:
createPojoModel in class PersistentPojoDataSource
Parameters:
parent - the parent model node
Returns:
PojoModel object