use of org.jpwh.model.complexschemas.custom.Bid in project microservices by pwillhan.
the class CustomSchema method storeLoadCheckSubselectValid.
@Test(expectedExceptions = org.hibernate.exception.ConstraintViolationException.class)
public void storeLoadCheckSubselectValid() throws Throwable {
UserTransaction tx = TM.getUserTransaction();
try {
tx.begin();
EntityManager em = JPA.createEntityManager();
Item item = new Item("Some Item", CalendarUtil.TODAY.getTime(), CalendarUtil.TOMORROW.getTime());
Bid bid = new Bid(new BigDecimal(1), item);
// Out of date range of auction
bid.setCreatedOn(CalendarUtil.AFTER_TOMORROW.getTime());
item.getBids().add(bid);
em.persist(item);
em.persist(bid);
try {
em.flush();
} catch (Exception ex) {
throw unwrapCauseOfType(ex, org.hibernate.exception.ConstraintViolationException.class);
}
} finally {
TM.rollback();
}
}
Aggregations