HHH-18868 Cleanup tests and mapper-supers identifier mapper check

This commit is contained in:
Marco Belladelli 2024-12-11 09:24:10 +01:00
parent 8129ca011a
commit e38ae96acf
5 changed files with 10 additions and 10 deletions

View File

@ -357,7 +357,7 @@ public class MetadataContext {
// #buildIdClassAttributes
continue;
}
if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
else if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
// skip the version property, it was already handled previously.
continue;
}
@ -415,8 +415,10 @@ public class MetadataContext {
private static boolean isIdentifierProperty(Property property, MappedSuperclass mappedSuperclass) {
final Component identifierMapper = mappedSuperclass.getIdentifierMapper();
return identifierMapper != null ?
ArrayHelper.contains( identifierMapper.getPropertyNames(), property.getName() ) : false;
return identifierMapper != null && ArrayHelper.contains(
identifierMapper.getPropertyNames(),
property.getName()
);
}
private <T> void addAttribute(EmbeddableDomainType<T> embeddable, Property property, Component component) {

View File

@ -2,7 +2,7 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.idclass;
package org.hibernate.orm.test.idclass.mappedsuperclass;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;

View File

@ -2,7 +2,7 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.idclass;
package org.hibernate.orm.test.idclass.mappedsuperclass;
import jakarta.persistence.metamodel.SingularAttribute;
import org.hibernate.testing.orm.junit.DomainModel;
@ -11,14 +11,12 @@ import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@DomainModel(annotatedClasses = {Summary.class, BaseSummary.class})
@SessionFactory
@JiraKey( "HHH-18858" )
@JiraKey("HHH-18858")
public class MappedSuperclassIdClassAttributesTest {
@Test
public void test(SessionFactoryScope scope) {
scope.inSession( entityManager -> {

View File

@ -2,7 +2,7 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.idclass;
package org.hibernate.orm.test.idclass.mappedsuperclass;
import java.io.Serializable;
import java.util.Objects;

View File

@ -2,7 +2,7 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.idclass;
package org.hibernate.orm.test.idclass.mappedsuperclass;
import jakarta.persistence.Entity;