|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.riotfamily.riot.hibernate.support.HibernateUtils
public final class HibernateUtils
Field Summary | |
---|---|
static String |
LIVE_MODE_FILTER_NAME
|
static String |
PUBLISHED_PARAM_NAME
|
Method Summary | ||
---|---|---|
static void |
addEqOrNull(org.hibernate.Criteria c,
String name,
Object val)
|
|
static StringBuffer |
appendHql(StringBuffer hql,
String expression,
String term)
Appends the given term to the StringBuffer. |
|
static StringBuffer |
appendJoinsForSearch(StringBuffer hql,
String alias,
String[] propertyNames)
Joins all path properties requested by the search property names Example: search should be foo.bar = :search -> join this.foo * |
|
static Serializable |
convertId(Class<?> beanClass,
String id,
org.hibernate.SessionFactory sessionFactory)
|
|
static void |
enableLiveModeFilterIfNecessary(org.hibernate.Session session)
|
|
static
|
get(org.hibernate.Session session,
Class<T> beanClass,
String id)
|
|
static String |
getExampleWhereClause(Class<?> entityClass,
Object example,
String alias,
String[] propertyNames)
Returns a HQL term that can be used within a where-clause to perform a query-by-example. |
|
static String |
getIdAsString(org.hibernate.SessionFactory sessionFactory,
Object bean)
|
|
static Class<? extends Serializable> |
getIdentifierClass(Class<?> beanClass,
org.hibernate.SessionFactory sessionFactory)
|
|
static String |
getSearchWhereClause(String alias,
String[] propertyNames,
String searchParamName)
Returns a HQL term that can be used within a where-clause to perform a search. |
|
static boolean |
isLiveModeFilterDefined(org.hibernate.SessionFactory sf)
|
|
static boolean |
isPersistentProperty(org.hibernate.SessionFactory sessionFactory,
Class<?> clazz,
String propertyPath)
|
|
static void |
setCollectionValueParams(org.hibernate.Query query,
String[] names,
Class<?> entityClass,
Object object)
Sets collection values as individual query parameters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String LIVE_MODE_FILTER_NAME
public static final String PUBLISHED_PARAM_NAME
Method Detail |
---|
public static <T> T get(org.hibernate.Session session, Class<T> beanClass, String id)
public static Class<? extends Serializable> getIdentifierClass(Class<?> beanClass, org.hibernate.SessionFactory sessionFactory)
public static Serializable convertId(Class<?> beanClass, String id, org.hibernate.SessionFactory sessionFactory)
public static String getIdAsString(org.hibernate.SessionFactory sessionFactory, Object bean)
public static boolean isPersistentProperty(org.hibernate.SessionFactory sessionFactory, Class<?> clazz, String propertyPath)
public static String getExampleWhereClause(Class<?> entityClass, Object example, String alias, String[] propertyNames)
public static void setCollectionValueParams(org.hibernate.Query query, String[] names, Class<?> entityClass, Object object)
#getExampleWhereClause(Object, String, String[])
when your example contains collections.
The method iterates over the provides names array and inspects the given
bean (or map). If there's a property (or map entry) of the type
java.util.Collection
, the methods iterates over the
collection and sets a query parameter for each item. The name is suffixed
with an underscore and the item's index.
public static String getSearchWhereClause(String alias, String[] propertyNames, String searchParamName)
"(lower(<alias>.<property[0]>)
like :<searchParamName> or lower(<alias>.<property[1]>)
like :<searchParamName> or ...)"
public static StringBuffer appendJoinsForSearch(StringBuffer hql, String alias, String[] propertyNames)
join this.foo
*
public static StringBuffer appendHql(StringBuffer hql, String expression, String term)
public static void addEqOrNull(org.hibernate.Criteria c, String name, Object val)
public static boolean isLiveModeFilterDefined(org.hibernate.SessionFactory sf)
public static void enableLiveModeFilterIfNecessary(org.hibernate.Session session)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |