|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jzeno.aop.PersistencySupport
public class PersistencySupport
Provides convenient access to Hibernate related stuff without the need of having any 'hook'. The methods on this class can be called from any part of the application.
Constructor Summary | |
---|---|
PersistencySupport()
|
Method Summary | |
---|---|
static void |
autoSync(java.util.Collection entities)
|
static void |
autoSync(Entity entity)
|
static void |
clearCache()
This operation clears the entire second level cache, as well as the query cache of hibernate. |
static java.lang.Object |
create(java.lang.Class clazz)
Factory method for creating new entities. |
static AutoSyncSession |
createAutoSyncSession()
|
static Criteria |
createCriteria(java.lang.Class queryClass)
Convenience method to allow you to create a criteria query without requesting the hibernate session. |
static Query |
createQuery(java.lang.String hql)
Convenience method to allow you to create a query without requesting the hibernate session. |
static Session |
createSession()
Creates a new hibernate session. |
static void |
delete(Entity entity)
Register an entity for deletion |
static java.util.List |
getAll(java.lang.Class clazz)
This is a generic operation for retrieving all instances of a certain type of domain model class.. |
static AutoSyncSession |
getAutoSyncSession()
|
static java.lang.Object |
getEnumFromInt(int id,
java.lang.Class type)
|
static org.hibernate.cfg.Configuration |
getHibernateConfig()
Returns the hibernate Configuration object. |
static org.hibernate.Interceptor |
getInterceptorInstance()
|
static Session |
getSession()
Get the current session for your thread. |
static org.hibernate.SessionFactory |
getSessionFactory()
|
static void |
initialize(java.lang.Object proxy)
Swizzles in the given hibernate proxy. |
static boolean |
isDeleted(Entity entity)
|
static boolean |
isInitialized(java.lang.Object proxy)
|
static boolean |
isMapped(java.lang.Class clazz)
|
static boolean |
isNew(Entity entity)
|
static boolean |
isStarted()
Is hibernate allready started or not ? |
static void |
releaseAutoSyncSession()
|
static void |
releaseSession()
When a client does not require a hibernate session any longer, it should release the session by calling this operation. |
static void |
swizzle(java.util.List rootEntities,
java.lang.String propertyPathList)
|
static void |
swizzle(java.lang.Object rootEntity,
java.lang.String propertyPathList)
|
static void |
swizzleOnePropertyPath(java.util.List rootEntities,
java.lang.String propertyPath)
|
static void |
swizzleOnePropertyPathInternal(java.util.List rootEntities,
java.lang.String propertyPath)
|
static java.util.List |
swizzleReadOnly(Entity rootEntity,
java.lang.String propertyPathList)
|
static java.util.List |
swizzleReadOnly(java.util.List rootEntities,
java.lang.String propertyPathList)
|
static java.util.List |
swizzleReadOnlyFromIds(java.util.List ids,
java.lang.Class type,
java.lang.String propertyPathList)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PersistencySupport()
Method Detail |
---|
public static Session createSession()
Creates a new hibernate session.
public static void releaseSession()
When a client does not require a hibernate session any longer, it should release the session by calling this operation.
public static Session getSession()
Get the current session for your thread. When a session is started, it is
also associated with the current thread (see createSession()
).
This operation allows for convenient access to the current session. For
example from inside a business facade, when the session itself was
created transparently by an aspect of that business facade.
public static Query createQuery(java.lang.String hql)
Convenience method to allow you to create a query without requesting the hibernate session.
public static Criteria createCriteria(java.lang.Class queryClass)
Convenience method to allow you to create a criteria query without requesting the hibernate session.
public static boolean isStarted()
public static org.hibernate.SessionFactory getSessionFactory()
public static java.util.List getAll(java.lang.Class clazz)
This is a generic operation for retrieving all instances of a certain type of domain model class.. Just supply the Class that indicates the model bean of interest, and you get back a list of all objects of that type in the system. It also works on PersistentEnums.
clazz
- the type of object to look for.
public static org.hibernate.cfg.Configuration getHibernateConfig()
Returns the hibernate Configuration object. This an objectified version of all your mapping files (hbm.xml). This method now also supports the use of an AnnotationConfiguration-object (available as of Hibernate 3.2). This is an expanded Configuration-object allowing the use of EJB3 annotations and the accompanying Hibernate 3.2 annotation extensions. The method automatically determines which version to use depending on the existence of a hibernate.cfg.xml-file. In that case the more powerful AnnotationConfiguration is used. Bear in mind that even in this case, regular usage of the classic hbm.xml mapping files is still allowed. You merely have the option to mix and match annotations and mapping files or go completely with annotations (for more information see the Hibernate 3.2 documentation).
public static void initialize(java.lang.Object proxy)
Swizzles in the given hibernate proxy.
public static void clearCache()
This operation clears the entire second level cache, as well as the query cache of hibernate. It is primarily intended to be used in the unit testing to avoid interference between test cases...
public static java.lang.Object getEnumFromInt(int id, java.lang.Class type)
public static void delete(Entity entity)
entity
- public static java.lang.Object create(java.lang.Class clazz)
clazz
-
public static void autoSync(java.util.Collection entities) throws org.hibernate.ObjectDeletedException
org.hibernate.ObjectDeletedException
public static void autoSync(Entity entity) throws org.hibernate.ObjectDeletedException
org.hibernate.ObjectDeletedException
public static boolean isDeleted(Entity entity)
public static boolean isNew(Entity entity)
public static AutoSyncSession createAutoSyncSession()
public static void releaseAutoSyncSession()
public static AutoSyncSession getAutoSyncSession()
public static boolean isInitialized(java.lang.Object proxy)
public static void swizzle(java.lang.Object rootEntity, java.lang.String propertyPathList)
public static java.util.List swizzleReadOnly(Entity rootEntity, java.lang.String propertyPathList)
public static java.util.List swizzleReadOnly(java.util.List rootEntities, java.lang.String propertyPathList)
public static java.util.List swizzleReadOnlyFromIds(java.util.List ids, java.lang.Class type, java.lang.String propertyPathList)
public static void swizzle(java.util.List rootEntities, java.lang.String propertyPathList)
public static void swizzleOnePropertyPath(java.util.List rootEntities, java.lang.String propertyPath)
public static void swizzleOnePropertyPathInternal(java.util.List rootEntities, java.lang.String propertyPath)
public static boolean isMapped(java.lang.Class clazz)
public static org.hibernate.Interceptor getInterceptorInstance()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |