users@glassfish.java.net

Re: Glassfish security - user session linked with database

From: <glassfish_at_javadesktop.org>
Date: Wed, 22 Sep 2010 20:11:13 PDT

I am trying to build a function that uses my userPrincipal name, that is my user login, and with this find the associated id in mysql user information database. Not ressource wise, but for now i can cope with this.

I have an Entity Bean linked to my database with JPA, I can find some content with :

EntityManagerFactory emf = Persistence.createEntityManagerFactory("alloPU");
EntityManager em = emf.createEntityManager();
        
myEntity = em.find(User.class, *id*)

Is there an equivilalent function to find an object without using the id property, but another attribute, like say the login, and then get the id from this...?
[Message sent by forum member 'guiomie']

http://forums.java.net/jive/thread.jspa?messageID=483388