Skip to content

Instantly share code, notes, and snippets.

@oliviermarin
Created January 27, 2015 12:54
Show Gist options
  • Save oliviermarin/c6c4cf03ec7468e0f64a to your computer and use it in GitHub Desktop.
Save oliviermarin/c6c4cf03ec7468e0f64a to your computer and use it in GitHub Desktop.
fonction pour faire passer user vers servlet ...
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;
}
@ahmed-bacha
Copy link

Merci !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment