class JsonBinaryType implements UserType, ParameterizedType {

    @Override
    public Object deepCopy( Object value ) throws HibernateException
    {
        if ( value == null )
        {
            return null;
        }

        final TokenBuffer tb = new TokenBuffer( resultingMapper, false );
        try
        {
            writeValue( tb, value );
            return readValue( tb.asParser() );
        }
        catch ( IOException e )
        {
            throw new HibernateException( "Could not deep copy JSONB object.", e );
        }
    }

}