Created
January 27, 2015 12:54
-
-
Save oliviermarin/c6c4cf03ec7468e0f64a to your computer and use it in GitHub Desktop.
fonction pour faire passer user vers servlet ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public User findByUserID(Integer ID) throws Exception { | |
EntityManager em = OpenJPAUtils.openEntityManager(); | |
User result = em.find(User.class, ID); | |
HashSet<Contact> contacts = (HashSet<Contact>)getAllContactByUserID(result.getId()); | |
if (contacts != null) { | |
result.setContacts(contacts); | |
} else { | |
result.setContacts(new HashSet<Contact>()); | |
} | |
OpenJPAUtils.closeEntityManager(em); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Merci !