mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 04:34:49 +00:00
HHH-6202 Cleanup of existing classes. Replacing TODO with AssertionFailure
This commit is contained in:
parent
5d766b237b
commit
85b0725c28
@ -30,6 +30,7 @@
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.engine.internal.Versioning;
|
import org.hibernate.engine.internal.Versioning;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
@ -49,6 +50,7 @@
|
|||||||
* Provides the link between the domain and the relational model for an entity.
|
* Provides the link between the domain and the relational model for an entity.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class EntityBinding {
|
public class EntityBinding {
|
||||||
private final EntityIdentifier entityIdentifier = new EntityIdentifier( this );
|
private final EntityIdentifier entityIdentifier = new EntityIdentifier( this );
|
||||||
@ -247,9 +249,9 @@ public SimpleAttributeBinding makeSimplePrimaryKeyAttributeBinding(String name)
|
|||||||
|
|
||||||
public SimpleAttributeBinding makeEntityDiscriminatorBinding(String name) {
|
public SimpleAttributeBinding makeEntityDiscriminatorBinding(String name) {
|
||||||
if ( entityDiscriminator != null ) {
|
if ( entityDiscriminator != null ) {
|
||||||
// TODO: LOG this!!!
|
throw new AssertionFailure( "Creation of entity discriminator was called more than once" );
|
||||||
}
|
}
|
||||||
entityDiscriminator = new EntityDiscriminator( this );
|
entityDiscriminator = new EntityDiscriminator();
|
||||||
entityDiscriminator.setValueBinding( makeSimpleAttributeBinding( name, true, false ) );
|
entityDiscriminator.setValueBinding( makeSimpleAttributeBinding( name, true, false ) );
|
||||||
return entityDiscriminator.getValueBinding();
|
return entityDiscriminator.getValueBinding();
|
||||||
}
|
}
|
||||||
|
@ -24,18 +24,16 @@
|
|||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* Binding of the discriminator in a entity hierarchy
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class EntityDiscriminator {
|
public class EntityDiscriminator {
|
||||||
private final EntityBinding entityBinding;
|
|
||||||
private SimpleAttributeBinding valueBinding;
|
private SimpleAttributeBinding valueBinding;
|
||||||
private boolean forced;
|
private boolean forced;
|
||||||
private boolean inserted = true;
|
private boolean inserted = true;
|
||||||
|
|
||||||
public EntityDiscriminator(EntityBinding entityBinding) {
|
public EntityDiscriminator() {
|
||||||
this.entityBinding = entityBinding;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleAttributeBinding getValueBinding() {
|
public SimpleAttributeBinding getValueBinding() {
|
||||||
@ -61,4 +59,15 @@ public boolean isInserted() {
|
|||||||
public void setInserted(boolean inserted) {
|
public void setInserted(boolean inserted) {
|
||||||
this.inserted = inserted;
|
this.inserted = inserted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append( "EntityDiscriminator" );
|
||||||
|
sb.append( "{valueBinding=" ).append( valueBinding );
|
||||||
|
sb.append( ", forced=" ).append( forced );
|
||||||
|
sb.append( ", inserted=" ).append( inserted );
|
||||||
|
sb.append( '}' );
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user