HHH-11364 - Checkstyle fixups.

(cherry picked from commit f01055985e)
This commit is contained in:
Chris Cranford 2017-01-06 10:22:02 -05:00 committed by Gail Badner
parent a75a1c9bdf
commit b66965e801
3 changed files with 18 additions and 28 deletions

View File

@ -105,7 +105,12 @@ public class MiddleEmbeddableComponentMapper implements MiddleComponentMapper, C
);
}
else {
parameters.addWhereOrNullRestriction(prefix1 + '.' + propertyName, false, "=", prefix2 + '.' + propertyName, false);
parameters.addWhereOrNullRestriction(
prefix1 + '.' + propertyName,
false,
"=",
prefix2 + '.' + propertyName, false
);
}
}
}

View File

@ -252,6 +252,7 @@ public class Parameters {
/**
* Add where clause with a null restriction: (left = right or (left is null and right is null))
*
* @param left Left property name.
* @param addAliasLeft Whether to add the alias to the left property.
* @param op The operator.

View File

@ -9,13 +9,12 @@ package org.hibernate.envers.test.integration.collection.embeddable;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestNoProxyEntity;
import org.hibernate.envers.test.entities.collection.EmbeddableListEntity1;
import org.hibernate.envers.test.entities.collection.EmbeddableListEntity3;
import org.hibernate.envers.test.entities.components.relations.ManyToOneEagerComponent;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test;
import javax.persistence.EntityManager;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
@ -25,47 +24,32 @@ import static org.junit.Assert.assertEquals;
*/
@TestForIssue(jiraKey = "HHH-11364")
public class EmbeddableList3 extends BaseEnversJPAFunctionalTestCase {
private Integer ele3_id = null;
private ManyToOneEagerComponent component = new ManyToOneEagerComponent(null, "data");
private Integer ele3_id;
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] {EmbeddableListEntity3.class, StrTestNoProxyEntity.class};
return new Class<?>[] { EmbeddableListEntity3.class, StrTestNoProxyEntity.class };
}
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
EmbeddableListEntity3 ele3 = new EmbeddableListEntity3();
// Revision 1 (persist the entity )
em.getTransaction().begin();
ele3.getComponentList().add(component);
em.persist( ele3 );
em.getTransaction().commit();
em.close();
ele3_id = ele3.getId();
ele3_id = TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
EmbeddableListEntity3 ele3 = new EmbeddableListEntity3();
ele3.getComponentList().add( new ManyToOneEagerComponent( null, "data" ) );
entityManager.persist( ele3 );
return ele3.getId();
} );
}
@Test
public void testRevisionsCounts() {
assertEquals(
Arrays.asList(1), getAuditReader().getRevisions(
EmbeddableListEntity3.class,
ele3_id)
);
assertEquals( Arrays.asList( 1 ), getAuditReader().getRevisions( EmbeddableListEntity3.class, ele3_id) );
}
@Test
public void testCollectionOfEmbeddableWithNullJoinColumn() {
final EmbeddableListEntity3 ele3 = getAuditReader().find( EmbeddableListEntity3.class, ele3_id, 1 );
assertEquals("Expected there to be elements in the list", 1, ele3.getComponentList().size());
assertEquals( "Expected there to be elements in the list", 1, ele3.getComponentList().size() );
}
}