Fix SimpleNaturalIdLoader#resolveIdToNaturalId()

This commit is contained in:
Andrea Boriero 2021-12-01 10:04:14 +01:00 committed by Andrea Boriero
parent df0479951c
commit 46857f456a
7 changed files with 6 additions and 17 deletions

View File

@ -91,13 +91,4 @@ public class SimpleNaturalIdLoader<T> extends AbstractNaturalIdLoader<T> {
); );
} }
} }
@Override
public Object resolveIdToNaturalId(Object id, SharedSessionContractImplementor session) {
final Object rawValue = super.resolveIdToNaturalId( id, session );
assert rawValue instanceof Object[];
return ( (Object[]) rawValue )[0];
}
} }

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.test.jpa.naturalid; package org.hibernate.orm.test.jpa.naturalid;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.test.jpa.naturalid; package org.hibernate.orm.test.jpa.naturalid;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.Id; import jakarta.persistence.Id;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.test.jpa.naturalid; package org.hibernate.orm.test.jpa.naturalid;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.fail;
public class ImmutableNaturalIdTest extends AbstractJPATest { public class ImmutableNaturalIdTest extends AbstractJPATest {
@Override @Override
protected String[] getOrmXmlFiles() { protected String[] getOrmXmlFiles() {
return new String[] { "org/hibernate/test/jpa/naturalid/User.hbm.xml" }; return new String[] { "org/hibernate/orm/test/jpa/naturalid/User.hbm.xml" };
} }
@Override @Override

View File

@ -13,8 +13,6 @@ import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.SkipForDialect; import org.hibernate.testing.orm.junit.SkipForDialect;
import org.hibernate.orm.test.jpa.model.AbstractJPATest; import org.hibernate.orm.test.jpa.model.AbstractJPATest;
import org.hibernate.test.jpa.naturalid.ClassWithIdentityColumn;
import org.hibernate.test.jpa.naturalid.Group;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;

View File

@ -14,7 +14,7 @@
This mapping illustrates use of <natural-id mutable="false"/> This mapping illustrates use of <natural-id mutable="false"/>
--> -->
<hibernate-mapping package="org.hibernate.test.jpa.naturalid"> <hibernate-mapping package="org.hibernate.orm.test.jpa.naturalid">
<class name="User" table="IMM_NAT_ID_USER" lazy="true"> <class name="User" table="IMM_NAT_ID_USER" lazy="true">
<comment>Users may bid for or sell auction items.</comment> <comment>Users may bid for or sell auction items.</comment>

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.test.jpa.naturalid; package org.hibernate.orm.test.jpa.naturalid;
/** /**