Move annotations.idmanytoone tests and fix property lookup of identifierMapper

This commit is contained in:
Christian Beikov 2021-08-04 15:22:01 +02:00
parent 7b58e700db
commit eaba3acc20
30 changed files with 37 additions and 33 deletions

View File

@ -526,13 +526,17 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
}
public Property getProperty(String propertyName) throws MappingException {
Iterator<Property> iter = getPropertyClosureIterator();
Property identifierProperty = getIdentifierProperty();
if ( identifierProperty != null
&& identifierProperty.getName().equals( StringHelper.root( propertyName ) ) ) {
return identifierProperty;
}
else {
Iterator<Property> iter = getPropertyClosureIterator();
Component identifierMapper = getIdentifierMapper();
if ( identifierMapper != null ) {
iter = new JoinedIterator<>( identifierMapper.getPropertyIterator(), iter );
}
return getProperty( propertyName, iter );
}
}

View File

@ -1202,8 +1202,9 @@ public class MappingModelCreationHelper {
// A value that came from the annotation model is already sorted appropriately
// so we use an "identity mapping"
else {
final int[] propertyReordering = new int[componentType.getSubtypes().length];
for ( int i = 0; i < propertyReordering.length; i++ ) {
final int columnSpan = componentType.getColumnSpan( creationProcess.getCreationContext().getBootModel() );
final int[] propertyReordering = new int[columnSpan];
for ( int i = 0; i < columnSpan; i++ ) {
propertyReordering[i] = i;
}
return propertyReordering;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;

View File

@ -6,7 +6,7 @@
*/
//$Id$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import java.util.Set;
import javax.persistence.CascadeType;

View File

@ -6,7 +6,7 @@
*/
//$Id$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.Entity;

View File

@ -6,7 +6,7 @@
*/
//$Id$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

View File

@ -4,7 +4,7 @@
* 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>.
*/
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import java.util.Set;

View File

@ -4,14 +4,13 @@
* 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>.
*/
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

View File

@ -6,7 +6,7 @@
*/
//$Id$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import java.util.Set;
import javax.persistence.Entity;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;

View File

@ -4,7 +4,7 @@
* 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>.
*/
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
@ -64,7 +64,7 @@ public class IdManyToOneTest extends BaseCoreFunctionalTestCase {
Join<Object, Object> students = root.join( "students", JoinType.INNER );
Join<Object, Object> student = students.join( "student", JoinType.INNER );
criteria.where( criteriaBuilder.equal( student.get( "name" ), "Foo" ) );
session.createQuery( criteria ).list();
s.createQuery( criteria ).list();
// Criteria criteria = s.createCriteria( Course.class );
// criteria.createCriteria( "students" ).createCriteria( "student" ).add( Restrictions.eq( "name", "Foo" ) );
// criteria.list();

View File

@ -6,7 +6,7 @@
*/
//$Id$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;

View File

@ -6,7 +6,7 @@
*/
//$Id$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import java.util.Set;
import javax.persistence.Entity;

View File

@ -6,7 +6,7 @@
*/
//$Id$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -6,7 +6,7 @@
*/
//$Id$
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import javax.persistence.Id;
import javax.persistence.JoinColumn;

View File

@ -4,7 +4,7 @@
* 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>.
*/
package org.hibernate.test.annotations.idmanytoone;
package org.hibernate.orm.test.annotations.idmanytoone;
import java.io.Serializable;
import java.util.Set;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Entity;

View File

@ -4,7 +4,7 @@
* 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>.
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import org.junit.Test;

View File

@ -4,7 +4,7 @@
* 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>.
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import org.junit.Test;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import java.math.BigInteger;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import java.math.BigInteger;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -6,7 +6,7 @@
*/
//$
package org.hibernate.test.annotations.idmanytoone.alphabetical;
package org.hibernate.orm.test.annotations.idmanytoone.alphabetical;
import java.math.BigInteger;
import javax.persistence.Entity;
import javax.persistence.Id;