|
| 1 | +/* |
| 2 | + * Hibernate, Relational Persistence for Idiomatic Java |
| 3 | + * |
| 4 | + * Copyright (c) 2006-2011, Red Hat Inc. or third-party contributors as |
| 5 | + * indicated by the @author tags or express copyright attribution |
| 6 | + * statements applied by the authors. All third-party contributions are |
| 7 | + * distributed under license by Red Hat Inc. |
| 8 | + * |
| 9 | + * This copyrighted material is made available to anyone wishing to use, modify, |
| 10 | + * copy, or redistribute it subject to the terms and conditions of the GNU |
| 11 | + * Lesser General Public License, as published by the Free Software Foundation. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 15 | + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
| 16 | + * for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU Lesser General Public License |
| 19 | + * along with this distribution; if not, write to: |
| 20 | + * Free Software Foundation, Inc. |
| 21 | + * 51 Franklin Street, Fifth Floor |
| 22 | + * Boston, MA 02110-1301 USA |
| 23 | + */ |
| 24 | +package org.hibernate.test.propertyref.basic; |
| 25 | + |
| 26 | +import static org.junit.Assert.assertEquals; |
| 27 | +import static org.junit.Assert.assertNotNull; |
| 28 | + |
| 29 | +import org.hibernate.Session; |
| 30 | +import org.hibernate.Transaction; |
| 31 | +import org.hibernate.testing.TestForIssue; |
| 32 | +import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; |
| 33 | +import org.junit.Test; |
| 34 | + |
| 35 | +/** |
| 36 | + * @author Brett Meyer |
| 37 | + */ |
| 38 | +public class BasicPropertiesTest extends BaseCoreFunctionalTestCase { |
| 39 | + @Override |
| 40 | + public String[] getMappings() { |
| 41 | + return new String[] { "propertyref/basic/EntityClass.hbm.xml" }; |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * Really simple regression test for HHH-8689. |
| 46 | + */ |
| 47 | + @Test |
| 48 | + @TestForIssue(jiraKey = "HHH-8689") |
| 49 | + public void testProperties() { |
| 50 | + Session s = openSession(); |
| 51 | + Transaction t = s.beginTransaction(); |
| 52 | + EntityClass ec = new EntityClass(); |
| 53 | + ec.setKey( 1l ); |
| 54 | + ec.setField1( "foo1" ); |
| 55 | + ec.setField2( "foo2" ); |
| 56 | + s.persist( ec ); |
| 57 | + t.commit(); |
| 58 | + s.close(); |
| 59 | + |
| 60 | + s = openSession(); |
| 61 | + t = s.beginTransaction(); |
| 62 | + ec = (EntityClass) s.get( EntityClass.class, 1l ); |
| 63 | + t.commit(); |
| 64 | + s.close(); |
| 65 | + |
| 66 | + assertNotNull( ec ); |
| 67 | + assertEquals( ec.getField1(), "foo1" ); |
| 68 | + assertEquals( ec.getField2(), "foo2" ); |
| 69 | + } |
| 70 | +} |
| 71 | + |
0 commit comments