Wicket with JPA and container managed transactions

2012-10-08 Thread Dieter Tremel
Moving from JSF to Wicket 6.1.0 I am used to having all JPA operations in a EJB facade to use the container's (Glassfish 3.2.1) transaction management. I use and know wicket-cdi for injection, which works fine. Unfortunately, if I inject an EJB in a wicket page, the serialization checks of wicket

Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Martin Grigorov
Hi, Are you aware of https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/javaee-inject-parent ? https://github.com/wicketstuff/core/wiki/Java-EE-Inject On Mon, Oct 8, 2012 at 4:05 PM, Dieter Tremel wrote: > Moving from JSF to Wicket 6.1.0 I am used to having all JPA operations > in a

Re: Wicket with JPA and container managed transactions

2012-10-08 Thread heapifyman
As far as I understood you have two possibilities: 1. Inject your EJB into a CDI component and inject that component into your wicket pages using @Inject annotation. That should solve the serialization problem but you will have an additional "layer". 2. Use javaee-inject from wicketstuff [1] to inj

Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Dieter Tremel
Am 08.10.2012 15:14, schrieb Martin Grigorov: > Are you aware of > https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/javaee-inject-parent > ? Hi Martin, I know this lib an had a look at it. If I am right, it is just another way of injection. In my running example of implementing a dat

Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Martin Grigorov
Hi Dieter, javaee-inject uses wicket-ioc and injects a serializable Proxy instead of the EJB bean itself that was returned by the container. This is the same as how Spring and Guice work. See the response of heapifyman. The simplest would be use only CDI in your Wicket code. Hide any usage of EJB

Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Dieter Tremel
Am 08.10.2012 15:34, schrieb Martin Grigorov: > javaee-inject uses wicket-ioc and injects a serializable Proxy instead > of the EJB bean itself that was returned by the container. This is the > same as how Spring and Guice work. > > See the response of heapifyman. The simplest would be use only CD

Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Dieter Tremel
I found a different solution I would like to post for discussion: I encapsulated the Facade in a LoadableDetachableModel like this: > /** > * Model for JPA facade beans. > * @author Dieter Tremel > */ > public class EntityFacadeModel extends > LoadableDetachableModel> { > > private Class

Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Martin Grigorov
Hi, The JNDI lookup just done for you in normal JavaEE setup as well. So I think your code is OK. On Mon, Oct 8, 2012 at 6:24 PM, Dieter Tremel wrote: > I found a different solution I would like to post for discussion: > I encapsulated the Facade in a LoadableDetachableModel like this: >> /** >>

Re: Wicket with JPA and container managed transactions

2012-10-09 Thread Dieter Tremel
Am 08.10.2012 17:37, schrieb Martin Grigorov: > The JNDI lookup just done for you in normal JavaEE setup as well. > So I think your code is OK. Thank you Martin for your useful answers. I posted a little more generic solution of an AbstractEjbModel in my blog in http://hotchpotch-blog.de/2012/10/