Example usage for org.hibernate HibernateException HibernateException

List of usage examples for org.hibernate HibernateException HibernateException

Introduction

In this page you can find the example usage for org.hibernate HibernateException HibernateException.

Prototype

public HibernateException(String message, Throwable cause) 

Source Link

Document

Constructs a HibernateException using the given message and underlying cause.

Usage

From source file:de.tudarmstadt.ukp.lmf.hibernate.EnumUserType.java

License:Apache License

@SuppressWarnings("unchecked")
public void setParameterValues(Properties parameters) {
    String enumClassName = parameters.getProperty("enumClassName");
    try {/*from  w  w w .ja v a  2 s.c  o m*/
        enumClass = (Class<Enum>) Class.forName(enumClassName);
    } catch (ClassNotFoundException cnfe) {
        throw new HibernateException("Enum class not found", cnfe);
    }
}

From source file:edu.northwestern.bioinformatics.studycalendar.domain.tools.hibernate.EnumUserType.java

License:BSD License

public void setParameterValues(Properties parameters) {
    String enumClassName = parameters.getProperty("enumClassName");
    try {//ww w  .ja  v  a 2  s  . c o  m
        enumClass = (Class<Enum>) Class.forName(enumClassName);
    } catch (ClassNotFoundException cnfe) {
        throw new HibernateException("Enum class not found", cnfe);
    }
}

From source file:edu.northwestern.bioinformatics.studycalendar.domain.tools.hibernate.ScheduledActivityStateType.java

License:BSD License

public Object getPropertyValue(Object component, int property) throws HibernateException {
    String name = getPropertyNames()[property];
    if (PropertyUtils.isReadable(component, name)) {
        try {//  w w  w  .  j av  a  2  s. c  om
            return PropertyUtils.getProperty(component, name);
        } catch (IllegalAccessException e) {
            throw new HibernateException("Failed to read property " + name + " from " + component, e);
        } catch (InvocationTargetException e) {
            throw new HibernateException("Failed to read property " + name + " from " + component, e);
        } catch (NoSuchMethodException e) {
            throw new HibernateException("Failed to read property " + name + " from " + component, e);
        }
    } else {
        return null;
    }
}

From source file:edu.northwestern.bioinformatics.studycalendar.domain.tools.hibernate.ScheduledActivityStateType.java

License:BSD License

public void setPropertyValue(Object component, int property, Object value) throws HibernateException {
    String name = getPropertyNames()[property];
    if (PropertyUtils.isWriteable(component, name)) {
        try {/*from   ww w.  j a  va2s . c o m*/
            PropertyUtils.setProperty(component, name, value);
        } catch (NoSuchMethodException e) {
            throw new HibernateException(
                    "Failed to set property " + name + " on " + component + " with value " + value, e);
        } catch (IllegalAccessException e) {
            throw new HibernateException(
                    "Failed to set property " + name + " on " + component + " with value " + value, e);
        } catch (InvocationTargetException e) {
            throw new HibernateException(
                    "Failed to set property " + name + " on " + component + " with value " + value, e);
        }
    }
}

From source file:edu.utah.further.core.data.oracle.type.OracleXmlType.java

License:Apache License

/**
 * @param _cached/*www.j a  v a  2s  .c o m*/
 * @param _owner
 * @return
 * @throws HibernateException
 * @see org.hibernate.usertype.UserType#assemble(java.io.Serializable,
 *      java.lang.Object)
 */
@Override
public Document assemble(final Serializable _cached, final Object _owner) throws HibernateException {
    try {
        return deserialize((String) _cached);
    } catch (final Exception e) {
        throw new HibernateException("Could not assemble String to Document", e);
    }
}

From source file:edu.utah.further.core.data.oracle.type.OracleXmlType.java

License:Apache License

/**
 * @param _obj//from w  w  w . j a  v a  2  s . com
 * @return
 * @throws HibernateException
 * @see org.hibernate.usertype.UserType#disassemble(java.lang.Object)
 */
@Override
public String disassemble(final Object _obj) throws HibernateException {
    try {
        return serialize((Document) _obj);
    } catch (final Exception e) {
        throw new HibernateException("Could not disassemble Document to Serializable", e);
    }
}

From source file:edu.utah.further.core.data.oracle.type.OracleXmlTypeAsString.java

License:Apache License

/**
 * @param _cached/*from   w ww .  j av  a 2s .  c  o m*/
 * @param _owner
 * @return
 * @throws HibernateException
 * @see org.hibernate.usertype.UserType#assemble(java.io.Serializable,
 *      java.lang.Object)
 */
@Override
public String assemble(final Serializable _cached, final Object _owner) throws HibernateException {
    try {
        return (String) _cached;
    } catch (final Exception e) {
        throw new HibernateException("Could not assemble String", e);
    }
}

From source file:edu.utah.further.core.data.oracle.type.OracleXmlTypeAsString.java

License:Apache License

/**
 * @param _obj/*from  w  ww  . j  av a  2 s  . c o  m*/
 * @return
 * @throws HibernateException
 * @see org.hibernate.usertype.UserType#disassemble(java.lang.Object)
 */
@Override
public String disassemble(final Object _obj) throws HibernateException {
    try {
        return (String) _obj;
    } catch (final Exception e) {
        throw new HibernateException("Could not disassemble String", e);
    }
}

From source file:edu.utah.further.core.data.oracle.type.OracleXmlTypeLength.java

License:Apache License

/**
 * @param _cached/*from   www  . jav  a 2 s.  c  o  m*/
 * @param _owner
 * @return
 * @throws HibernateException
 * @see org.hibernate.usertype.UserType#assemble(java.io.Serializable,
 *      java.lang.Object)
 */
@Override
public Long assemble(final Serializable _cached, final Object _owner) throws HibernateException {
    try {
        return (Long) _cached;
    } catch (final Exception e) {
        throw new HibernateException("Could not assemble XMLType length", e);
    }
}

From source file:edu.utah.further.core.data.oracle.type.OracleXmlTypeLength.java

License:Apache License

/**
 * @param _obj//  ww w  .j  av a2s .  com
 * @return
 * @throws HibernateException
 * @see org.hibernate.usertype.UserType#disassemble(java.lang.Object)
 */
@Override
public Long disassemble(final Object _obj) throws HibernateException {
    try {
        return (Long) _obj;
    } catch (final Exception e) {
        throw new HibernateException("Could not disassemble XMLType length", e);
    }
}