From e8bd7dfd66ca606adaf1baa6b8a5ef55d7abfbd6 Mon Sep 17 00:00:00 2001 From: Hardy Ferentschik Date: Wed, 4 May 2011 14:25:08 +0200 Subject: [PATCH] HHH-6171 Extracting state classes from EntityBinder and enabled creation of versioned attribute --- .../source/annotations/EntityBinder.java | 136 +++--------------- .../source/annotations/MappedAttribute.java | 8 ++ .../state/domain/AttributeDomainState.java | 109 ++++++++++++++ .../AttributeColumnRelationalState.java | 7 +- .../AttributeTupleRelationalState.java | 48 +++++++ .../source/hbm/RootEntityBinder.java | 29 ++-- .../binding/AbstractBasicBindingTests.java | 6 +- .../binding/BasicAnnotationBindingTests.java | 13 -- .../metamodel/binding/SimpleEntity.java | 3 - .../binding/SimpleVersionedEntity.java | 10 +- 10 files changed, 218 insertions(+), 151 deletions(-) create mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/domain/AttributeDomainState.java rename hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/{ => state/relational}/AttributeColumnRelationalState.java (94%) create mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeTupleRelationalState.java diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityBinder.java index cb344e63d5..bf1745b94c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityBinder.java @@ -23,9 +23,7 @@ */ package org.hibernate.metamodel.source.annotations; -import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationValue; @@ -33,16 +31,15 @@ import org.jboss.jandex.AnnotationValue; import org.hibernate.AssertionFailure; import org.hibernate.MappingException; import org.hibernate.internal.util.StringHelper; -import org.hibernate.mapping.PropertyGeneration; -import org.hibernate.metamodel.binding.AttributeBinding; import org.hibernate.metamodel.binding.EntityBinding; -import org.hibernate.metamodel.binding.HibernateTypeDescriptor; import org.hibernate.metamodel.binding.SimpleAttributeBinding; -import org.hibernate.metamodel.domain.Attribute; import org.hibernate.metamodel.domain.Entity; import org.hibernate.metamodel.domain.Hierarchical; import org.hibernate.metamodel.relational.Identifier; import org.hibernate.metamodel.relational.Schema; +import org.hibernate.metamodel.source.annotations.state.domain.AttributeDomainState; +import org.hibernate.metamodel.source.annotations.state.relational.AttributeColumnRelationalState; +import org.hibernate.metamodel.source.annotations.state.relational.AttributeTupleRelationalState; import org.hibernate.metamodel.source.annotations.util.JandexHelper; import org.hibernate.metamodel.source.internal.MetadataImpl; @@ -161,16 +158,12 @@ public class EntityBinder { MappedAttribute idAttribute = configuredClass.getMappedProperty( idName ); - AnnotationSimpleAttributeDomainState domainState = new AnnotationSimpleAttributeDomainState(); - HibernateTypeDescriptor typeDescriptor = new HibernateTypeDescriptor(); - typeDescriptor.setTypeName( idAttribute.getType().getName() ); - domainState.typeDescriptor = typeDescriptor; - domainState.attribute = entityBinding.getEntity().getOrCreateSingularAttribute( idAttribute.getName() ); + AttributeDomainState domainState = new AttributeDomainState( entityBinding, idAttribute ); idBinding.initialize( domainState ); AttributeColumnRelationalState columnRelationsState = new AttributeColumnRelationalState( idAttribute, meta ); - AnnotationSimpleAttributeRelationalState relationalState = new AnnotationSimpleAttributeRelationalState(); - relationalState.valueStates.add( columnRelationsState ); + AttributeTupleRelationalState relationalState = new AttributeTupleRelationalState(); + relationalState.addValueState( columnRelationsState ); idBinding.initializeSimpleTupleValue( relationalState ); } @@ -182,21 +175,24 @@ public class EntityBinder { String attributeName = mappedAttribute.getName(); entityBinding.getEntity().getOrCreateSingularAttribute( attributeName ); - SimpleAttributeBinding simpleBinding = entityBinding.makeSimpleAttributeBinding( attributeName ); + SimpleAttributeBinding attributeBinding; - AnnotationSimpleAttributeDomainState domainState = new AnnotationSimpleAttributeDomainState(); - HibernateTypeDescriptor typeDescriptor = new HibernateTypeDescriptor(); - typeDescriptor.setTypeName( mappedAttribute.getType().getName() ); - domainState.typeDescriptor = typeDescriptor; - domainState.attribute = entityBinding.getEntity().getOrCreateSingularAttribute( attributeName ); - simpleBinding.initialize( domainState ); + if ( mappedAttribute.isVersioned() ) { + attributeBinding = entityBinding.makeVersionBinding( attributeName ); + } + else { + attributeBinding = entityBinding.makeSimpleAttributeBinding( attributeName ); + } + + AttributeDomainState domainState = new AttributeDomainState( entityBinding, mappedAttribute ); + attributeBinding.initialize( domainState ); AttributeColumnRelationalState columnRelationsState = new AttributeColumnRelationalState( mappedAttribute, meta ); - AnnotationSimpleAttributeRelationalState relationalState = new AnnotationSimpleAttributeRelationalState(); - relationalState.valueStates.add( columnRelationsState ); - simpleBinding.initializeSimpleTupleValue( relationalState ); + AttributeTupleRelationalState relationalState = new AttributeTupleRelationalState(); + relationalState.addValueState( columnRelationsState ); + attributeBinding.initializeSimpleTupleValue( relationalState ); } } @@ -282,100 +278,6 @@ public class EntityBinder { // does not contain any identifier mappings NONE } - - public static class AnnotationSimpleAttributeDomainState implements SimpleAttributeBinding.DomainState { - PropertyGeneration propertyGeneration; - HibernateTypeDescriptor typeDescriptor; - Attribute attribute; - - @Override - public PropertyGeneration getPropertyGeneration() { - -// GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class ); -// String generatorType = generatedValue != null ? -// generatorType( generatedValue.strategy(), mappings ) : -// "assigned"; -// String generatorName = generatedValue != null ? -// generatedValue.generator() : -// BinderHelper.ANNOTATION_STRING_DEFAULT; - return propertyGeneration; - } - - @Override - public boolean isInsertable() { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public boolean isUpdateable() { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public boolean isKeyCasadeDeleteEnabled() { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public String getUnsavedValue() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public HibernateTypeDescriptor getHibernateTypeDescriptor() { - return typeDescriptor; - } - - @Override - public Attribute getAttribute() { - return attribute; - } - - @Override - public boolean isLazy() { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public String getPropertyAccessorName() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public boolean isAlternateUniqueKey() { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public String getCascade() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public boolean isOptimisticLockable() { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public String getNodeName() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public Map getMetaAttributes(EntityBinding entityBinding) { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - } - - public static class AnnotationSimpleAttributeRelationalState - implements SimpleAttributeBinding.SimpleTupleRelationalState { - List valueStates = new ArrayList(); - - @Override - public List getRelationalStates() { - return valueStates; - } - } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/MappedAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/MappedAttribute.java index 44c09244d6..66cc871429 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/MappedAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/MappedAttribute.java @@ -43,6 +43,7 @@ public class MappedAttribute implements Comparable { private final Map> annotations; private final ColumnValues columnValues; private final boolean isId; + private final boolean isVersioned; MappedAttribute(String name, Class type, Map> annotations) { this.name = name; @@ -52,6 +53,9 @@ public class MappedAttribute implements Comparable { List idAnnotations = annotations.get( JPADotNames.ID ); isId = idAnnotations != null && !idAnnotations.isEmpty(); + List versionAnnotations = annotations.get( JPADotNames.VERSION ); + isVersioned = versionAnnotations != null && !versionAnnotations.isEmpty(); + List columnAnnotations = annotations.get( JPADotNames.COLUMN ); if ( columnAnnotations != null && columnAnnotations.size() > 1 ) { throw new AssertionFailure( "There can only be one @Column annotation per mapped attribute" ); @@ -76,6 +80,10 @@ public class MappedAttribute implements Comparable { return isId; } + public boolean isVersioned() { + return isVersioned; + } + public final List annotations(DotName annotationDotName) { if ( annotations.containsKey( annotationDotName ) ) { return annotations.get( annotationDotName ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/domain/AttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/domain/AttributeDomainState.java new file mode 100644 index 0000000000..fbad69cdbe --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/domain/AttributeDomainState.java @@ -0,0 +1,109 @@ +package org.hibernate.metamodel.source.annotations.state.domain; + +import java.util.Map; + +import org.hibernate.mapping.PropertyGeneration; +import org.hibernate.metamodel.binding.EntityBinding; +import org.hibernate.metamodel.binding.HibernateTypeDescriptor; +import org.hibernate.metamodel.binding.SimpleAttributeBinding; +import org.hibernate.metamodel.domain.Attribute; +import org.hibernate.metamodel.domain.Entity; +import org.hibernate.metamodel.domain.MetaAttribute; +import org.hibernate.metamodel.source.annotations.MappedAttribute; + +/** + * @author Hardy Ferentschik + */ +public class AttributeDomainState implements SimpleAttributeBinding.DomainState { + private final PropertyGeneration propertyGeneration = null; + private final HibernateTypeDescriptor typeDescriptor; + private final Attribute attribute; + + public AttributeDomainState(EntityBinding entityBinding, MappedAttribute mappedAttribute) { + typeDescriptor = new HibernateTypeDescriptor(); + typeDescriptor.setTypeName( mappedAttribute.getType().getName() ); + + Entity entity = entityBinding.getEntity(); + attribute = entity.getOrCreateSingularAttribute( mappedAttribute.getName() ); + } + + @Override + public PropertyGeneration getPropertyGeneration() { + +// GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class ); +// String generatorType = generatedValue != null ? +// generatorType( generatedValue.strategy(), mappings ) : +// "assigned"; +// String generatorName = generatedValue != null ? +// generatedValue.generator() : +// BinderHelper.ANNOTATION_STRING_DEFAULT; + return propertyGeneration; + } + + @Override + public boolean isInsertable() { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public boolean isUpdateable() { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public boolean isKeyCasadeDeleteEnabled() { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public String getUnsavedValue() { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public HibernateTypeDescriptor getHibernateTypeDescriptor() { + return typeDescriptor; + } + + @Override + public Attribute getAttribute() { + return attribute; + } + + @Override + public boolean isLazy() { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public String getPropertyAccessorName() { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public boolean isAlternateUniqueKey() { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public String getCascade() { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public boolean isOptimisticLockable() { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public String getNodeName() { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public Map getMetaAttributes(EntityBinding entityBinding) { + return null; //To change body of implemented methods use File | Settings | File Templates. + } +} + + diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AttributeColumnRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeColumnRelationalState.java similarity index 94% rename from hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AttributeColumnRelationalState.java rename to hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeColumnRelationalState.java index 64a9d389ca..7366098459 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AttributeColumnRelationalState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeColumnRelationalState.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.metamodel.source.annotations; +package org.hibernate.metamodel.source.annotations.state.relational; import java.util.ArrayList; import java.util.Arrays; @@ -36,6 +36,9 @@ import org.hibernate.AssertionFailure; import org.hibernate.cfg.NamingStrategy; import org.hibernate.metamodel.binding.SimpleAttributeBinding; import org.hibernate.metamodel.relational.Size; +import org.hibernate.metamodel.source.annotations.ColumnValues; +import org.hibernate.metamodel.source.annotations.HibernateDotNames; +import org.hibernate.metamodel.source.annotations.MappedAttribute; import org.hibernate.metamodel.source.internal.MetadataImpl; /** @@ -58,7 +61,7 @@ public class AttributeColumnRelationalState implements SimpleAttributeBinding.Co private Set uniqueKeys = new HashSet(); private Set indexes = new HashSet(); - AttributeColumnRelationalState(MappedAttribute attribute, MetadataImpl meta) { + public AttributeColumnRelationalState(MappedAttribute attribute, MetadataImpl meta) { ColumnValues columnValues = attribute.getColumnValues(); namingStrategy = meta.getNamingStrategy(); columnName = columnValues.getName().isEmpty() ? attribute.getName() : columnValues.getName(); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeTupleRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeTupleRelationalState.java new file mode 100644 index 0000000000..fa18d739d2 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeTupleRelationalState.java @@ -0,0 +1,48 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2011, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.metamodel.source.annotations.state.relational; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.metamodel.binding.AttributeBinding; +import org.hibernate.metamodel.binding.SimpleAttributeBinding; + +/** + * @author Hardy Ferentschik + */ +public class AttributeTupleRelationalState implements SimpleAttributeBinding.SimpleTupleRelationalState { + List valueStates = new ArrayList(); + + public void addValueState(AttributeBinding.SingleValueRelationalState state) { + valueStates.add( state ); + } + + @Override + public List getRelationalStates() { + return valueStates; + } +} + + diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/RootEntityBinder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/RootEntityBinder.java index 19c9ffce29..a4b7f196f8 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/RootEntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/RootEntityBinder.java @@ -37,13 +37,12 @@ import org.hibernate.metamodel.source.hbm.xml.mapping.XMLCacheElement; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLCompositeId; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId; -import org.hibernate.metamodel.source.util.MappingHelper; /** -* TODO : javadoc -* -* @author Steve Ebersole -*/ + * TODO : javadoc + * + * @author Steve Ebersole + */ class RootEntityBinder extends AbstractEntityBinder { RootEntityBinder(HibernateMappingBinder hibernateMappingBinder, XMLClass xmlClazz) { @@ -67,7 +66,7 @@ class RootEntityBinder extends AbstractEntityBinder { } if ( xmlClazz.getPolymorphism() != null ) { - entityBinding.setExplicitPolymorphism( "explicit".equals( xmlClazz.getPolymorphism() ) ); + entityBinding.setExplicitPolymorphism( "explicit".equals( xmlClazz.getPolymorphism() ) ); } if ( xmlClazz.getRowid() != null ) { @@ -141,7 +140,7 @@ class RootEntityBinder extends AbstractEntityBinder { SimpleAttributeBinding idBinding = entityBinding.makeSimplePrimaryKeyAttributeBinding( attributeName ); bindSimpleAttribute( id, idBinding, entityBinding, attributeName ); - if ( ! Column.class.isInstance( idBinding.getValue() ) ) { + if ( !Column.class.isInstance( idBinding.getValue() ) ) { // this should never ever happen.. throw new MappingException( "Unanticipated situation" ); } @@ -237,9 +236,14 @@ class RootEntityBinder extends AbstractEntityBinder { SimpleAttributeBinding discriminatorBinding = entityBinding.makeEntityDiscriminatorBinding( RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME ); // Handle the relational portion of the binding... - bindSimpleAttribute( xmlEntityClazz.getDiscriminator(), discriminatorBinding, entityBinding, RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME ); + bindSimpleAttribute( + xmlEntityClazz.getDiscriminator(), + discriminatorBinding, + entityBinding, + RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME + ); - entityBinding.getEntityDiscriminator().setForced(xmlEntityClazz.getDiscriminator().isForce()); + entityBinding.getEntityDiscriminator().setForced( xmlEntityClazz.getDiscriminator().isForce() ); } private void bindVersion(XMLClass xmlEntityClazz, @@ -249,9 +253,12 @@ class RootEntityBinder extends AbstractEntityBinder { } boolean isVersion = xmlEntityClazz.getVersion() != null; - String explicitName = isVersion ? xmlEntityClazz.getVersion().getName() : xmlEntityClazz.getTimestamp().getName(); + String explicitName = isVersion ? xmlEntityClazz.getVersion().getName() : xmlEntityClazz.getTimestamp() + .getName(); if ( explicitName == null ) { - throw new MappingException( "Mising property name for version/timestamp mapping [" + entityBinding.getEntity().getName() + "]" ); + throw new MappingException( + "Missing property name for version/timestamp mapping [" + entityBinding.getEntity().getName() + "]" + ); } SimpleAttributeBinding versionBinding = entityBinding.makeVersionBinding( explicitName ); if ( isVersion ) { diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/binding/AbstractBasicBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/binding/AbstractBasicBindingTests.java index e7c715cc28..3b5aeb9619 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/binding/AbstractBasicBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/binding/AbstractBasicBindingTests.java @@ -67,10 +67,10 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase { @Test public void testSimpleEntityMapping() { - checkSimpleEntityMaping( buildSimpleEntityBinding() ); + checkSimpleEntityMapping( buildSimpleEntityBinding() ); } - protected void checkSimpleEntityMaping(EntityBinding entityBinding) { + protected void checkSimpleEntityMapping(EntityBinding entityBinding) { assertNotNull( entityBinding ); assertNotNull( entityBinding.getEntityIdentifier() ); assertNotNull( entityBinding.getEntityIdentifier().getValueBinding() ); @@ -116,7 +116,7 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase { MetadataImplementor metadata = buildMetadataWithManyToOne(); EntityBinding entityWithManyToOneBinding = metadata.getEntityBinding( EntityWithManyToOne.class.getName() ); EntityBinding simpleEntityBinding = metadata.getEntityBinding( SimpleEntity.class.getName() ); - checkSimpleEntityMaping( simpleEntityBinding ); + checkSimpleEntityMapping( simpleEntityBinding ); assertTrue( 1 == simpleEntityBinding.getAttributeBinding( "id" ).getEntityReferencingAttributeBindings().size() diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/binding/BasicAnnotationBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/binding/BasicAnnotationBindingTests.java index 3f4f912af8..5a0d913541 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/binding/BasicAnnotationBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/binding/BasicAnnotationBindingTests.java @@ -37,19 +37,6 @@ import org.hibernate.testing.FailureExpected; * @author Hardy Ferentschik */ public class BasicAnnotationBindingTests extends AbstractBasicBindingTests { - - //@FailureExpected(jiraKey = "HHH-5672", message = "Work in progress") - @Test - public void testSimpleEntityMapping() { - super.testSimpleEntityMapping(); - } - - @FailureExpected(jiraKey = "HHH-5672", message = "Work in progress") - @Test - public void testSimpleVersionedEntityMapping() { - super.testSimpleVersionedEntityMapping(); - } - @FailureExpected(jiraKey = "HHH-6172", message = "Work in progress") @Test public void testEntityWithManyToOneMapping() { diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/binding/SimpleEntity.java b/hibernate-core/src/test/java/org/hibernate/metamodel/binding/SimpleEntity.java index a7370788b2..227dc31cf4 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/binding/SimpleEntity.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/binding/SimpleEntity.java @@ -25,14 +25,11 @@ package org.hibernate.metamodel.binding; import javax.persistence.Entity; import javax.persistence.Id; -import javax.persistence.Table; - /** * @author Steve Ebersole */ @Entity -@Table(schema = "foo") public class SimpleEntity { @Id private Long id; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/binding/SimpleVersionedEntity.java b/hibernate-core/src/test/java/org/hibernate/metamodel/binding/SimpleVersionedEntity.java index 488a0b3a4c..2c7eacd515 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/binding/SimpleVersionedEntity.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/binding/SimpleVersionedEntity.java @@ -23,11 +23,15 @@ */ package org.hibernate.metamodel.binding; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Version; + /** - * TODO : javadoc - * * @author Steve Ebersole + * @author Hardy Ferentschik */ +@Entity public class SimpleVersionedEntity { private Long id; private String name; @@ -40,6 +44,7 @@ public class SimpleVersionedEntity { this.name = name; } + @Id public Long getId() { return id; } @@ -56,6 +61,7 @@ public class SimpleVersionedEntity { this.name = name; } + @Version public long getVersion() { return version; }