HHH-8689 regression test
This commit is contained in:
parent
7706402213
commit
2290f3e088
|
@ -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" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE hibernate-mapping PUBLIC
|
||||||
|
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||||
|
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >
|
||||||
|
|
||||||
|
<hibernate-mapping>
|
||||||
|
<class
|
||||||
|
name="org.hibernate.test.propertyref.basic.EntityClass"
|
||||||
|
table="table1" lazy="false">
|
||||||
|
<id
|
||||||
|
name="key"
|
||||||
|
type="java.lang.Long"
|
||||||
|
column="column1"/>
|
||||||
|
|
||||||
|
<properties name="refkey">
|
||||||
|
<property name="field1" type="java.lang.String" column="column3" not-null="true" length="20" />
|
||||||
|
<property name="field2" type="java.lang.String" column="column4" not-null="true" />
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</class>
|
||||||
|
</hibernate-mapping>
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue