HHH-7963 DynamicParameterizedType is not binded

This commit is contained in:
Strong Liu 2013-01-21 22:49:32 +08:00
parent 9225eb9f6b
commit 68ebf7e2bc
8 changed files with 23 additions and 10 deletions

View File

@ -536,6 +536,9 @@ class HibernateTypeHelper {
try {
return metadata.getTypeResolver().heuristicType( typeName, typeParameters );
}
catch ( NotYetImplementedException e ){
throw e;
}
catch ( Exception ignore ) {
}
}

View File

@ -24,8 +24,10 @@
package org.hibernate.metamodel.internal.source.hbm;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.jaxb.spi.JaxbRoot;
import org.hibernate.jaxb.spi.hbm.JaxbHibernateMapping;
import org.hibernate.metamodel.MetadataSources;
@ -44,18 +46,15 @@ import static java.util.Collections.emptyList;
* @author Steve Ebersole
*/
public class HbmMetadataSourceProcessorImpl implements MetadataSourceProcessor {
private final MetadataImplementor metadata;
private List<HibernateMappingProcessor> processors = new ArrayList<HibernateMappingProcessor>();
private List<EntityHierarchyImpl> entityHierarchies;
private final List<HibernateMappingProcessor> processors = new ArrayList<HibernateMappingProcessor>();
private final List<EntityHierarchyImpl> entityHierarchies;
public HbmMetadataSourceProcessorImpl(MetadataImplementor metadata, MetadataSources metadataSources) {
this( metadata, metadataSources.getJaxbRootList() );
}
public HbmMetadataSourceProcessorImpl(MetadataImplementor metadata, List<JaxbRoot> jaxbRoots) {
this.metadata = metadata;
final HierarchyBuilder hierarchyBuilder = new HierarchyBuilder( metadata );
for ( JaxbRoot jaxbRoot : jaxbRoots ) {
@ -76,6 +75,9 @@ public class HbmMetadataSourceProcessorImpl implements MetadataSourceProcessor {
@Override
public Iterable<TypeDescriptorSource> extractTypeDefinitionSources() {
if( CollectionHelper.isEmpty( processors )){
return emptyList();
}
final List<TypeDescriptorSource> typeDescriptorSources = new ArrayList<TypeDescriptorSource>();
for ( HibernateMappingProcessor processor : processors ) {
processor.collectTypeDescriptorSources( typeDescriptorSources );
@ -85,6 +87,9 @@ public class HbmMetadataSourceProcessorImpl implements MetadataSourceProcessor {
@Override
public Iterable<FilterDefinitionSource> extractFilterDefinitionSources() {
if( CollectionHelper.isEmpty( processors )){
return emptyList();
}
final List<FilterDefinitionSource> filterDefinitionSources = new ArrayList<FilterDefinitionSource>();
for ( HibernateMappingProcessor processor : processors ) {
processor.collectFilterDefSources( filterDefinitionSources );

View File

@ -27,10 +27,12 @@ import java.io.Serializable;
import java.util.Properties;
import org.hibernate.MappingException;
import org.hibernate.cfg.NotYetImplementedException;
import org.hibernate.classic.Lifecycle;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.usertype.CompositeUserType;
import org.hibernate.usertype.DynamicParameterizedType;
import org.hibernate.usertype.UserType;
/**
@ -131,6 +133,9 @@ public class TypeResolver implements Serializable {
try {
Class typeClass = ReflectHelper.classForName( typeName );
if ( typeClass != null ) {
if( DynamicParameterizedType.class.isAssignableFrom( typeClass )){
throw new NotYetImplementedException( "Custom dynamicParameterizedType is not supported yet" );
}
return typeFactory.byClass( typeClass, parameters );
}
}

View File

@ -28,7 +28,6 @@ import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.test.annotations.array.Contest.Month;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -37,7 +36,6 @@ import static org.junit.Assert.assertNotNull;
/**
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewMetamodel
public class ArrayTest extends BaseCoreFunctionalTestCase {
@Test
public void testOneToMany() throws Exception {

View File

@ -16,9 +16,9 @@ import static org.junit.Assert.assertEquals;
*
* @author Janario Oliveira
*/
@FailureExpectedWithNewMetamodel(jiraKey = "HHH-7936")
public class SerializableToBlobTypeTest extends BaseCoreFunctionalTestCase {
@Test
@FailureExpectedWithNewMetamodel
public void testTypeDefinition() {
EntityBinding binding = getEntityBinding( EntitySerialize.class );

View File

@ -35,10 +35,10 @@ import static org.junit.Assert.assertNull;
/**
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewMetamodel(jiraKey = "HHH-7916")
public class NotFoundTest extends BaseCoreFunctionalTestCase {
@Test
@FailureExpectedWithNewMetamodel
public void testManyToOne() throws Exception {
Currency euro = new Currency();
euro.setName( "Euro" );

View File

@ -43,6 +43,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gavin King
*/
@FailureExpectedWithNewMetamodel(jiraKey = "HHH-7916")
public class CollectionTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {
@ -50,7 +51,6 @@ public class CollectionTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
public void testExtraLazy() throws HibernateException, SQLException {
Session s = openSession();
Transaction t = s.beginTransaction();

View File

@ -30,6 +30,7 @@ import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertNotNull;
@ -39,6 +40,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gavin King
*/
@FailureExpectedWithNewMetamodel(jiraKey = "HHH-7916")
public class UnconstrainedTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {