Hi guys, is this an option to store the JPA entity manager for a wicket webapp:
public class DBUtil {
    private static EntityManagerFactory entityManagerFactory = Persistence
            .createEntityManagerFactory("db");
private static ThreadLocal<EntityManager> emHolder = new ThreadLocal<EntityManager>() {
        protected EntityManager initialValue() {
            return entityManagerFactory.createEntityManager();
        };
    };

    public static User getUser(String userName) {
        return emHolder.get().find(User.class, userName);
    }

..................

If not, thanks for possible better solutions, Juraj

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to