Package org.hibernate.test.any

Source Code of org.hibernate.test.any.AnyTypeTest

package org.hibernate.test.any;

import org.hibernate.Session;
import org.hibernate.testing.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.testing.junit.functional.FunctionalTestCase;

import junit.framework.Test;

/**
* todo: describe AnyTypeTest
*
* @author Steve Ebersole
*/
public class AnyTypeTest extends FunctionalTestCase {
  public AnyTypeTest(String name) {
    super( name );
  }

  public String[] getMappings() {
    return new String[] { "any/Person.hbm.xml" };
  }

  public String getCacheConcurrencyStrategy() {
    // having second level cache causes a condition whereby the original test case would not fail...
    return null;
  }

  public static Test suite() {
    return new FunctionalTestClassTestSuite( AnyTypeTest.class );
  }

  /**
   * Specific test for HHH-1663...
   */
  public void testFlushProcessing() {
    Session session = openSession();
    session.beginTransaction();
    Person person = new Person();
    Address address = new Address();
    person.setData( address );
    session.saveOrUpdate(person);
    session.saveOrUpdate(address);
    session.getTransaction().commit();
    session.close();

    session = openSession();
    session.beginTransaction();
        person = (Person) session.load( Person.class, person.getId() );
        person.setName("makingpersondirty");
    session.getTransaction().commit();
    session.close();

    session = openSession();
    session.beginTransaction();
    session.delete( person );
    session.getTransaction().commit();
    session.close();
  }
}
TOP

Related Classes of org.hibernate.test.any.AnyTypeTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.