HHH-5811 : Flush causes update query on field of type Byte[]
(cherry picked from commit 4007655045
)
This commit is contained in:
parent
bc37d5f6b2
commit
d0be11f503
|
@ -27,6 +27,7 @@ import java.io.ByteArrayInputStream;
|
|||
import java.io.InputStream;
|
||||
import java.sql.Blob;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.jdbc.BinaryStream;
|
||||
|
@ -45,6 +46,20 @@ public class ByteArrayTypeDescriptor extends AbstractTypeDescriptor<Byte[]> {
|
|||
public ByteArrayTypeDescriptor() {
|
||||
super( Byte[].class, ArrayMutabilityPlan.INSTANCE );
|
||||
}
|
||||
@Override
|
||||
public boolean areEqual(Byte[] one, Byte[] another) {
|
||||
return one == another
|
||||
|| ( one != null && another != null && Arrays.equals(one, another) );
|
||||
}
|
||||
@Override
|
||||
public int extractHashCode(Byte[] bytes) {
|
||||
int hashCode = 1;
|
||||
for ( byte aByte : bytes ) {
|
||||
hashCode = 31 * hashCode + aByte;
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Byte[] bytes) {
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.hibernate.Transaction;
|
|||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
@ -146,7 +147,7 @@ public class VersionedLobTest extends AbstractLobTest<VersionedBook, VersionedCo
|
|||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-5811")
|
||||
@TestForIssue( jiraKey = "HHH-5811")
|
||||
public void testVersionUnchangedByteArray() throws Exception {
|
||||
Session s;
|
||||
Transaction tx;
|
||||
|
|
Loading…
Reference in New Issue