modules/h2/src/main/java/org/gridgain/internal/h2/util/JdbcUtils.java
/**
     * Serialize the object to a byte array, using the serializer specified by
     * the connection info if set, or the default serializer.
     *
     * @param obj the object to serialize
     * @param dataHandler provides the object serializer (may be null)
     * @return the byte array
     */
Serialize the object to a byte array, using the serializer specified by
the connection info if set, or the default serializer.

@param obj the object to serialize
@param dataHandler provides the object serializer (may be null)
@return the byte array
Serialize the object to a byte array using the serializer specified by the connection info if set or the default serializer . @param obj the object to serialize @param dataHandler provides the object serializer ( may be null ) @return the byte array
public static byte[] serialize(Object obj, DataHandler dataHandler) {
        try {
            JavaObjectSerializer handlerSerializer = null;
            if (dataHandler != null) {
                handlerSerializer = dataHandler.getJavaObjectSerializer();
            }
            if (handlerSerializer != null) {
                return handlerSerializer.serialize(obj);
            }
            if (serializer != null) {
                return serializer.serialize(obj);
            }
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            ObjectOutputStream os = new ObjectOutputStream(out);
            os.writeObject(obj);
            return out.toByteArray();
        } catch (Throwable e) {
            throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString());
        }
    }
public static byte [ ] serialize ( Object obj , DataHandler dataHandler ) { try { JavaObjectSerializer handlerSerializer = null ; if ( dataHandler != null ) { handlerSerializer = dataHandler . getJavaObjectSerializer ( ) ; } if ( handlerSerializer != null ) { return handlerSerializer . serialize ( obj ) ; } if ( serializer != null ) { return serializer . serialize ( obj ) ; } ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; ObjectOutputStream os = new ObjectOutputStream ( out ) ; os . writeObject ( obj ) ; return out . toByteArray ( ) ; } catch ( Throwable e ) { throw DbException . get ( ErrorCode . SERIALIZATION_FAILED_1 , e , e . toString ( ) ) ; } }
Serialize the object to a byte array, using the serializer specified by
 the connection info if set, or the default serializer.
Serialize the object to a byte array using the serializer specified by the connection info if set or the default serializer .