Monday, November 20, 2006

OC4J to Glassfish Migration Pt. 2

Today I had a breakthrough. All the problems I had have been related to wrong annotations. Instead of using @PersistenceContext to inject the EntityManager, i have used @Resource as shown in one of the many online tutorials.
Now I can access my Database through a stateless session bean (factory) using various finder methods.
Now I have learned a new unpleasant lesson. My database schema is quite complex with a lot of relations. Therefor lazy access is a must and all entities are annotated accordingly. And now the unpleasant thing: my java standalone client throws an exception. The reason is that because of the lazyness, the javaee client wrapper classes are not able to deserialize the pojos with relations to other entities correctly. The related attributes have not been transferred. The result is a ClassNotFound-Exception although all Pojo-classes are accessible.
It seems that I have to transfer the relevant data via the TransferObject pattern.

It would be nice to have some kind of helper class which would be able to fetch all relevant data for a special find.

Nevertheless I am very happy of the actual migration status. I will report about my next steps soon.

0 Comments:

Post a Comment

<< Home