merge master
This commit is contained in:
parent
a3184e16cb
commit
9a02c9e52d
|
@ -1385,6 +1385,7 @@ public class Binder {
|
||||||
|
|
||||||
return metadata.getTypeResolver().getTypeFactory().manyToOne(
|
return metadata.getTypeResolver().getTypeFactory().manyToOne(
|
||||||
referencedEntityBinding.getEntity().getName(),
|
referencedEntityBinding.getEntity().getName(),
|
||||||
|
uniqueKeyAttributeName == null,
|
||||||
uniqueKeyAttributeName,
|
uniqueKeyAttributeName,
|
||||||
attributeSource.getFetchTiming() != FetchTiming.IMMEDIATE,
|
attributeSource.getFetchTiming() != FetchTiming.IMMEDIATE,
|
||||||
attributeSource.isUnWrapProxy(),
|
attributeSource.isUnWrapProxy(),
|
||||||
|
@ -1492,6 +1493,7 @@ public class Binder {
|
||||||
return metadata.getTypeResolver().getTypeFactory().oneToOne(
|
return metadata.getTypeResolver().getTypeFactory().oneToOne(
|
||||||
referencedEntityBinding.getEntity().getName(),
|
referencedEntityBinding.getEntity().getName(),
|
||||||
attributeSource.getForeignKeyDirection(),
|
attributeSource.getForeignKeyDirection(),
|
||||||
|
uniqueKeyAttributeName == null,
|
||||||
uniqueKeyAttributeName,
|
uniqueKeyAttributeName,
|
||||||
attributeSource.getFetchTiming() != FetchTiming.IMMEDIATE,
|
attributeSource.getFetchTiming() != FetchTiming.IMMEDIATE,
|
||||||
attributeSource.isUnWrapProxy(),
|
attributeSource.isUnWrapProxy(),
|
||||||
|
@ -1504,6 +1506,7 @@ public class Binder {
|
||||||
return metadata.getTypeResolver().getTypeFactory().specialOneToOne(
|
return metadata.getTypeResolver().getTypeFactory().specialOneToOne(
|
||||||
referencedEntityBinding.getEntity().getName(),
|
referencedEntityBinding.getEntity().getName(),
|
||||||
attributeSource.getForeignKeyDirection(),
|
attributeSource.getForeignKeyDirection(),
|
||||||
|
uniqueKeyAttributeName == null,
|
||||||
uniqueKeyAttributeName,
|
uniqueKeyAttributeName,
|
||||||
attributeSource.getFetchTiming() != FetchTiming.IMMEDIATE,
|
attributeSource.getFetchTiming() != FetchTiming.IMMEDIATE,
|
||||||
attributeSource.isUnWrapProxy(),
|
attributeSource.isUnWrapProxy(),
|
||||||
|
@ -2048,6 +2051,7 @@ public class Binder {
|
||||||
|
|
||||||
Type resolvedElementType = metadata.getTypeResolver().getTypeFactory().manyToOne(
|
Type resolvedElementType = metadata.getTypeResolver().getTypeFactory().manyToOne(
|
||||||
referencedEntityBinding.getEntity().getName(),
|
referencedEntityBinding.getEntity().getName(),
|
||||||
|
true,
|
||||||
null,
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -107,12 +107,25 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
String uniqueKeyPropertyName,
|
String uniqueKeyPropertyName,
|
||||||
boolean eager,
|
boolean eager,
|
||||||
boolean unwrapProxy) {
|
boolean unwrapProxy) {
|
||||||
|
this(scope, entityName, referenceToPrimaryKey, uniqueKeyPropertyName, eager, unwrapProxy, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected EntityType(
|
||||||
|
TypeFactory.TypeScope scope,
|
||||||
|
String entityName,
|
||||||
|
boolean referenceToPrimaryKey,
|
||||||
|
String uniqueKeyPropertyName,
|
||||||
|
boolean eager,
|
||||||
|
boolean unwrapProxy,
|
||||||
|
Class returnedClass) {
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
this.associatedEntityName = entityName;
|
this.associatedEntityName = entityName;
|
||||||
this.uniqueKeyPropertyName = uniqueKeyPropertyName;
|
this.uniqueKeyPropertyName = uniqueKeyPropertyName;
|
||||||
this.eager = eager;
|
this.eager = eager;
|
||||||
this.unwrapProxy = unwrapProxy;
|
this.unwrapProxy = unwrapProxy;
|
||||||
this.referenceToPrimaryKey = referenceToPrimaryKey;
|
this.referenceToPrimaryKey = referenceToPrimaryKey;
|
||||||
|
this.returnedClass = returnedClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,10 +95,25 @@ public class ManyToOneType extends EntityType {
|
||||||
boolean unwrapProxy,
|
boolean unwrapProxy,
|
||||||
boolean ignoreNotFound,
|
boolean ignoreNotFound,
|
||||||
boolean isLogicalOneToOne) {
|
boolean isLogicalOneToOne) {
|
||||||
super( scope, referencedEntityName, referenceToPrimaryKey, uniqueKeyPropertyName, !lazy, unwrapProxy );
|
this( scope, referencedEntityName, referenceToPrimaryKey, uniqueKeyPropertyName, lazy, unwrapProxy, ignoreNotFound, isLogicalOneToOne, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ManyToOneType(
|
||||||
|
TypeFactory.TypeScope scope,
|
||||||
|
String referencedEntityName,
|
||||||
|
boolean referenceToPrimaryKey,
|
||||||
|
String uniqueKeyPropertyName,
|
||||||
|
boolean lazy,
|
||||||
|
boolean unwrapProxy,
|
||||||
|
boolean ignoreNotFound,
|
||||||
|
boolean isLogicalOneToOne,
|
||||||
|
Class returnedClass) {
|
||||||
|
super( scope, referencedEntityName, referenceToPrimaryKey, uniqueKeyPropertyName, !lazy, unwrapProxy, returnedClass );
|
||||||
this.ignoreNotFound = ignoreNotFound;
|
this.ignoreNotFound = ignoreNotFound;
|
||||||
this.isLogicalOneToOne = isLogicalOneToOne;
|
this.isLogicalOneToOne = isLogicalOneToOne;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isNullable() {
|
protected boolean isNullable() {
|
||||||
return ignoreNotFound;
|
return ignoreNotFound;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,23 @@ public class OneToOneType extends EntityType {
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OneToOneType(
|
||||||
|
TypeFactory.TypeScope scope,
|
||||||
|
String referencedEntityName,
|
||||||
|
ForeignKeyDirection foreignKeyType,
|
||||||
|
boolean referenceToPrimaryKey,
|
||||||
|
String uniqueKeyPropertyName,
|
||||||
|
boolean lazy,
|
||||||
|
boolean unwrapProxy,
|
||||||
|
String entityName,
|
||||||
|
String propertyName,
|
||||||
|
Class returnedClass) {
|
||||||
|
super( scope, referencedEntityName, referenceToPrimaryKey, uniqueKeyPropertyName, !lazy, unwrapProxy, returnedClass );
|
||||||
|
this.foreignKeyType = foreignKeyType;
|
||||||
|
this.propertyName = propertyName;
|
||||||
|
this.entityName = entityName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getPropertyName() {
|
public String getPropertyName() {
|
||||||
return propertyName;
|
return propertyName;
|
||||||
|
|
|
@ -86,6 +86,7 @@ public class SpecialOneToOneType extends OneToOneType {
|
||||||
TypeFactory.TypeScope scope,
|
TypeFactory.TypeScope scope,
|
||||||
String referencedEntityName,
|
String referencedEntityName,
|
||||||
ForeignKeyDirection foreignKeyType,
|
ForeignKeyDirection foreignKeyType,
|
||||||
|
boolean referenceToPrimaryKey,
|
||||||
String uniqueKeyPropertyName,
|
String uniqueKeyPropertyName,
|
||||||
boolean lazy,
|
boolean lazy,
|
||||||
boolean unwrapProxy,
|
boolean unwrapProxy,
|
||||||
|
@ -96,6 +97,7 @@ public class SpecialOneToOneType extends OneToOneType {
|
||||||
scope,
|
scope,
|
||||||
referencedEntityName,
|
referencedEntityName,
|
||||||
foreignKeyType,
|
foreignKeyType,
|
||||||
|
referenceToPrimaryKey,
|
||||||
uniqueKeyPropertyName,
|
uniqueKeyPropertyName,
|
||||||
lazy,
|
lazy,
|
||||||
unwrapProxy,
|
unwrapProxy,
|
||||||
|
@ -104,7 +106,8 @@ public class SpecialOneToOneType extends OneToOneType {
|
||||||
returnedClass
|
returnedClass
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getColumnSpan(Mapping mapping) throws MappingException {
|
public int getColumnSpan(Mapping mapping) throws MappingException {
|
||||||
return super.getIdentifierOrUniqueKeyType( mapping ).getColumnSpan( mapping );
|
return super.getIdentifierOrUniqueKeyType( mapping ).getColumnSpan( mapping );
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,6 +237,20 @@ public final class TypeFactory implements Serializable {
|
||||||
return new OneToOneType( typeScope, persistentClass, foreignKeyType, referenceToPrimaryKey,
|
return new OneToOneType( typeScope, persistentClass, foreignKeyType, referenceToPrimaryKey,
|
||||||
uniqueKeyPropertyName, lazy, unwrapProxy, entityName, propertyName );
|
uniqueKeyPropertyName, lazy, unwrapProxy, entityName, propertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType oneToOne(
|
||||||
|
String persistentClass,
|
||||||
|
ForeignKeyDirection foreignKeyType,
|
||||||
|
boolean referenceToPrimaryKey,
|
||||||
|
String uniqueKeyPropertyName,
|
||||||
|
boolean lazy,
|
||||||
|
boolean unwrapProxy,
|
||||||
|
String entityName,
|
||||||
|
String propertyName,
|
||||||
|
Class returnedClass) {
|
||||||
|
return new OneToOneType( typeScope, persistentClass, foreignKeyType, referenceToPrimaryKey,
|
||||||
|
uniqueKeyPropertyName, lazy, unwrapProxy, entityName, propertyName, returnedClass );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #specialOneToOne(String, ForeignKeyDirection, String, boolean, boolean, String, String, boolean)} instead.
|
* @deprecated Use {@link #specialOneToOne(String, ForeignKeyDirection, String, boolean, boolean, String, String, boolean)} instead.
|
||||||
|
@ -267,6 +281,20 @@ public final class TypeFactory implements Serializable {
|
||||||
uniqueKeyPropertyName, lazy, unwrapProxy, entityName, propertyName );
|
uniqueKeyPropertyName, lazy, unwrapProxy, entityName, propertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType specialOneToOne(
|
||||||
|
String persistentClass,
|
||||||
|
ForeignKeyDirection foreignKeyType,
|
||||||
|
boolean referenceToPrimaryKey,
|
||||||
|
String uniqueKeyPropertyName,
|
||||||
|
boolean lazy,
|
||||||
|
boolean unwrapProxy,
|
||||||
|
String entityName,
|
||||||
|
String propertyName,
|
||||||
|
Class returnedClass) {
|
||||||
|
return new SpecialOneToOneType( typeScope, persistentClass, foreignKeyType, referenceToPrimaryKey,
|
||||||
|
uniqueKeyPropertyName, lazy, unwrapProxy, entityName, propertyName, returnedClass );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// many-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// many-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -294,7 +322,6 @@ public final class TypeFactory implements Serializable {
|
||||||
isLogicalOneToOne );
|
isLogicalOneToOne );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public EntityType manyToOne(
|
public EntityType manyToOne(
|
||||||
String persistentClass,
|
String persistentClass,
|
||||||
boolean referenceToPrimaryKey,
|
boolean referenceToPrimaryKey,
|
||||||
|
@ -303,6 +330,18 @@ public final class TypeFactory implements Serializable {
|
||||||
boolean unwrapProxy,
|
boolean unwrapProxy,
|
||||||
boolean ignoreNotFound,
|
boolean ignoreNotFound,
|
||||||
boolean isLogicalOneToOne) {
|
boolean isLogicalOneToOne) {
|
||||||
|
return manyToOne( persistentClass, referenceToPrimaryKey, uniqueKeyPropertyName, lazy, unwrapProxy, ignoreNotFound, isLogicalOneToOne, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityType manyToOne(
|
||||||
|
String persistentClass,
|
||||||
|
boolean referenceToPrimaryKey,
|
||||||
|
String uniqueKeyPropertyName,
|
||||||
|
boolean lazy,
|
||||||
|
boolean unwrapProxy,
|
||||||
|
boolean ignoreNotFound,
|
||||||
|
boolean isLogicalOneToOne,
|
||||||
|
Class returnedClass) {
|
||||||
return new ManyToOneType(
|
return new ManyToOneType(
|
||||||
typeScope,
|
typeScope,
|
||||||
persistentClass,
|
persistentClass,
|
||||||
|
@ -311,7 +350,8 @@ public final class TypeFactory implements Serializable {
|
||||||
lazy,
|
lazy,
|
||||||
unwrapProxy,
|
unwrapProxy,
|
||||||
ignoreNotFound,
|
ignoreNotFound,
|
||||||
isLogicalOneToOne
|
isLogicalOneToOne,
|
||||||
|
returnedClass
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ import org.hibernate.loader.spi.NoOpLoadPlanAdvisor;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.test.component.cascading.toone.PersonalInfo;
|
import org.hibernate.test.component.cascading.toone.PersonalInfo;
|
||||||
import org.hibernate.testing.FailureExpected;
|
import org.hibernate.testing.FailureExpected;
|
||||||
|
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.hibernate.testing.junit4.ExtraAssertions;
|
import org.hibernate.testing.junit4.ExtraAssertions;
|
||||||
|
|
||||||
|
@ -131,6 +132,7 @@ public class EncapsulatedCompositeAttributeResultSetProcessorTest extends BaseCo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@FailureExpectedWithNewMetamodel
|
||||||
public void testNestedCompositeElementCollectionProcessing() throws Exception {
|
public void testNestedCompositeElementCollectionProcessing() throws Exception {
|
||||||
// create some test data
|
// create some test data
|
||||||
Session session = openSession();
|
Session session = openSession();
|
||||||
|
|
|
@ -55,6 +55,7 @@ import org.hibernate.loader.spi.LoadQueryAliasResolutionContext;
|
||||||
import org.hibernate.loader.spi.NamedParameterContext;
|
import org.hibernate.loader.spi.NamedParameterContext;
|
||||||
import org.hibernate.loader.spi.NoOpLoadPlanAdvisor;
|
import org.hibernate.loader.spi.NoOpLoadPlanAdvisor;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.hibernate.testing.junit4.ExtraAssertions;
|
import org.hibernate.testing.junit4.ExtraAssertions;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
|
@ -128,6 +129,7 @@ public class EncapsulatedCompositeIdResultSetProcessorTest extends BaseCoreFunct
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@FailureExpectedWithNewMetamodel
|
||||||
public void testCompositeIdWithKeyManyToOne() throws Exception {
|
public void testCompositeIdWithKeyManyToOne() throws Exception {
|
||||||
final String cardId = "ace-of-spades";
|
final String cardId = "ace-of-spades";
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ import org.hibernate.loader.spi.LoadQueryAliasResolutionContext;
|
||||||
import org.hibernate.loader.spi.NamedParameterContext;
|
import org.hibernate.loader.spi.NamedParameterContext;
|
||||||
import org.hibernate.loader.spi.NoOpLoadPlanAdvisor;
|
import org.hibernate.loader.spi.NoOpLoadPlanAdvisor;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.hibernate.testing.junit4.ExtraAssertions;
|
import org.hibernate.testing.junit4.ExtraAssertions;
|
||||||
|
|
||||||
|
@ -75,6 +76,7 @@ public class EntityWithNonLazyOneToManyListResultSetProcessorTest extends BaseCo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@FailureExpectedWithNewMetamodel
|
||||||
public void testEntityWithList() throws Exception {
|
public void testEntityWithList() throws Exception {
|
||||||
final EntityPersister entityPersister = sessionFactory().getEntityPersister( Poster.class.getName() );
|
final EntityPersister entityPersister = sessionFactory().getEntityPersister( Poster.class.getName() );
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ public class OuterJoinCriteriaTest extends BaseCoreFunctionalTestCase {
|
||||||
s.getTransaction().commit();
|
s.getTransaction().commit();
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
protected void prepareTest() {
|
protected void prepareTest() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.getTransaction().begin();
|
s.getTransaction().begin();
|
||||||
|
@ -409,7 +409,7 @@ public class OuterJoinCriteriaTest extends BaseCoreFunctionalTestCase {
|
||||||
s.getTransaction().commit();
|
s.getTransaction().commit();
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
protected void cleanupTest() {
|
protected void cleanupTest() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.getTransaction().begin();
|
s.getTransaction().begin();
|
||||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.jpa.test.graphs.named.basic;
|
||||||
import javax.persistence.EntityGraph;
|
import javax.persistence.EntityGraph;
|
||||||
|
|
||||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||||
|
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ public class BasicNamedEntityGraphTest extends BaseEntityManagerFunctionalTestCa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@FailureExpectedWithNewMetamodel
|
||||||
public void testIt() {
|
public void testIt() {
|
||||||
EntityGraph graph = getOrCreateEntityManager().getEntityGraph( "Person" );
|
EntityGraph graph = getOrCreateEntityManager().getEntityGraph( "Person" );
|
||||||
assertNotNull( graph );
|
assertNotNull( graph );
|
||||||
|
|
|
@ -81,7 +81,6 @@ import static org.junit.Assert.fail;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class PackagedEntityManagerTest extends PackagingTestCase {
|
public class PackagedEntityManagerTest extends PackagingTestCase {
|
||||||
@Test
|
@Test
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public void testDefaultPar() throws Exception {
|
public void testDefaultPar() throws Exception {
|
||||||
File testPackage = buildDefaultPar();
|
File testPackage = buildDefaultPar();
|
||||||
addPackageToClasspath( testPackage );
|
addPackageToClasspath( testPackage );
|
||||||
|
@ -117,7 +116,6 @@ public class PackagedEntityManagerTest extends PackagingTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public void testDefaultParForPersistence_1_0() throws Exception {
|
public void testDefaultParForPersistence_1_0() throws Exception {
|
||||||
File testPackage = buildDefaultPar_1_0();
|
File testPackage = buildDefaultPar_1_0();
|
||||||
addPackageToClasspath( testPackage );
|
addPackageToClasspath( testPackage );
|
||||||
|
@ -193,7 +191,6 @@ public class PackagedEntityManagerTest extends PackagingTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public void testExplodedPar() throws Exception {
|
public void testExplodedPar() throws Exception {
|
||||||
File testPackage = buildExplodedPar();
|
File testPackage = buildExplodedPar();
|
||||||
addPackageToClasspath( testPackage );
|
addPackageToClasspath( testPackage );
|
||||||
|
|
Loading…
Reference in New Issue