railo.runtime.orm.hibernate
Class HibernateORMSession

java.lang.Object
  extended by railo.runtime.orm.hibernate.HibernateORMSession
All Implemented Interfaces:
ORMSession

public class HibernateORMSession
extends Object
implements ORMSession


Constructor Summary
HibernateORMSession(HibernateORMEngine engine, org.hibernate.SessionFactory factory, DatasourceConnection dc)
           
 
Method Summary
 void _delete(PageContext pc, Component cfc)
           
 Object _executeQuery(PageContext pc, String hql, Object params, boolean unique, Struct queryOptions)
           
 void clear(PageContext pc)
          clear the session
 void close(PageContext pc)
          close the session
 Component create(PageContext pc, String entityName)
          creates a entity matching the given name
 void delete(PageContext pc, Object obj)
          delete elememt from datasource
 void evictCollection(PageContext pc, String entityName, String collectionName)
           
 void evictCollection(PageContext pc, String entityName, String collectionName, String id)
           
 void evictEntity(PageContext pc, String entityName)
           
 void evictEntity(PageContext pc, String entityName, String id)
           
 void evictQueries(PageContext pc)
           
 void evictQueries(PageContext pc, String cacheName)
           
 Object executeQuery(PageContext pc, String hql, Array params, boolean unique, Struct queryOptions)
           
 Object executeQuery(PageContext pc, String hql, Struct params, boolean unique, Struct queryOptions)
           
 void flush(PageContext pc)
          flush all elements in session
 DatasourceConnection getDatasourceConnection()
           
 ORMEngine getEngine()
          engine from session
 org.hibernate.Session getRawSession()
           
 ORMTransaction getTransaction(boolean autoManage)
           
 boolean isValid()
          is session valid or not
 Component load(PageContext pc, String cfcName, String id)
          load and return a Object that match given id, if there is more than one Object matching the id, only the first Object is returned
 Component load(PageContext pc, String name, Struct filter)
          load and return a Object that match given filter, if there is more than one Object matching the filter, only the first Object is returned
 Array loadAsArray(PageContext pc, String name, String id)
          load and return a array of Objects matching given id
 Array loadAsArray(PageContext pc, String name, String id, String order)
           
 Array loadAsArray(PageContext pc, String name, Struct filter)
          load and return a array of Objects matching given filter
 Array loadAsArray(PageContext pc, String name, Struct filter, Struct options)
          load and return a array of Objects matching given filter
 Array loadAsArray(PageContext pc, String name, Struct filter, Struct options, String order)
           
 Component loadByExample(PageContext pc, Object obj)
          load and return a Object that match given sampleEntity, if there is more than one Object matching the id, only the first Object is returned
 Array loadByExampleAsArray(PageContext pc, Object obj)
          load and return a array of Objects matching given sampleEntity
 Component merge(PageContext pc, Object obj)
          Attaches the specified entity to the current ORM session.
 void reload(PageContext pc, Object obj)
          Reloads data for an entity that is already loaded.
 void save(PageContext pc, Object obj, boolean forceInsert)
          insert entity into datasource, even the entry already exist
 Query toQuery(PageContext pc, Object obj, String name)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateORMSession

public HibernateORMSession(HibernateORMEngine engine,
                           org.hibernate.SessionFactory factory,
                           DatasourceConnection dc)
Method Detail

getDatasourceConnection

public DatasourceConnection getDatasourceConnection()
Specified by:
getDatasourceConnection in interface ORMSession
See Also:
ORMSession.getDatasourceConnection()

getEngine

public ORMEngine getEngine()
Description copied from interface: ORMSession
engine from session

Specified by:
getEngine in interface ORMSession
Returns:
engine
See Also:
ORMSession.getEngine()

flush

public void flush(PageContext pc)
           throws PageException
Description copied from interface: ORMSession
flush all elements in session

Specified by:
flush in interface ORMSession
Throws:
PageException
See Also:
ORMSession.flush(railo.runtime.PageContext)

delete

public void delete(PageContext pc,
                   Object obj)
            throws PageException
Description copied from interface: ORMSession
delete elememt from datasource

Specified by:
delete in interface ORMSession
Throws:
PageException
See Also:
ORMSession.delete(railo.runtime.PageContext, java.lang.Object)

_delete

public void _delete(PageContext pc,
                    Component cfc)
             throws PageException
Throws:
PageException

save

public void save(PageContext pc,
                 Object obj,
                 boolean forceInsert)
          throws PageException
Description copied from interface: ORMSession
insert entity into datasource, even the entry already exist

Specified by:
save in interface ORMSession
Throws:
PageException
See Also:
TODO also supports array like delete does

reload

public void reload(PageContext pc,
                   Object obj)
            throws PageException
Description copied from interface: ORMSession
Reloads data for an entity that is already loaded. This method refetches data from the database and repopulates the entity with the refreshed data.

Specified by:
reload in interface ORMSession
Throws:
ORMException
PageException
See Also:
ORMSession.reload(railo.runtime.PageContext, java.lang.Object)

create

public Component create(PageContext pc,
                        String entityName)
                 throws PageException
Description copied from interface: ORMSession
creates a entity matching the given name

Specified by:
create in interface ORMSession
Returns:
Throws:
ORMException
PageException
See Also:
railo.runtime.orm.ORMEngine#create(railo.runtime.PageContext, java.lang.String)

clear

public void clear(PageContext pc)
           throws PageException
Description copied from interface: ORMSession
clear the session

Specified by:
clear in interface ORMSession
Throws:
PageException
See Also:
ORMSession.clear(railo.runtime.PageContext)

evictQueries

public void evictQueries(PageContext pc)
                  throws PageException
Specified by:
evictQueries in interface ORMSession
Throws:
PageException
See Also:
ORMSession.evictQueries(railo.runtime.PageContext)

evictQueries

public void evictQueries(PageContext pc,
                         String cacheName)
                  throws PageException
Specified by:
evictQueries in interface ORMSession
Throws:
PageException
See Also:
ORMSession.evictQueries(railo.runtime.PageContext, java.lang.String)

evictEntity

public void evictEntity(PageContext pc,
                        String entityName)
                 throws PageException
Specified by:
evictEntity in interface ORMSession
Throws:
PageException
See Also:
ORMSession.evictEntity(railo.runtime.PageContext, java.lang.String)

evictEntity

public void evictEntity(PageContext pc,
                        String entityName,
                        String id)
                 throws PageException
Specified by:
evictEntity in interface ORMSession
Throws:
PageException
See Also:
ORMSession.evictEntity(railo.runtime.PageContext, java.lang.String, java.lang.String)

evictCollection

public void evictCollection(PageContext pc,
                            String entityName,
                            String collectionName)
                     throws PageException
Specified by:
evictCollection in interface ORMSession
Throws:
PageException
See Also:
ORMSession.evictCollection(railo.runtime.PageContext, java.lang.String, java.lang.String)

evictCollection

public void evictCollection(PageContext pc,
                            String entityName,
                            String collectionName,
                            String id)
                     throws PageException
Specified by:
evictCollection in interface ORMSession
Throws:
PageException
See Also:
ORMSession.evictCollection(railo.runtime.PageContext, java.lang.String, java.lang.String, java.lang.String)

executeQuery

public Object executeQuery(PageContext pc,
                           String hql,
                           Array params,
                           boolean unique,
                           Struct queryOptions)
                    throws PageException
Specified by:
executeQuery in interface ORMSession
Throws:
PageException
See Also:
ORMSession.executeQuery(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Array, boolean, railo.runtime.type.Struct)

executeQuery

public Object executeQuery(PageContext pc,
                           String hql,
                           Struct params,
                           boolean unique,
                           Struct queryOptions)
                    throws PageException
Specified by:
executeQuery in interface ORMSession
Throws:
PageException
See Also:
ORMSession.executeQuery(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Struct, boolean, railo.runtime.type.Struct)

_executeQuery

public Object _executeQuery(PageContext pc,
                            String hql,
                            Object params,
                            boolean unique,
                            Struct queryOptions)
                     throws PageException
Throws:
PageException

toQuery

public Query toQuery(PageContext pc,
                     Object obj,
                     String name)
              throws PageException
Specified by:
toQuery in interface ORMSession
Throws:
PageException
See Also:
ORMSession.toQuery(railo.runtime.PageContext, java.lang.Object, java.lang.String)

close

public void close(PageContext pc)
           throws PageException
Description copied from interface: ORMSession
close the session

Specified by:
close in interface ORMSession
Throws:
PageException
See Also:
ORMSession.close(railo.runtime.PageContext)

merge

public Component merge(PageContext pc,
                       Object obj)
                throws PageException
Description copied from interface: ORMSession
Attaches the specified entity to the current ORM session. It copies the state of the given object onto the persistent object with the same identifier and returns the persistent object. If there is no persistent instance currently associated with the session, it is loaded. The given instance is not associated with the session. User have to use the returned object from this session.

Specified by:
merge in interface ORMSession
Returns:
Throws:
PageException
See Also:
ORMSession.merge(railo.runtime.PageContext, java.lang.Object)

load

public Component load(PageContext pc,
                      String name,
                      Struct filter)
               throws PageException
Description copied from interface: ORMSession
load and return a Object that match given filter, if there is more than one Object matching the filter, only the first Object is returned

Specified by:
load in interface ORMSession
Returns:
Throws:
PageException
See Also:
ORMSession.load(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Struct)

loadAsArray

public Array loadAsArray(PageContext pc,
                         String name,
                         Struct filter)
                  throws PageException
Description copied from interface: ORMSession
load and return a array of Objects matching given filter

Specified by:
loadAsArray in interface ORMSession
Returns:
Throws:
PageException
See Also:
ORMSession.loadAsArray(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Struct)

loadAsArray

public Array loadAsArray(PageContext pc,
                         String name,
                         String id,
                         String order)
                  throws PageException
Specified by:
loadAsArray in interface ORMSession
Returns:
Throws:
PageException
See Also:
ORMSession.loadAsArray(railo.runtime.PageContext, java.lang.String, java.lang.String, java.lang.String)

loadAsArray

public Array loadAsArray(PageContext pc,
                         String name,
                         String id)
                  throws PageException
Description copied from interface: ORMSession
load and return a array of Objects matching given id

Specified by:
loadAsArray in interface ORMSession
Throws:
PageException
See Also:
ORMSession.loadAsArray(railo.runtime.PageContext, java.lang.String, java.lang.String)

loadAsArray

public Array loadAsArray(PageContext pc,
                         String name,
                         Struct filter,
                         Struct options)
                  throws PageException
Description copied from interface: ORMSession
load and return a array of Objects matching given filter

Specified by:
loadAsArray in interface ORMSession
Returns:
Throws:
PageException
See Also:
ORMSession.loadAsArray(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Struct, railo.runtime.type.Struct)

loadAsArray

public Array loadAsArray(PageContext pc,
                         String name,
                         Struct filter,
                         Struct options,
                         String order)
                  throws PageException
Specified by:
loadAsArray in interface ORMSession
Returns:
Throws:
PageException
See Also:
ORMSession.loadAsArray(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Struct, railo.runtime.type.Struct, java.lang.String)

load

public Component load(PageContext pc,
                      String cfcName,
                      String id)
               throws PageException
Description copied from interface: ORMSession
load and return a Object that match given id, if there is more than one Object matching the id, only the first Object is returned

Specified by:
load in interface ORMSession
Throws:
PageException
See Also:
ORMSession.load(railo.runtime.PageContext, java.lang.String, java.lang.String)

loadByExample

public Component loadByExample(PageContext pc,
                               Object obj)
                        throws PageException
Description copied from interface: ORMSession
load and return a Object that match given sampleEntity, if there is more than one Object matching the id, only the first Object is returned

Specified by:
loadByExample in interface ORMSession
Throws:
PageException
See Also:
ORMSession.loadByExample(railo.runtime.PageContext, java.lang.Object)

loadByExampleAsArray

public Array loadByExampleAsArray(PageContext pc,
                                  Object obj)
                           throws PageException
Description copied from interface: ORMSession
load and return a array of Objects matching given sampleEntity

Specified by:
loadByExampleAsArray in interface ORMSession
Throws:
PageException
See Also:
ORMSession.loadByExampleAsArray(railo.runtime.PageContext, java.lang.Object)

getRawSession

public org.hibernate.Session getRawSession()
Specified by:
getRawSession in interface ORMSession
See Also:
ORMSession.getRawSession()

isValid

public boolean isValid()
Description copied from interface: ORMSession
is session valid or not

Specified by:
isValid in interface ORMSession
Returns:
is session valid
See Also:
ORMSession.isValid()

getTransaction

public ORMTransaction getTransaction(boolean autoManage)
Specified by:
getTransaction in interface ORMSession
See Also:
ORMSession.getTransaction(boolean)


Copyright © 2012 Railo