edu.internet2.middleware.grouper.hibernate
Class ByObjectStatic

java.lang.Object
  extended by edu.internet2.middleware.grouper.hibernate.ByObjectStatic

public class ByObjectStatic
extends Object

for simple object queries, use this instead of inverse of control. this will do proper error handling and descriptive exception handling. This will by default use the transaction modes GrouperTransactionType.READONLY_OR_USE_EXISTING, and GrouperTransactionType.READ_WRITE_OR_USE_EXISTING depending on if a transaction is needed.

Author:
mchyzer

Method Summary
 void delete(Collection<?> collection)
           call hibernate method "delete" on a list of objects HibernateSession.byObjectStatic().delete(collection);
 void delete(Object object)
           call hibernate method "delete" on a list of objects HibernateSession.byObjectStatic().delete(Rosetta.getDAO(_f));
 boolean isIgnoreHooks()
          if we should ignore hooks
<T> T
load(Class<T> theClass, Serializable id)
          call hibernate "load" method on an object
static void main(String[] args)
           
 void save(Collection<?> collection)
           call hibernate method "save" on a list of objects HibernateSession.byObjectStatic().save(collection);
 Serializable save(Object object)
           call hibernate method "save" on an object HibernateSession.byObjectStatic().save(dao);
 void saveBatch(Collection<?> collection)
           call hibernate method "save" on a collection of objects in batch
 void saveOrUpdate(Collection<?> collection)
           call hibernate method "saveOrUpdate" on a list of objects HibernateSession.byObjectStatic().saveOrUpdate(collection);
 void saveOrUpdate(Object object)
          call hibernate "saveOrUpdate" method on an object
 ByObjectStatic setCacheable(Boolean cacheable)
          assign if this query is cacheable or not.
 ByObjectStatic setCacheRegion(String cacheRegion)
          cache region for cache
 ByObjectStatic setEntityName(String theEntityName)
          entity name if the object is mapped to more than one table
 ByObjectStatic setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
          assign a different grouperTransactionType (e.g.
 ByObjectStatic setIgnoreHooks(boolean theIgnoreHooks)
          if we should ignore hooks
 String toString()
          string value for error handling
 void update(Collection<?> collection)
           call hibernate method "update" on a list of objects HibernateSession.byObjectStatic().update(collection);
 void update(Object object)
          call hibernate "update" method on an object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setGrouperTransactionType

public ByObjectStatic setGrouperTransactionType(GrouperTransactionType theGrouperTransactionType)
assign a different grouperTransactionType (e.g. for autonomous transactions)

Parameters:
theGrouperTransactionType -
Returns:
the same object for chaining

setCacheable

public ByObjectStatic setCacheable(Boolean cacheable)
assign if this query is cacheable or not.

Parameters:
cacheable - the cacheable to set
Returns:
this object for chaining

toString

public String toString()
string value for error handling

Overrides:
toString in class Object
Returns:
the string value

setCacheRegion

public ByObjectStatic setCacheRegion(String cacheRegion)
cache region for cache

Parameters:
cacheRegion - the cacheRegion to set
Returns:
this object for chaining

setEntityName

public ByObjectStatic setEntityName(String theEntityName)
entity name if the object is mapped to more than one table

Parameters:
theEntityName - the entity name of the object
Returns:
this object for chaining

update

public void update(Collection<?> collection)
            throws GrouperDAOException
 call hibernate method "update" on a list of objects
 
 HibernateSession.byObjectStatic().update(collection);
 
 

Parameters:
collection - is collection of objects to update in one transaction. If null or empty just ignore
Throws:
GrouperDAOException

update

public void update(Object object)
            throws GrouperDAOException
call hibernate "update" method on an object

Parameters:
object - to update
Throws:
GrouperDAOException

load

public <T> T load(Class<T> theClass,
                  Serializable id)
       throws GrouperDAOException
call hibernate "load" method on an object

Type Parameters:
T -
Parameters:
theClass - to load
id -
Returns:
the object
Throws:
GrouperDAOException

saveOrUpdate

public void saveOrUpdate(Collection<?> collection)
                  throws GrouperDAOException
 call hibernate method "saveOrUpdate" on a list of objects
 
 HibernateSession.byObjectStatic().saveOrUpdate(collection);
 
 

Parameters:
collection - is collection of objects to saveOrUpdate in one transaction. If null or empty just ignore
Throws:
GrouperDAOException

saveOrUpdate

public void saveOrUpdate(Object object)
                  throws GrouperDAOException
call hibernate "saveOrUpdate" method on an object

Parameters:
object - to update
Throws:
GrouperDAOException

save

public void save(Collection<?> collection)
          throws GrouperDAOException
 call hibernate method "save" on a list of objects
 
 HibernateSession.byObjectStatic().save(collection);
 
 

Parameters:
collection - is collection of objects to save in one transaction. If null or empty just ignore
Throws:
GrouperDAOException

save

public Serializable save(Object object)
                  throws GrouperDAOException
 call hibernate method "save" on an object
 
 HibernateSession.byObjectStatic().save(dao);
 
 

Parameters:
object - to save
Returns:
the id
Throws:
GrouperDAOException

saveBatch

public void saveBatch(Collection<?> collection)
               throws GrouperDAOException
 call hibernate method "save" on a collection of objects in batch
 
 

Parameters:
collection - of objects
Throws:
GrouperDAOException

delete

public void delete(Collection<?> collection)
            throws GrouperDAOException
 call hibernate method "delete" on a list of objects
 
 HibernateSession.byObjectStatic().delete(collection);
 
 

Parameters:
collection - is collection of objects to delete in one transaction. If null or empty just ignore
Throws:
GrouperDAOException

delete

public void delete(Object object)
            throws GrouperDAOException
 call hibernate method "delete" on a list of objects
 
 HibernateSession.byObjectStatic().delete(Rosetta.getDAO(_f));
 
 

Parameters:
object - is an object (if collection will still work), if null, will probably throw exception
Throws:
GrouperDAOException

setIgnoreHooks

public ByObjectStatic setIgnoreHooks(boolean theIgnoreHooks)
if we should ignore hooks

Returns:
if we should ignore hooks
See Also:
ByQueryBase.setIgnoreHooks(boolean)

isIgnoreHooks

public boolean isIgnoreHooks()
if we should ignore hooks

Returns:
if we should ignore hooks

main

public static void main(String[] args)
Parameters:
args -