Example usage for org.hibernate.type SerializationException SerializationException

List of usage examples for org.hibernate.type SerializationException SerializationException

Introduction

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

Prototype

public SerializationException(String message, Exception root) 

Source Link

Usage

From source file:ar.com.zauber.commons.repository.utils.URIUserType.java

License:Apache License

/**
 * @see UserType#nullSafeGet(ResultSet, String[], Object)
 * @throws HibernateException//from  ww  w.ja v  a2 s .  co m
 *             on error
 * @throws SQLException
 *             on error
 */
public final Object nullSafeGet(final ResultSet rs, final String[] names, final Object owner)
        throws HibernateException, SQLException {
    Validate.notNull(rs);
    Validate.notNull(names);
    Validate.isTrue(names.length > 0);
    final String uriString = rs.getString(names[0]);
    Object ret = null;
    if (uriString != null) {
        try {
            ret = new URI(uriString);
        } catch (final URISyntaxException ex) {
            throw new SerializationException("el texto `" + uriString + "' no es una URI valida", ex);
        }
    }
    return ret;
}

From source file:cn.com.rexen.core.jsonb.hibernate.user.types.MutableUserType.java

License:Apache License

/**
 * Disassembles the object in preparation for serialization.
 * See {@link org.hibernate.usertype.UserType#disassemble(Object)}.
 * <p>//from   w w w  .  j  a v  a 2 s  .  co m
 * Expects {@link #deepCopy(Object)} to return a {@code Serializable}.
 * <strong>Subtypes whose {@code deepCopy} implementation returns a
 * non-serializable object must override this method.</strong>
 */
@Override
public Serializable disassemble(Object value) throws HibernateException {
    // also safe for mutable objects
    Object deepCopy = deepCopy(value);

    if (!(deepCopy instanceof Serializable)) {
        throw new SerializationException(String.format("deepCopy of %s is not serializable", value), null);
    }

    return (Serializable) deepCopy;
}

From source file:com.alliander.osgp.shared.hibernate.CustomUserType.java

License:Open Source License

@Override
public Serializable disassemble(final Object value) {
    final Object deepCopy = this.deepCopy(value);

    if (!(deepCopy instanceof Serializable)) {
        throw new SerializationException(String.format("deepCopy of %s is not serializable", value), null);
    }/*from   w w w .  j a  v a  2s  .  co m*/

    return (Serializable) deepCopy;
}

From source file:com.qrmedia.commons.persistence.hibernate.usertype.MutableUserType.java

License:Open Source License

/**
 * Disassembles the object in preparation for serialization. 
 * See {@link org.hibernate.usertype.UserType#disassemble(java.lang.Object)}.
 * <p>//  w  ww . j av a  2 s  .c o  m
 * Expects {@link #deepCopy(Object)} to return a {@code Serializable}.
 * <strong>Subtypes whose {@code deepCopy} implementation returns a
 * non-serializable object must override this method.</strong>
 */
public Serializable disassemble(Object value) throws HibernateException {
    // also safe for mutable objects
    Object deepCopy = deepCopy(value);

    if (!(deepCopy instanceof Serializable)) {
        throw new SerializationException(String.format("deepCopy of %s is not serializable", value), null);
    }

    return (Serializable) deepCopy;
}

From source file:com.riversoforion.lena.hibernate.UrlUserType.java

License:Open Source License

@Override
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {

    String value = rs.getString(names[0]);
    try {// w  ww. j a  v a  2  s  .  c  om
        return stringToURL(value);
    } catch (MalformedURLException e) {
        throw new SerializationException("Not a valid URL", e);
    }
}

From source file:com.telemis.bowling.infra.hibernate.MutableUserType.java

License:Open Source License

/**
 * Disassembles the object in preparation for serialization.
 * See {@link org.hibernate.usertype.UserType#disassemble(Object)}.
 * <p/>// w  w w  .j  a  v a2s  .  c o m
 * Expects {@link #deepCopy(Object)} to return a {@code Serializable}.
 * <strong>Subtypes whose {@code deepCopy} implementation returns a
 * non-serializable object must override this method.</strong>
 */
public Serializable disassemble(final Object value) throws HibernateException {
    // also safe for mutable objects
    final Object deepCopy = deepCopy(value);

    if (!(deepCopy instanceof Serializable)) {
        throw new SerializationException(String.format("deepCopy of %s is not serializable", value), null);
    }

    return (Serializable) deepCopy;
}

From source file:eu.java.pg.jsonb.types.JSONBUserType.java

License:Apache License

@Override
public Serializable disassemble(Object value) throws HibernateException {
    Object deepCopy = deepCopy(value);

    if (!(deepCopy instanceof Serializable)) {
        throw new SerializationException(String.format("%s is not serializable class", value), null);
    }//from   w w w . ja  v a  2s .  c o  m

    return (Serializable) deepCopy;
}

From source file:it.eng.spagobi.engines.qbe.registry.serializer.RegistryConfigurationJSONSerializer.java

License:Mozilla Public License

public JSONObject serialize(RegistryConfiguration conf) {
    logger.debug("IN");
    JSONObject toReturn = null;//  ww w  .j  a  v a  2 s.c  om
    try {
        toReturn = new JSONObject();
        String entity = conf.getEntity();
        toReturn.put(ENTITY, entity);
        JSONArray filtersJSON = serializeFilters(conf);
        toReturn.put(FILTERS, filtersJSON);
        JSONArray columnsJSON = serializeColumns(conf);
        toReturn.put(COLUMNS, columnsJSON);
    } catch (Exception e) {
        throw new SerializationException("Error while serializating RegistryConfiguration", e);
    } finally {
        logger.debug("OUT");
    }
    return toReturn;
}

From source file:org.jadira.usertype.spi.shared.AbstractUserType.java

License:Apache License

public Serializable disassemble(Object value) throws HibernateException {

    final Serializable result;

    if (value == null) {
        result = null;//from  w  ww.  j a  v a  2 s.c o  m
    } else {
        final Object deepCopy = deepCopy(value);
        if (!(deepCopy instanceof Serializable)) {
            throw new SerializationException(String.format("deepCopy of %s is not serializable", value), null);
        }
        result = (Serializable) deepCopy;
    }

    return result;
}