diff --git a/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/BasicPropertiesTest.java b/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/BasicPropertiesTest.java new file mode 100644 index 0000000000..8b5f5454ec --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/BasicPropertiesTest.java @@ -0,0 +1,71 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2006-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.test.propertyref.basic; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.junit.Test; + +/** + * @author Brett Meyer + */ +public class BasicPropertiesTest extends BaseCoreFunctionalTestCase { + @Override + public String[] getMappings() { + return new String[] { "propertyref/basic/EntityClass.hbm.xml" }; + } + + /** + * Really simple regression test for HHH-8689. + */ + @Test + @TestForIssue(jiraKey = "HHH-8689") + public void testProperties() { + Session s = openSession(); + Transaction t = s.beginTransaction(); + EntityClass ec = new EntityClass(); + ec.setKey( 1l ); + ec.setField1( "foo1" ); + ec.setField2( "foo2" ); + s.persist( ec ); + t.commit(); + s.close(); + + s = openSession(); + t = s.beginTransaction(); + ec = (EntityClass) s.get( EntityClass.class, 1l ); + t.commit(); + s.close(); + + assertNotNull( ec ); + assertEquals( ec.getField1(), "foo1" ); + assertEquals( ec.getField2(), "foo2" ); + } +} + diff --git a/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/EntityClass.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/EntityClass.hbm.xml new file mode 100644 index 0000000000..6d38eca119 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/EntityClass.hbm.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/EntityClass.java b/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/EntityClass.java new file mode 100644 index 0000000000..76368c4f24 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/propertyref/basic/EntityClass.java @@ -0,0 +1,35 @@ +package org.hibernate.test.propertyref.basic; + +public class EntityClass { + + private Long key; + + private String field1; + + private String field2; + + public Long getKey() { + return this.key; + } + + public void setKey(Long key) { + this.key = key; + } + + public String getField2() { + return this.field2; + } + + public void setField2(String field2) { + this.field2 = field2; + } + + public String getField1() { + return this.field1; + } + + public void setField1(String field1) { + this.field1 = field1; + } + +} \ No newline at end of file