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 ); } }  @Override int[] sqlTypes(); @Override Class<?> returnedClass(); @Override boolean equals( Object x, Object y ); @Override int hashCode( Object x ); @Override Object nullSafeGet( ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner ); @Override void nullSafeSet( PreparedStatement ps, Object value, int idx, SharedSessionContractImplementor session ); @Override Object deepCopy( Object value ); @Override boolean isMutable(); @Override Serializable disassemble( Object value ); @Override Object assemble( Serializable cached, Object owner ); @Override Object replace( Object original, Object target, Object owner ); @Override void setParameterValues( Properties parameters ); static final ObjectMapper MAPPER; }
@Test public void deepCopy() { final Translation result = (Translation) jsonBinaryType.deepCopy( translation1 ); Assert.assertNotSame( translation1, result ); Assert.assertEquals( translation1, result ); }
@Test public void deepCopyNull() { Assert.assertNull( jsonBinaryType.deepCopy( null ) ); }