HHH-18868 Cleanup tests and mapper-supers identifier mapper check
This commit is contained in:
parent
8129ca011a
commit
e38ae96acf
|
@ -357,7 +357,7 @@ public class MetadataContext {
|
||||||
// #buildIdClassAttributes
|
// #buildIdClassAttributes
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
|
else if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
|
||||||
// skip the version property, it was already handled previously.
|
// skip the version property, it was already handled previously.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -415,8 +415,10 @@ public class MetadataContext {
|
||||||
|
|
||||||
private static boolean isIdentifierProperty(Property property, MappedSuperclass mappedSuperclass) {
|
private static boolean isIdentifierProperty(Property property, MappedSuperclass mappedSuperclass) {
|
||||||
final Component identifierMapper = mappedSuperclass.getIdentifierMapper();
|
final Component identifierMapper = mappedSuperclass.getIdentifierMapper();
|
||||||
return identifierMapper != null ?
|
return identifierMapper != null && ArrayHelper.contains(
|
||||||
ArrayHelper.contains( identifierMapper.getPropertyNames(), property.getName() ) : false;
|
identifierMapper.getPropertyNames(),
|
||||||
|
property.getName()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> void addAttribute(EmbeddableDomainType<T> embeddable, Property property, Component component) {
|
private <T> void addAttribute(EmbeddableDomainType<T> embeddable, Property property, Component component) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* 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.Id;
|
||||||
import jakarta.persistence.IdClass;
|
import jakarta.persistence.IdClass;
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* 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 jakarta.persistence.metamodel.SingularAttribute;
|
||||||
import org.hibernate.testing.orm.junit.DomainModel;
|
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.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
@DomainModel(annotatedClasses = {Summary.class, BaseSummary.class})
|
@DomainModel(annotatedClasses = {Summary.class, BaseSummary.class})
|
||||||
@SessionFactory
|
@SessionFactory
|
||||||
@JiraKey("HHH-18858")
|
@JiraKey("HHH-18858")
|
||||||
public class MappedSuperclassIdClassAttributesTest {
|
public class MappedSuperclassIdClassAttributesTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test(SessionFactoryScope scope) {
|
public void test(SessionFactoryScope scope) {
|
||||||
scope.inSession( entityManager -> {
|
scope.inSession( entityManager -> {
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* 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.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.test.idclass;
|
package org.hibernate.orm.test.idclass.mappedsuperclass;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
|
Loading…
Reference in New Issue