### Question:
ContactEJB3DAO extends IdentifiableEJB3DAO<Contact> implements ContactDao { public List<Contact> findByBasicAttributes ( String firstName, String midInitials, String lastName, String email ) { Contact templateObj = new Contact ( firstName, midInitials, lastName, email ); Example tplCriterion = Example.create ( templateObj ); tplCriterion.enableLike ( MatchMode.ANYWHERE ); tplCriterion.ignoreCase (); Session session = getSession (); Criteria criteria = session.createCriteria ( Contact.class ); criteria.add ( tplCriterion ); return criteria.list (); } ContactEJB3DAO();  ContactEJB3DAO(EntityManager entityManager); List<Contact> findByBasicAttributes(
		String firstName, String midInitials, String lastName, String email );  }### Answer:
@Test @Ignore public void testFindByBasicAttributes() throws Exception { Contact contact = new Contact("Jon", "", "Smith", "jjs@somewhere.net"); contact.setPhone("123"); contact.setAffiliation("The SuperCorp Inc."); EntityTransaction tnx = entityManager.getTransaction(); tnx.begin(); dao.save((Contact) contact); tnx.commit(); List<Contact> objs = dao.findByBasicAttributes("Jon", null, "ith", null); assertNotNull("Ops! null result! :-( Check you've a proper test data set", objs); assertTrue("Ops! Empty Result! :-( Check you've a proper test data set", objs.size() > 0); out.println("OK, showing firts item: "); Contact obj = objs.get(0); out.println(obj); }
@Test @Ignore public void testFindByBasicAttributes1() throws Exception { Contact contact = new Contact("Marco", "", "Brandizi", "m.b@somewhere.net"); contact.setPhone("456"); contact.setAffiliation("European Bioinformatics Institute (EBI)"); EntityTransaction tnx = entityManager.getTransaction(); tnx.begin(); dao.save((Contact) contact); tnx.commit(); List<Contact> objs = dao.findByBasicAttributes("Marco", null, "Brandizi", null); assertNotNull("Ops! null result! :-( Check you've a proper test data set", objs); assertTrue("Ops! Empty Result! :-( Check you've a proper test data set", objs.size() > 0); out.println("OK, showing items: "); for (Contact obj : objs) out.println(obj + "\n\n"); }