diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java index 267afe5d05..337e299fac 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java @@ -2476,46 +2476,23 @@ public class ModelBinder { // generated properties can *never* be insertable... if ( property.isInsertable() ) { - if ( singularAttributeSource.isInsertable() == null ) { - // insertable simply because that is the user did not specify - // anything; just override it - property.setInsertable( false ); - } - else { - // the user specifically supplied insert="true", - // which constitutes an illegal combo - throw new MappingException( - String.format( - Locale.ENGLISH, - "Cannot specify both insert=\"true\" and generated=\"%s\" for property %s", - generationTiming.name().toLowerCase(Locale.ROOT), - propertySource.getName() - ), - mappingDocument.getOrigin() - ); - } + log.debugf( + "Property [%s] specified %s generation, setting insertable to false : %s", + propertySource.getName(), + generationTiming.name(), + mappingDocument.getOrigin() + ); + property.setInsertable( false ); } // properties generated on update can never be updatable... if ( property.isUpdateable() && generationTiming == GenerationTiming.ALWAYS ) { - if ( singularAttributeSource.isUpdatable() == null ) { - // updatable only because the user did not specify - // anything; just override it - property.setUpdateable( false ); - } - else { - // the user specifically supplied update="true", - // which constitutes an illegal combo - throw new MappingException( - String.format( - Locale.ENGLISH, - "Cannot specify both update=\"true\" and generated=\"%s\" for property %s", - generationTiming.name().toLowerCase(Locale.ROOT), - propertySource.getName() - ), - mappingDocument.getOrigin() - ); - } + log.debugf( + "Property [%s] specified ALWAYS generation, setting updateable to false : %s", + propertySource.getName(), + mappingDocument.getOrigin() + ); + property.setUpdateable( false ); } } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/hbm/IndexTest.java b/hibernate-core/src/test/java/org/hibernate/test/hbm/index/IndexTest.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/test/hbm/IndexTest.java rename to hibernate-core/src/test/java/org/hibernate/test/hbm/index/IndexTest.java index f80df0568f..5d4166929e 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hbm/IndexTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hbm/index/IndexTest.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.hbm; +package org.hibernate.test.hbm.index; import java.util.Collections; @@ -18,7 +18,6 @@ import org.hibernate.tool.schema.spi.SchemaManagementTool; import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseUnitTestCase; -import org.hibernate.test.hbm.JournalingSchemaToolingTarget; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/test/hbm/JournalingSchemaToolingTarget.java b/hibernate-core/src/test/java/org/hibernate/test/hbm/index/JournalingSchemaToolingTarget.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/test/hbm/JournalingSchemaToolingTarget.java rename to hibernate-core/src/test/java/org/hibernate/test/hbm/index/JournalingSchemaToolingTarget.java index 885b51e4e5..3ba0c77119 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hbm/JournalingSchemaToolingTarget.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hbm/index/JournalingSchemaToolingTarget.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.hbm; +package org.hibernate.test.hbm.index; import java.util.ArrayList; import java.util.List; diff --git a/hibernate-core/src/test/java/org/hibernate/test/hbm/Person.java b/hibernate-core/src/test/java/org/hibernate/test/hbm/index/Person.java similarity index 94% rename from hibernate-core/src/test/java/org/hibernate/test/hbm/Person.java rename to hibernate-core/src/test/java/org/hibernate/test/hbm/index/Person.java index 0443e84a26..48fc500fd1 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hbm/Person.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hbm/index/Person.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.hbm; +package org.hibernate.test.hbm.index; public class Person { private long id; diff --git a/hibernate-core/src/test/java/org/hibernate/test/hbm/PersonGroup.java b/hibernate-core/src/test/java/org/hibernate/test/hbm/index/PersonGroup.java similarity index 88% rename from hibernate-core/src/test/java/org/hibernate/test/hbm/PersonGroup.java rename to hibernate-core/src/test/java/org/hibernate/test/hbm/index/PersonGroup.java index 07fd5fa4e6..0b2d366330 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hbm/PersonGroup.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hbm/index/PersonGroup.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.hbm; +package org.hibernate.test.hbm.index; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/test/hbm/version/GeneratedVersionBindingTest.java b/hibernate-core/src/test/java/org/hibernate/test/hbm/version/GeneratedVersionBindingTest.java new file mode 100644 index 0000000000..eb0e1eb933 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/hbm/version/GeneratedVersionBindingTest.java @@ -0,0 +1,25 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.test.hbm.version; + +import org.hibernate.boot.Metadata; +import org.hibernate.boot.MetadataSources; + +import org.hibernate.testing.junit4.BaseUnitTestCase; +import org.junit.Test; + +/** + * @author Steve Ebersole + */ +public class GeneratedVersionBindingTest extends BaseUnitTestCase { + @Test + public void testIt() { + final Metadata metadata = new MetadataSources() + .addResource("org/hibernate/test/hbm/version/Mappings.hbm.xml") + .buildMetadata(); + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/hbm/version/Order.java b/hibernate-core/src/test/java/org/hibernate/test/hbm/version/Order.java new file mode 100644 index 0000000000..983543f263 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/hbm/version/Order.java @@ -0,0 +1,40 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.test.hbm.version; + +/** + * @author Steve Ebersole + */ +public class Order { + private Integer id; + private String referenceCode; + private byte[] rv; + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getReferenceCode() { + return this.referenceCode; + } + + public void setReferenceCode(String referenceCode) { + this.referenceCode = referenceCode; + } + + public byte[] getRv() { + return this.rv; + } + + public void setRv(byte[] rv) { + this.rv = rv; + } +} diff --git a/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_manytoone.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_manytoone.hbm.xml index d92c379072..1eb5b36b3d 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_manytoone.hbm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_manytoone.hbm.xml @@ -9,7 +9,7 @@ "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> - + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_property.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_property.hbm.xml index e52e0b8f41..5a1143dfd4 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_property.hbm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_property.hbm.xml @@ -9,7 +9,7 @@ "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> - + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_propertycolumn.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_propertycolumn.hbm.xml index 9935d89296..5e2d540b77 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_propertycolumn.hbm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/hbm/index/person_propertycolumn.hbm.xml @@ -9,7 +9,7 @@ "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> - + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/hbm/version/Mappings.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/test/hbm/version/Mappings.hbm.xml new file mode 100644 index 0000000000..dd9533f67e --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/hbm/version/Mappings.hbm.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file