private static void seedData ( PersistenceManager manager ) throws OnyxException { Account account = new Account ( ) ; //noinspection SpellCheckingInspection 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 ) ; Account account1 = manager . findById ( Account . class , 1 ) ; assert account1 != null ; assert account1 . getAccountId ( ) == 1L ; }
Fill the database with some test data so that we can show how the data model updates impact the changes to the values .