com.vaadin.addon.jpacontainer.util
Class HibernateUtil

java.lang.Object
  extended by com.vaadin.addon.jpacontainer.util.HibernateUtil

public class HibernateUtil
extends Object

Utility methods for finding Hibernate specific information about entities without forcing a compile-time dependency on the Hibernate framework.


Constructor Summary
HibernateUtil()
           
 
Method Summary
static String getMappedByProperty(Object entity, String propertyName)
          Finds the property's "mappedBy" value.
static boolean isLazyInitializationException(RuntimeException e)
          Reflectively finds out if the passed in exception is a Hibernate LazyInitializationException.
static boolean isUninitializedAndUnattachedProxy(Object obj)
          Reflectively finds out whether an object is an uninitialized Hibernate proxy and unattached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUtil

public HibernateUtil()
Method Detail

isLazyInitializationException

public static boolean isLazyInitializationException(RuntimeException e)
Reflectively finds out if the passed in exception is a Hibernate LazyInitializationException.

Parameters:
e -
Returns:
true if the exception is a Hibernate LazyInitializationException.

isUninitializedAndUnattachedProxy

public static boolean isUninitializedAndUnattachedProxy(Object obj)
Reflectively finds out whether an object is an uninitialized Hibernate proxy and unattached.

Parameters:
obj -
Returns:
true if the object is an uninitialized and unattached Hibernate proxy.

getMappedByProperty

public static String getMappedByProperty(Object entity,
                                         String propertyName)
Finds the property's "mappedBy" value.

Parameters:
entity - the entity containing the property
propertyName - the name of the property to find the "mappedBy" value for.
Returns:
the value of mappedBy in an annotation.


Copyright © 2013 Vaadin Ltd. All rights reserved.