@Test public void testManyToOne() { Quote quote = new Quote(); quote.setQuoteNumber("aqmany-1234-" + (new Date()).getTime()); quote.setQuoteVers("V" + (new Date()).getTime()); try { quote.setShipping("Shipping!"); Set<LineItem> lineItems = new HashSet<LineItem>(); for (int i = 0; i < 3; i++) { LineItem lineItem = new LineItem(); lineItem.setCost(new BigDecimal("100" + i)); lineItem.setCustomDescription("Custom description " + i); lineItem.setQuantity(i); lineItem.setProduct(productService.findById(String.valueOf(i))); lineItems.add(lineItem); } quote.setLineItems(lineItems); quoteService.createOrUpdate(quote); } catch (Exception ex) { log.error("Could not persist quote: ", ex); } }
public void createOrUpdate(Quote quote) throws Exception { log.info( "Updating 1234-" + quote.getQuoteNumber() + " version " + quote.getQuoteVers() + " for potential: " + quote.getPotentialId()); String modifiedQuoteNumber = "1234-" + quote.getQuoteNumber(); quote.setQuoteNumber(modifiedQuoteNumber); em.persist( quote ); }
QuoteService { public void createOrUpdate(Quote quote) throws Exception { log.info( "Updating 1234-" + quote.getQuoteNumber() + " version " + quote.getQuoteVers() + " for potential: " + quote.getPotentialId()); String modifiedQuoteNumber = "1234-" + quote.getQuoteNumber(); quote.setQuoteNumber(modifiedQuoteNumber); em.persist( quote ); } }
QuoteService { public void createOrUpdate(Quote quote) throws Exception { log.info( "Updating 1234-" + quote.getQuoteNumber() + " version " + quote.getQuoteVers() + " for potential: " + quote.getPotentialId()); String modifiedQuoteNumber = "1234-" + quote.getQuoteNumber(); quote.setQuoteNumber(modifiedQuoteNumber); em.persist( quote ); }  }
QuoteService { public void createOrUpdate(Quote quote) throws Exception { log.info( "Updating 1234-" + quote.getQuoteNumber() + " version " + quote.getQuoteVers() + " for potential: " + quote.getPotentialId()); String modifiedQuoteNumber = "1234-" + quote.getQuoteNumber(); quote.setQuoteNumber(modifiedQuoteNumber); em.persist( quote ); }  void createOrUpdate(Quote quote); List<Quote> findQuotesByCriteria(String criteria); @SuppressWarnings("unchecked") List<Quote> findQuotesByCriteria(final SearchCriteria criteria); }
QuoteService { public void createOrUpdate(Quote quote) throws Exception { log.info( "Updating 1234-" + quote.getQuoteNumber() + " version " + quote.getQuoteVers() + " for potential: " + quote.getPotentialId()); String modifiedQuoteNumber = "1234-" + quote.getQuoteNumber(); quote.setQuoteNumber(modifiedQuoteNumber); em.persist( quote ); }  void createOrUpdate(Quote quote); List<Quote> findQuotesByCriteria(String criteria); @SuppressWarnings("unchecked") List<Quote> findQuotesByCriteria(final SearchCriteria criteria);  }