HHH-16031 @ManyToMany with @JoinTable(inverseColumn = ...) and SortedSet may results in data loss

This commit is contained in:
Andrea Boriero 2023-01-16 14:03:58 +01:00 committed by Christian Beikov
parent 241fe54d0a
commit f4aec1cd0a
2 changed files with 3 additions and 5 deletions

View File

@ -404,13 +404,14 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
PropertyData inferredData) { PropertyData inferredData) {
final AnnotatedJoinColumn column = new AnnotatedJoinColumn(); final AnnotatedJoinColumn column = new AnnotatedJoinColumn();
column.setImplicit( true ); column.setImplicit( true );
column.setNullable( false ); //I break the spec, but it's for good
// column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
// column.setPropertyName( getRelativePath( propertyHolder, propertyName ) ); // column.setPropertyName( getRelativePath( propertyHolder, propertyName ) );
// column.setJoins( secondaryTables ); // column.setJoins( secondaryTables );
// column.setContext( context ); // column.setContext( context );
column.setParent( parent ); column.setParent( parent );
column.bind(); column.bind();
column.setNullable( false ); //I break the spec, but it's for good
return column; return column;
} }
@ -425,11 +426,11 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
// column.setPropertyName( getRelativePath( propertyHolder, propertyName ) ); // column.setPropertyName( getRelativePath( propertyHolder, propertyName ) );
// column.setJoins( secondaryTables ); // column.setJoins( secondaryTables );
// column.setContext( context ); // column.setContext( context );
column.setNullable( false ); //I break the spec, but it's for good
//done after the annotation to override it //done after the annotation to override it
column.setParent( parent ); column.setParent( parent );
column.applyJoinAnnotation( joinColumn, inferredData.getPropertyName() ); column.applyJoinAnnotation( joinColumn, inferredData.getPropertyName() );
column.bind(); column.bind();
column.setNullable( false ); //I break the spec, but it's for good
return column; return column;
} }

View File

@ -14,7 +14,6 @@ import org.hibernate.orm.test.envers.Priority;
import org.hibernate.orm.test.envers.entities.StrTestEntity; import org.hibernate.orm.test.envers.entities.StrTestEntity;
import org.hibernate.orm.test.envers.entities.manytomany.unidirectional.JoinTableEntity; import org.hibernate.orm.test.envers.entities.manytomany.unidirectional.JoinTableEntity;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -100,7 +99,6 @@ public class JoinTableDetachedTest extends BaseEnversJPAFunctionalTestCase {
} }
@Test @Test
@FailureExpected( jiraKey = "HHH-15393", message = "Work for HHH-15393 (write-paths) causes a failure" )
public void testRevisionsCounts() { public void testRevisionsCounts() {
Assert.assertEquals( Assert.assertEquals(
Arrays.asList( 1, 2, 3, 4, 5 ), getAuditReader().getRevisions( Arrays.asList( 1, 2, 3, 4, 5 ), getAuditReader().getRevisions(
@ -113,7 +111,6 @@ public class JoinTableDetachedTest extends BaseEnversJPAFunctionalTestCase {
} }
@Test @Test
@FailureExpected( jiraKey = "HHH-15393", message = "Work for HHH-15393 (write-paths) causes a failure" )
public void testHistoryOfCollectionEntity() { public void testHistoryOfCollectionEntity() {
// Revision 1 // Revision 1
JoinTableEntity collectionEntity = new JoinTableEntity( collectionEntityId, "some data" ); JoinTableEntity collectionEntity = new JoinTableEntity( collectionEntityId, "some data" );