Class HibernateUtil

java.lang.Object
com.vaadin.featurepack.data.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 Details

    • HibernateUtil

      public HibernateUtil()
  • Method Details

    • 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.