HHH-6447 Formatting

This commit is contained in:
Hardy Ferentschik 2011-07-21 12:26:34 +02:00
parent 520db31a65
commit c069e6dada
6 changed files with 32 additions and 23 deletions

View File

@ -32,19 +32,19 @@ import org.hibernate.service.ServiceRegistry;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface BindingContext { public interface BindingContext {
public ServiceRegistry getServiceRegistry(); public ServiceRegistry getServiceRegistry();
public NamingStrategy getNamingStrategy(); public NamingStrategy getNamingStrategy();
public MappingDefaults getMappingDefaults(); public MappingDefaults getMappingDefaults();
public MetadataImplementor getMetadataImplementor(); public MetadataImplementor getMetadataImplementor();
public <T> Class<T> locateClassByName(String name); public <T> Class<T> locateClassByName(String name);
public Type makeJavaType(String className); public Type makeJavaType(String className);
public boolean isGloballyQuotedIdentifiers(); public boolean isGloballyQuotedIdentifiers();
public Value<Class<?>> makeClassReference(String className); public Value<Class<?>> makeClassReference(String className);

View File

@ -112,10 +112,15 @@ public class ConfiguredClass {
private final Map<String, SimpleAttribute> simpleAttributeMap; private final Map<String, SimpleAttribute> simpleAttributeMap;
/** /**
* The mapped simple attributes for this entity * The version attribute or {@code null} in case none exists.
*/ */
private SimpleAttribute versionAttribute; private SimpleAttribute versionAttribute;
/**
* The discriminator attribute or {@code null} in case none exists.
*/
private SimpleAttribute discriminatorAttribute;
/** /**
* The embedded classes for this entity * The embedded classes for this entity
*/ */
@ -187,6 +192,10 @@ public class ConfiguredClass {
return versionAttribute; return versionAttribute;
} }
public SimpleAttribute getDiscriminatorAttribute() {
return discriminatorAttribute;
}
public Iterable<AssociationAttribute> getAssociationAttributes() { public Iterable<AssociationAttribute> getAssociationAttributes() {
return associationAttributeMap.values(); return associationAttributeMap.values();
} }
@ -449,6 +458,9 @@ public class ConfiguredClass {
} else if (attribute.isVersioned()) { } else if (attribute.isVersioned()) {
// todo - error handling in case there are multiple version attributes // todo - error handling in case there are multiple version attributes
versionAttribute = attribute; versionAttribute = attribute;
} else if (attribute.isDiscriminator()) {
// todo - error handling in case there are multiple discriminator attributes
versionAttribute = attribute;
} }
else { else {
simpleAttributeMap.put( attributeName, attribute ); simpleAttributeMap.put( attributeName, attribute );

View File

@ -117,10 +117,6 @@ public class EntityClass extends ConfiguredClass {
return JandexHelper.getValue( jpaEntityAnnotation, "name", String.class ); return JandexHelper.getValue( jpaEntityAnnotation, "name", String.class );
} }
public InheritanceType getInheritanceType() {
return inheritanceType;
}
public IdType getIdType() { public IdType getIdType() {
return idType; return idType;
} }

View File

@ -75,7 +75,11 @@ public class RootEntitySourceImpl extends EntitySourceImpl implements RootEntity
@Override @Override
public SingularAttributeSource getDiscriminatorAttributeSource() { public SingularAttributeSource getDiscriminatorAttributeSource() {
return null; //To change body of implemented methods use File | Settings | File Templates. SingularAttributeSource attributeSource = null;
if ( getEntityClass().getDiscriminatorAttribute() != null ) {
attributeSource = new SingularAttributeSourceImpl( getEntityClass().getVersionAttribute() );
}
return attributeSource;
} }
@Override @Override

View File

@ -89,28 +89,28 @@ public interface EntitySource extends SubclassEntityContainer, AttributeSourceCo
* *
* @return The custom persister class name * @return The custom persister class name
*/ */
public String getCustomPersisterClassName(); public String getCustomPersisterClassName();
/** /**
* Is this entity lazy (proxyable)? * Is this entity lazy (proxyable)?
* *
* @return {@code true} indicates the entity is lazy; {@code false} non-lazy. * @return {@code true} indicates the entity is lazy; {@code false} non-lazy.
*/ */
public boolean isLazy(); public boolean isLazy();
/** /**
* For {@link #isLazy() lazy} entities, obtain the interface to use in constructing its proxies. * For {@link #isLazy() lazy} entities, obtain the interface to use in constructing its proxies.
* *
* @return The proxy interface name * @return The proxy interface name
*/ */
public String getProxy(); public String getProxy();
/** /**
* Obtain the batch-size to be applied when initializing proxies of this entity. * Obtain the batch-size to be applied when initializing proxies of this entity.
* *
* @return THe batch-size. * @return THe batch-size.
*/ */
public int getBatchSize(); public int getBatchSize();
/** /**
* Is the entity abstract? * Is the entity abstract?
@ -119,28 +119,28 @@ public interface EntitySource extends SubclassEntityContainer, AttributeSourceCo
* *
* @return {@code true} indicates the entity is abstract; {@code false} non-abstract. * @return {@code true} indicates the entity is abstract; {@code false} non-abstract.
*/ */
public boolean isAbstract(); public boolean isAbstract();
/** /**
* Did the source specify dynamic inserts? * Did the source specify dynamic inserts?
* *
* @return {@code true} indicates dynamic inserts will be used; {@code false} otherwise. * @return {@code true} indicates dynamic inserts will be used; {@code false} otherwise.
*/ */
public boolean isDynamicInsert(); public boolean isDynamicInsert();
/** /**
* Did the source specify dynamic updates? * Did the source specify dynamic updates?
* *
* @return {@code true} indicates dynamic updates will be used; {@code false} otherwise. * @return {@code true} indicates dynamic updates will be used; {@code false} otherwise.
*/ */
public boolean isDynamicUpdate(); public boolean isDynamicUpdate();
/** /**
* Did the source specify to perform selects to decide whether to perform (detached) updates? * Did the source specify to perform selects to decide whether to perform (detached) updates?
* *
* @return {@code true} indicates selects will be done; {@code false} otherwise. * @return {@code true} indicates selects will be done; {@code false} otherwise.
*/ */
public boolean isSelectBeforeUpdate(); public boolean isSelectBeforeUpdate();
/** /**
* Obtain the name of a named-query that will be used for loading this entity * Obtain the name of a named-query that will be used for loading this entity
@ -183,7 +183,4 @@ public interface EntitySource extends SubclassEntityContainer, AttributeSourceCo
* @return The meta-attribute sources. * @return The meta-attribute sources.
*/ */
public Iterable<MetaAttributeSource> metaAttributes(); public Iterable<MetaAttributeSource> metaAttributes();
// public List<XMLFetchProfileElement> getFetchProfile();
} }

View File

@ -50,7 +50,7 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
} }
@Test @Test
//@Resources(annotatedClasses = { RootOfSingleTableInheritance.class, SubclassOfSingleTableInheritance.class }) // @Resources(annotatedClasses = { RootOfSingleTableInheritance.class, SubclassOfSingleTableInheritance.class })
@FailureExpected(jiraKey = "HHH-6447", message = "Work in progress") @FailureExpected(jiraKey = "HHH-6447", message = "Work in progress")
public void testDiscriminatorValue() { public void testDiscriminatorValue() {
EntityBinding entityBinding = getEntityBinding( SubclassOfSingleTableInheritance.class ); EntityBinding entityBinding = getEntityBinding( SubclassOfSingleTableInheritance.class );