Skip to content

Commit e38ae96

Browse files
committed
HHH-18868 Cleanup tests and mapper-supers identifier mapper check
1 parent 8129ca0 commit e38ae96

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
357357
// #buildIdClassAttributes
358358
continue;
359359
}
360-
if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
360+
else if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
361361
// skip the version property, it was already handled previously.
362362
continue;
363363
}
@@ -415,8 +415,10 @@ else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
415415

416416
private static boolean isIdentifierProperty(Property property, MappedSuperclass mappedSuperclass) {
417417
final Component identifierMapper = mappedSuperclass.getIdentifierMapper();
418-
return identifierMapper != null ?
419-
ArrayHelper.contains( identifierMapper.getPropertyNames(), property.getName() ) : false;
418+
return identifierMapper != null && ArrayHelper.contains(
419+
identifierMapper.getPropertyNames(),
420+
property.getName()
421+
);
420422
}
421423

422424
private <T> void addAttribute(EmbeddableDomainType<T> embeddable, Property property, Component component) {

hibernate-core/src/test/java/org/hibernate/orm/test/idclass/BaseSummary.java renamed to hibernate-core/src/test/java/org/hibernate/orm/test/idclass/mappedsuperclass/BaseSummary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-License-Identifier: LGPL-2.1-or-later
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
5-
package org.hibernate.orm.test.idclass;
5+
package org.hibernate.orm.test.idclass.mappedsuperclass;
66

77
import jakarta.persistence.Id;
88
import jakarta.persistence.IdClass;

hibernate-core/src/test/java/org/hibernate/orm/test/idclass/MappedSuperclassIdClassAttributesTest.java renamed to hibernate-core/src/test/java/org/hibernate/orm/test/idclass/mappedsuperclass/MappedSuperclassIdClassAttributesTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-License-Identifier: LGPL-2.1-or-later
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
5-
package org.hibernate.orm.test.idclass;
5+
package org.hibernate.orm.test.idclass.mappedsuperclass;
66

77
import jakarta.persistence.metamodel.SingularAttribute;
88
import org.hibernate.testing.orm.junit.DomainModel;
@@ -11,14 +11,12 @@
1111
import org.hibernate.testing.orm.junit.SessionFactoryScope;
1212
import org.junit.jupiter.api.Test;
1313

14-
1514
import static org.assertj.core.api.Assertions.assertThat;
1615

1716
@DomainModel(annotatedClasses = {Summary.class, BaseSummary.class})
1817
@SessionFactory
19-
@JiraKey( "HHH-18858" )
18+
@JiraKey("HHH-18858")
2019
public class MappedSuperclassIdClassAttributesTest {
21-
2220
@Test
2321
public void test(SessionFactoryScope scope) {
2422
scope.inSession( entityManager -> {

hibernate-core/src/test/java/org/hibernate/orm/test/idclass/PKey.java renamed to hibernate-core/src/test/java/org/hibernate/orm/test/idclass/mappedsuperclass/PKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-License-Identifier: LGPL-2.1-or-later
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
5-
package org.hibernate.orm.test.idclass;
5+
package org.hibernate.orm.test.idclass.mappedsuperclass;
66

77
import java.io.Serializable;
88
import java.util.Objects;

hibernate-core/src/test/java/org/hibernate/orm/test/idclass/Summary.java renamed to hibernate-core/src/test/java/org/hibernate/orm/test/idclass/mappedsuperclass/Summary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-License-Identifier: LGPL-2.1-or-later
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
5-
package org.hibernate.orm.test.idclass;
5+
package org.hibernate.orm.test.idclass.mappedsuperclass;
66

77
import jakarta.persistence.Entity;
88

0 commit comments

Comments
 (0)