palio.connectors.hibernate
Class HibernateConnector

java.lang.Object
  extended by palio.connectors.Connector
      extended by palio.connectors.hibernate.HibernateConnector
All Implemented Interfaces:
DedicatedConnectionSupport

public class HibernateConnector
extends Connector
implements DedicatedConnectionSupport

Hibernate connector is used to integrate Hibernate framework with jPALIO. There is possible to define many Hibernate connectors in one jPALIO instance.

Hibernate connector configuration
There are two ways to configure hibernate connector

The connector supports both.


I. Annotated based configuration

Connector configuration in jPALIO instance configuration file should contain following settings:

If mapping classes sources are stored in jPALIO objects, there is no need to specify mapping classes in connector configuration ( mapClasses). For that classes special object type should be used: JPA Mapping Class. While configuring/reconfiguring all jPALIO objects with this type are selected from database and added to the configuration (only assigned to the connector - see below).

Parameters from connector configuration are more important than parameters from Hibernate configuration file/object. Parameters from config file/object will be overwritten by connector parameters.

IMPORTANT! All mapping classes must be assigned to any connector. The assignement must be made by Assigned annotation. If not assigned, class will be omitted.

Author:
Krzysztof Madyniak (mailto:kmadyniak@torn.com.pl), Grzegorz TymiƄski (mailto:gtyminski@torn.com.pl)
See Also:
Assigned

Constructor Summary
HibernateConnector(java.lang.String url, java.util.Properties properties)
           
 
Method Summary
 void close()
          
 void dedicatedCommit()
          
 void dedicatedRollback()
          
 void dedicatedStart()
          
 void dedicatedStop()
          
 org.hibernate.Session getCurrentSession()
          Returns current hibernate session
 org.hibernate.Session getNewSession()
          Returns new hibernate session
 void init()
          
 boolean isTransaction()
          
 void refresh()
          
 
Methods inherited from class palio.connectors.Connector
getConnector, getInfo, getInstance, getName, getUrl, info, init, setDedicatedLogConfiguration, setInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateConnector

public HibernateConnector(java.lang.String url,
                          java.util.Properties properties)
Method Detail

getCurrentSession

public org.hibernate.Session getCurrentSession()
Returns current hibernate session


getNewSession

public org.hibernate.Session getNewSession()
Returns new hibernate session


init

public void init()
          throws palio.PalioException

Overrides:
init in class Connector
Throws:
palio.PalioException

close

public void close()

Specified by:
close in class Connector

refresh

public void refresh()
             throws palio.PalioException

Specified by:
refresh in class Connector
Throws:
palio.PalioException

dedicatedCommit

public void dedicatedCommit()
                     throws palio.PalioException

Specified by:
dedicatedCommit in interface DedicatedConnectionSupport
Throws:
palio.PalioException

dedicatedRollback

public void dedicatedRollback()
                       throws palio.PalioException

Specified by:
dedicatedRollback in interface DedicatedConnectionSupport
Throws:
palio.PalioException

dedicatedStart

public void dedicatedStart()
                    throws palio.PalioException

Specified by:
dedicatedStart in interface DedicatedConnectionSupport
Throws:
palio.PalioException

dedicatedStop

public void dedicatedStop()
                   throws palio.PalioException

Specified by:
dedicatedStop in interface DedicatedConnectionSupport
Throws:
palio.PalioException

isTransaction

public boolean isTransaction()
                      throws palio.PalioException

Specified by:
isTransaction in interface DedicatedConnectionSupport
Throws:
palio.PalioException