HHH-11364 - Checkstyle fixups.

This commit is contained in:
Chris Cranford 2017-01-06 10:22:02 -05:00
parent 883799082c
commit f01055985e
3 changed files with 18 additions and 28 deletions

View File

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

View File

@ -288,6 +288,7 @@ public class Parameters {
/** /**
* Add where clause with a null restriction: (left = right or (left is null and right is null)) * Add where clause with a null restriction: (left = right or (left is null and right is null))
*
* @param left Left property name. * @param left Left property name.
* @param addAliasLeft Whether to add the alias to the left property. * @param addAliasLeft Whether to add the alias to the left property.
* @param op The operator. * @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.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestNoProxyEntity; 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.collection.EmbeddableListEntity3;
import org.hibernate.envers.test.entities.components.relations.ManyToOneEagerComponent; import org.hibernate.envers.test.entities.components.relations.ManyToOneEagerComponent;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import javax.persistence.EntityManager;
import java.util.Arrays; import java.util.Arrays;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -25,47 +24,32 @@ import static org.junit.Assert.assertEquals;
*/ */
@TestForIssue(jiraKey = "HHH-11364") @TestForIssue(jiraKey = "HHH-11364")
public class EmbeddableList3 extends BaseEnversJPAFunctionalTestCase { public class EmbeddableList3 extends BaseEnversJPAFunctionalTestCase {
private Integer ele3_id = null; private Integer ele3_id;
private ManyToOneEagerComponent component = new ManyToOneEagerComponent(null, "data");
@Override @Override
protected Class<?>[] getAnnotatedClasses() { protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] {EmbeddableListEntity3.class, StrTestNoProxyEntity.class}; return new Class<?>[] { EmbeddableListEntity3.class, StrTestNoProxyEntity.class };
} }
@Test @Test
@Priority(10) @Priority(10)
public void initData() { public void initData() {
EntityManager em = getEntityManager(); ele3_id = TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
EmbeddableListEntity3 ele3 = new EmbeddableListEntity3();
EmbeddableListEntity3 ele3 = new EmbeddableListEntity3(); ele3.getComponentList().add( new ManyToOneEagerComponent( null, "data" ) );
entityManager.persist( ele3 );
// Revision 1 (persist the entity ) return ele3.getId();
em.getTransaction().begin(); } );
ele3.getComponentList().add(component);
em.persist( ele3 );
em.getTransaction().commit();
em.close();
ele3_id = ele3.getId();
} }
@Test @Test
public void testRevisionsCounts() { public void testRevisionsCounts() {
assertEquals( assertEquals( Arrays.asList( 1 ), getAuditReader().getRevisions( EmbeddableListEntity3.class, ele3_id) );
Arrays.asList(1), getAuditReader().getRevisions(
EmbeddableListEntity3.class,
ele3_id)
);
} }
@Test @Test
public void testCollectionOfEmbeddableWithNullJoinColumn() { public void testCollectionOfEmbeddableWithNullJoinColumn() {
final EmbeddableListEntity3 ele3 = getAuditReader().find( EmbeddableListEntity3.class, ele3_id, 1 ); 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() );
} }
} }