users@glassfish.java.net

Re: how to create a MySql datasource using asadmin ?

From: Felipe Gaścho <fgaucho_at_gmail.com>
Date: Fri, 14 Aug 2009 20:22:16 +0200

so, this code is thread safe:

        @PersistenceUnit(name = "footprint")
        private EntityManagerFactory emf;

        public T read(final Serializable primaryKey) throws Exception {
                EntityManager manager = emf.createEntityManager();
                try {
                        return manager.find(entityClass, primaryKey);
                } finally {
                        manager.close();
                }
        }


??