HHH-6263 Minor coding changes and removing unclear comment

This commit is contained in:
Hardy Ferentschik 2011-05-30 11:17:40 +02:00
parent 151d9ce316
commit debd342e48
2 changed files with 9 additions and 6 deletions

View File

@ -42,6 +42,7 @@ import org.hibernate.metamodel.binding.EntityBinding;
import org.hibernate.metamodel.binding.EntityDiscriminator; import org.hibernate.metamodel.binding.EntityDiscriminator;
import org.hibernate.metamodel.binding.ManyToOneAttributeBinding; import org.hibernate.metamodel.binding.ManyToOneAttributeBinding;
import org.hibernate.metamodel.binding.SimpleAttributeBinding; import org.hibernate.metamodel.binding.SimpleAttributeBinding;
import org.hibernate.metamodel.binding.state.DiscriminatorBindingState;
import org.hibernate.metamodel.binding.state.ManyToOneAttributeBindingState; import org.hibernate.metamodel.binding.state.ManyToOneAttributeBindingState;
import org.hibernate.metamodel.binding.state.SimpleAttributeBindingState; import org.hibernate.metamodel.binding.state.SimpleAttributeBindingState;
import org.hibernate.metamodel.domain.Entity; import org.hibernate.metamodel.domain.Entity;
@ -391,16 +392,19 @@ public class EntityBinder {
if ( simpleAttribute.isDiscriminator() ) { if ( simpleAttribute.isDiscriminator() ) {
EntityDiscriminator entityDiscriminator = entityBinding.makeEntityDiscriminator( attributeName ); EntityDiscriminator entityDiscriminator = entityBinding.makeEntityDiscriminator( attributeName );
entityDiscriminator.initialize( new DiscriminatorBindingStateImpl( simpleAttribute ) ); DiscriminatorBindingState bindingState = new DiscriminatorBindingStateImpl( simpleAttribute );
entityDiscriminator.initialize( bindingState );
attributeBinding = entityDiscriminator.getValueBinding(); attributeBinding = entityDiscriminator.getValueBinding();
} }
else if ( simpleAttribute.isVersioned() ) { else if ( simpleAttribute.isVersioned() ) {
attributeBinding = entityBinding.makeVersionBinding( attributeName ); attributeBinding = entityBinding.makeVersionBinding( attributeName );
attributeBinding.initialize( new AttributeBindingStateImpl( simpleAttribute ) ); SimpleAttributeBindingState bindingState = new AttributeBindingStateImpl( simpleAttribute );
attributeBinding.initialize( bindingState );
} }
else { else {
attributeBinding = entityBinding.makeSimpleAttributeBinding( attributeName ); attributeBinding = entityBinding.makeSimpleAttributeBinding( attributeName );
attributeBinding.initialize( new AttributeBindingStateImpl( simpleAttribute ) ); SimpleAttributeBindingState bindingState = new AttributeBindingStateImpl( simpleAttribute );
attributeBinding.initialize( bindingState );
} }
if ( configuredClass.hasOwnTable() ) { if ( configuredClass.hasOwnTable() ) {

View File

@ -23,16 +23,15 @@
*/ */
package org.hibernate.metamodel.source.annotations.entity.state.binding; package org.hibernate.metamodel.source.annotations.entity.state.binding;
import org.hibernate.metamodel.binding.state.DiscriminatorBindingState;
import org.hibernate.metamodel.source.annotations.entity.DiscriminatorColumnValues; import org.hibernate.metamodel.source.annotations.entity.DiscriminatorColumnValues;
import org.hibernate.metamodel.source.annotations.entity.SimpleAttribute; import org.hibernate.metamodel.source.annotations.entity.SimpleAttribute;
/** /**
* @author Gail Badner * @author Gail Badner
*
* TODO: extract a superclass that sets defaults for other stuff
*/ */
public class DiscriminatorBindingStateImpl public class DiscriminatorBindingStateImpl
extends AttributeBindingStateImpl implements org.hibernate.metamodel.binding.state.DiscriminatorBindingState { extends AttributeBindingStateImpl implements DiscriminatorBindingState {
private final String discriminatorValue; private final String discriminatorValue;
private final boolean isForced; private final boolean isForced;
private final boolean isInserted; private final boolean isInserted;