Package dao

Examples of dao.ContactDao.persist()


                try {
                    ContactDao dao = DaoManager.getContactDao();
                    Contact c1 = new Contact();
                    c1.setFirstName("Jack");
                    c1.setLastName("Jones");
                    dao.persist(c1);

                    assertNotNull("saved contact id is null", c1.getId());
                    Contact c2 = dao.findById(c1.getId());
                    assertEquals("names are not equal", c2.getFirstName(), c1.getFirstName());
                    dao.remove(c2);
View Full Code Here


                for (int i = 0; i < 18; i++) {
                    Contact c = new Contact();
                    c.setFirstName("Contact" + i);
                    c.setLastName("Jones" + i);
                    try {
                        dao.persist(c);
                    } catch (DataAccessException e) {
                        e.printStackTrace();
                    }
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.