Re: entity manager in webapp

2011-03-11 Thread Cristiano GaviĆ£o

Well, warp-persist became Guice-Persist... and it is part of 3.0:

dependency
groupIdcom.google.inject.extensions/groupId
artifactIdguice-persist/artifactId
version3.0-rc3/version
/dependency

dependency
groupIdcom.google.inject.extensions/groupId
artifactIdguice-servlet/artifactId
version3.0-rc3/version
/dependency

cheers

Cristiano

On 10/03/11 12:01, Witold Czaplewski wrote:

IMO warp-persist is dead and Guice 3.0 should be final soon (rc3 is out now):
http://code.google.com/p/google-guice/downloads/list


Witold

Am Thu, 10 Mar 2011 15:31:19 +0100
schrieb Bas Goorenb...@iswd.nl:


Which is basically warp-persist, but integrated into guice. But as far
as I know, it will be only be integrated as of guice 3.0;

Bas

Op 10-3-2011 15:29, nino martinez wael schreef:

I'd go for guice persist if thats an option..

2011/3/10 Bas Goorenb...@iswd.nl


Have a look at databinder or warp-persist for a better implementation.

Should you go with your own implementation, do not forget to clear the
ThreadLocal at the end of the request to prevent:
a) leaking
b) re-using an EntityManager from a previous request (most if not all
application servers use a thread pool)

Bas

Op 10-3-2011 13:12, Duro schreef:

   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 ThreadLocalEntityManager   emHolder = new
ThreadLocalEntityManager() {
 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




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




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



entity manager in webapp

2011-03-10 Thread Duro
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 ThreadLocalEntityManager emHolder = new 
ThreadLocalEntityManager() {

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



Re: entity manager in webapp

2011-03-10 Thread Bas Gooren

Have a look at databinder or warp-persist for a better implementation.

Should you go with your own implementation, do not forget to clear the 
ThreadLocal at the end of the request to prevent:

a) leaking
b) re-using an EntityManager from a previous request (most if not all 
application servers use a thread pool)


Bas

Op 10-3-2011 13:12, Duro schreef:
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 ThreadLocalEntityManager emHolder = new 
ThreadLocalEntityManager() {

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



Re: entity manager in webapp

2011-03-10 Thread nino martinez wael
I'd go for guice persist if thats an option..

2011/3/10 Bas Gooren b...@iswd.nl

 Have a look at databinder or warp-persist for a better implementation.

 Should you go with your own implementation, do not forget to clear the
 ThreadLocal at the end of the request to prevent:
 a) leaking
 b) re-using an EntityManager from a previous request (most if not all
 application servers use a thread pool)

 Bas

 Op 10-3-2011 13:12, Duro schreef:

  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 ThreadLocalEntityManager emHolder = new
 ThreadLocalEntityManager() {
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




Re: entity manager in webapp

2011-03-10 Thread Bas Gooren
Which is basically warp-persist, but integrated into guice. But as far 
as I know, it will be only be integrated as of guice 3.0;


Bas

Op 10-3-2011 15:29, nino martinez wael schreef:

I'd go for guice persist if thats an option..

2011/3/10 Bas Goorenb...@iswd.nl


Have a look at databinder or warp-persist for a better implementation.

Should you go with your own implementation, do not forget to clear the
ThreadLocal at the end of the request to prevent:
a) leaking
b) re-using an EntityManager from a previous request (most if not all
application servers use a thread pool)

Bas

Op 10-3-2011 13:12, Duro schreef:

  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 ThreadLocalEntityManager  emHolder = new
ThreadLocalEntityManager() {
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




Re: entity manager in webapp

2011-03-10 Thread Witold Czaplewski
IMO warp-persist is dead and Guice 3.0 should be final soon (rc3 is out now):
http://code.google.com/p/google-guice/downloads/list


Witold

Am Thu, 10 Mar 2011 15:31:19 +0100
schrieb Bas Gooren b...@iswd.nl:

 Which is basically warp-persist, but integrated into guice. But as far 
 as I know, it will be only be integrated as of guice 3.0;
 
 Bas
 
 Op 10-3-2011 15:29, nino martinez wael schreef:
  I'd go for guice persist if thats an option..
 
  2011/3/10 Bas Goorenb...@iswd.nl
 
  Have a look at databinder or warp-persist for a better implementation.
 
  Should you go with your own implementation, do not forget to clear the
  ThreadLocal at the end of the request to prevent:
  a) leaking
  b) re-using an EntityManager from a previous request (most if not all
  application servers use a thread pool)
 
  Bas
 
  Op 10-3-2011 13:12, Duro schreef:
 
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 ThreadLocalEntityManager  emHolder = new
  ThreadLocalEntityManager() {
  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
 
 


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