use of org.jboss.as.test.integration.jpa.hibernate.entity.Customer in project wildfly by wildfly.
the class EntityTest method createCustomer.
public Customer createCustomer(String name) {
Customer c = new Customer();
c.setName(name);
session.save(c);
return c;
}
use of org.jboss.as.test.integration.jpa.hibernate.entity.Customer in project wildfly by wildfly.
the class EntityTest method manyToManyCreate.
public void manyToManyCreate() throws Exception {
Flight f1 = findFlightById(new Long(1));
Flight f2 = new Flight();
f2.setId(new Long(2));
f2.setName("Flight two");
Company us = new Company();
us.setName("Airline 2");
f2.setCompany(us);
Set<Customer> customers1 = new HashSet<Customer>();
Set<Customer> customers2 = new HashSet<Customer>();
Customer c1 = new Customer();
c1.setName("John");
customers1.add(c1);
Customer c2 = new Customer();
c2.setName("Tom");
customers2.add(c2);
Customer c3 = new Customer();
c3.setName("Pete");
customers2.add(c3);
f1.setCustomers(customers1);
f2.setCustomers(customers2);
session.save(c1);
session.save(c2);
session.save(c3);
session.save(f2);
}
use of org.jboss.as.test.integration.jpa.hibernate.entity.Customer 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);
}
Aggregations