Skip to content

Instantly share code, notes, and snippets.

@cosbor11
Created July 5, 2016 13:38
Show Gist options
  • Save cosbor11/13a7633049f752fa503fa8b1e51eba38 to your computer and use it in GitHub Desktop.
Save cosbor11/13a7633049f752fa503fa8b1e51eba38 to your computer and use it in GitHub Desktop.
Seed data before updating the model to show the effects of a lightweight migration
Account account = new Account();
account.setAccountName("Timbob's Lawn Care");
account.setBalanceDue(55.43f);
Invoice marchLawnInvoice = new Invoice();
marchLawnInvoice.setDueDate(parseDate("04-01-2016"));
marchLawnInvoice.setInvoiceDate(parseDate("03-01-2016"));
marchLawnInvoice.setNotes("Why did we need to mow your lawn. Its basically a dirt field.");
marchLawnInvoice.setInvoiceId(1l);
marchLawnInvoice.setAmount(44.32);
marchLawnInvoice.setAccount(account);
Invoice aprilLawnInvoice = new Invoice();
aprilLawnInvoice.setDueDate(parseDate("04-01-2016"));
aprilLawnInvoice.setInvoiceDate(parseDate("03-01-2016"));
aprilLawnInvoice.setNotes("Its April, your lawn should be growing by now.");
aprilLawnInvoice.setInvoiceId(2l);
aprilLawnInvoice.setAmount(44.32);
aprilLawnInvoice.setAccount(account);
manager.saveEntity(account);
manager.saveEntity(marchLawnInvoice);
manager.saveEntity(aprilLawnInvoice);
Payment marchLawnCarePayment = new Payment();
marchLawnCarePayment.setPaymentId(1l);
marchLawnCarePayment.setInvoice(marchLawnInvoice);
marchLawnCarePayment.setAmount(44.32);
manager.saveEntity(marchLawnCarePayment);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment