Search in sources :

Example 1 with Ticket

use of org.jboss.as.test.integration.jpa.hibernate.entity.Ticket in project wildfly by wildfly.

the class EntityTest method oneToManyCreate.

public Customer oneToManyCreate() throws Exception {
    Ticket t = new Ticket();
    t.setNumber("111");
    Customer c = new Customer();
    Set<Ticket> tickets = new HashSet<Ticket>();
    tickets.add(t);
    t.setCustomer(c);
    c.setTickets(tickets);
    session.save(c);
    return c;
}
Also used : Ticket(org.jboss.as.test.integration.jpa.hibernate.entity.Ticket) Customer(org.jboss.as.test.integration.jpa.hibernate.entity.Customer) HashSet(java.util.HashSet)

Example 2 with Ticket

use of org.jboss.as.test.integration.jpa.hibernate.entity.Ticket in project wildfly by wildfly.

the class EntityTestCase method testOneToMany.

@Test
@InSequence(1)
public void testOneToMany() throws Exception {
    EntityTest test = lookup("EntityTest", EntityTest.class);
    Customer c = test.oneToManyCreate();
    assertNotNull(c);
    assertNotNull(c.getTickets());
    Set<Ticket> tickets = c.getTickets();
    assertTrue(tickets.size() > 0);
    assertNotNull(c);
    assertNotNull(c.getTickets());
    tickets = c.getTickets();
    assertTrue(tickets.size() > 0);
}
Also used : Ticket(org.jboss.as.test.integration.jpa.hibernate.entity.Ticket) Customer(org.jboss.as.test.integration.jpa.hibernate.entity.Customer) EntityTest(org.jboss.as.test.integration.jpa.hibernate.EntityTest) EntityTest(org.jboss.as.test.integration.jpa.hibernate.EntityTest) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

Customer (org.jboss.as.test.integration.jpa.hibernate.entity.Customer)2 Ticket (org.jboss.as.test.integration.jpa.hibernate.entity.Ticket)2 HashSet (java.util.HashSet)1 InSequence (org.jboss.arquillian.junit.InSequence)1 EntityTest (org.jboss.as.test.integration.jpa.hibernate.EntityTest)1 Test (org.junit.Test)1