Examples of Employment


Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization("IFA");
    Organization jboss = new Organization("JBoss");
    Person gavin = new Person("Gavin");
    Employment emp = new Employment(gavin, jboss, "AU");

    s.persist(ifa);
    s.persist(jboss);
    s.persist(gavin);
    s.persist(emp);
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization("IFA");
    Organization jboss = new Organization("JBoss");
    Person gavin = new Person("Gavin");
    Employment emp = new Employment(gavin, jboss, "AU");

    s.persist(ifa);
    s.persist(jboss);
    s.persist(gavin);
    s.persist(emp);
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization("IFA");
    Organization jboss = new Organization("JBoss");
    Person gavin = new Person("Gavin");
    Employment emp = new Employment(gavin, jboss, "AU");
    Serializable orgId = s.save(jboss);
    Serializable orgId2 = s.save(ifa);
    s.save(gavin);
    s.save(emp);
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    Query namedQuery = s.getNamedQuery("AllEmploymentAsMapped");
    List list = namedQuery.list();
    assertEquals(1,list.size());
    Employment emp2 = (Employment) list.get(0);
    assertEquals(emp2.getEmploymentId(), emp.getEmploymentId() );
    assertEquals(emp2.getStartDate().getDate(), emp.getStartDate().getDate() );
    assertEquals(emp2.getEndDate(), emp.getEndDate() );
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization("IFA");
    Organization jboss = new Organization("JBoss");
    Person gavin = new Person("Gavin");
    Employment emp = new Employment(gavin, jboss, "AU");
    Serializable orgId = s.save(jboss);
    Serializable orgId2 = s.save(ifa);
    s.save(gavin);
    s.save(emp);
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    List list = s.createSQLQuery( getEmploymentSQL() )
        .addEntity( Employment.class.getName() )
        .list();
    assertEquals( 1,list.size() );

    Employment emp2 = (Employment) list.get(0);
    assertEquals(emp2.getEmploymentId(), emp.getEmploymentId() );
    assertEquals(emp2.getStartDate().getDate(), emp.getStartDate().getDate() );
    assertEquals(emp2.getEndDate(), emp.getEndDate() );

    s.clear();

    list = s.createSQLQuery( getEmploymentSQL() )
    .addEntity( Employment.class.getName() )
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

  public void testExplicitReturnAPI() {
    Session s = openSession();
    s.beginTransaction();
    Organization jboss = new Organization( "JBoss" );
    Person me = new Person( "Steve" );
    Employment emp = new Employment( me, jboss, "US" );
    Serializable jbossId = s.save( jboss );
    s.save( me );
    s.save( emp );
    s.getTransaction().commit();
    s.close();
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization( "IFA" );
    Organization jboss = new Organization( "JBoss" );
    Person gavin = new Person( "Gavin" );
    Employment emp = new Employment( gavin, jboss, "AU" );
    Serializable orgId = s.save( jboss );
    s.save( ifa );
    s.save( gavin );
    s.save( emp );
    t.commit();

    t = s.beginTransaction();
    Person christian = new Person( "Christian" );
    s.save( christian );
    Employment emp2 = new Employment( christian, jboss, "EU" );
    s.save( emp2 );
    t.commit();
    s.close();

    getSessions().evict( Organization.class );
    getSessions().evict( Person.class );
    getSessions().evict( Employment.class );

    s = openSession();
    t = s.beginTransaction();
    jboss = ( Organization ) s.get( Organization.class, orgId );
    assertEquals( jboss.getEmployments().size(), 2 );
    assertEquals( jboss.getName(), "JBOSS" );
    emp = ( Employment ) jboss.getEmployments().iterator().next();
    gavin = emp.getEmployee();
    assertEquals( gavin.getName(), "GAVIN" );
    assertEquals( s.getCurrentLockMode( gavin ), LockMode.UPGRADE );
    emp.setEndDate( new Date() );
    Employment emp3 = new Employment( gavin, jboss, "US" );
    s.save( emp3 );
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    Iterator iter = s.getNamedQuery( "allOrganizationsWithEmployees" ).list().iterator();
    assertTrue( iter.hasNext() );
    Organization o = ( Organization ) iter.next();
    assertEquals( o.getEmployments().size(), 3 );
    Iterator iter2 = o.getEmployments().iterator();
    while ( iter2.hasNext() ) {
      Employment e = ( Employment ) iter2.next();
      s.delete( e );
    }
    iter2 = o.getEmployments().iterator();
    while ( iter2.hasNext() ) {
      Employment e = ( Employment ) iter2.next();
      s.delete( e.getEmployee() );
    }
    s.delete( o );
    assertFalse( iter.hasNext() );
    s.delete( ifa );
    t.commit();
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization("IFA");
    Organization jboss = new Organization("JBoss");
    Person gavin = new Person("Gavin");
    Employment emp = new Employment(gavin, jboss, "AU");

    s.persist(ifa);
    s.persist(jboss);
    s.persist(gavin);
    s.persist(emp);
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization("IFA");
    Organization jboss = new Organization("JBoss");
    Person gavin = new Person("Gavin");
    Employment emp = new Employment(gavin, jboss, "AU");

    s.persist(ifa);
    s.persist(jboss);
    s.persist(gavin);
    s.persist(emp);
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization("IFA");
    Organization jboss = new Organization("JBoss");
    Person gavin = new Person("Gavin");
    Employment emp = new Employment(gavin, jboss, "AU");
    Serializable orgId = s.save(jboss);
    Serializable orgId2 = s.save(ifa);
    s.save(gavin);
    s.save(emp);
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    Query namedQuery = s.getNamedQuery("AllEmploymentAsMapped");
    List list = namedQuery.list();
    assertEquals(1,list.size());
    Employment emp2 = (Employment) list.get(0);
    assertEquals(emp2.getEmploymentId(), emp.getEmploymentId() );
    assertEquals(emp2.getStartDate().getDate(), emp.getStartDate().getDate() );
    assertEquals(emp2.getEndDate(), emp.getEndDate() );
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
View Full Code Here

Examples of org.hibernate.test.sql.hand.Employment

    Session s = openSession();
    Transaction t = s.beginTransaction();
    Organization ifa = new Organization("IFA");
    Organization jboss = new Organization("JBoss");
    Person gavin = new Person("Gavin");
    Employment emp = new Employment(gavin, jboss, "AU");
    Serializable orgId = s.save(jboss);
    Serializable orgId2 = s.save(ifa);
    s.save(gavin);
    s.save(emp);
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    List list = s.createSQLQuery( getEmploymentSQL() )
        .addEntity( Employment.class.getName() )
        .list();
    assertEquals( 1,list.size() );

    Employment emp2 = (Employment) list.get(0);
    assertEquals(emp2.getEmploymentId(), emp.getEmploymentId() );
    assertEquals(emp2.getStartDate().getDate(), emp.getStartDate().getDate() );
    assertEquals(emp2.getEndDate(), emp.getEndDate() );

    s.clear();

    list = s.createSQLQuery( getEmploymentSQL() )
    .addEntity( Employment.class.getName() )
View Full Code Here
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.