Data « POJO « JPA Q&A

1. JPA POJO as Data Object

What is the best practice in using JPA Entities? Since JPA entities are just POJOs, is it considered appropriate to use the object as a data object in other parts of the ...

2. Mapping data from one POJO Class to multiple tables?!

You need to do a join of DetailedProduct and ProductSizeJunction. I think you can do that using a secondary table mapping. In JPA there is a concept of secondary tables - don't know if Hibernate is using different terms. The fact that you have a primary key that is composed of multiple attributes might make that a little bit more complex ...

3. No data in my POJO but they are hidden under a proxy?

I have a one-to-one mapping I am trying to load, but no data is loaded in my java object... But when I debug and look at the java object, I find my data hidden under a CGLIB$CALLBACK_0: net.sf.cglib.proxy.MethodInterceptor = {org.hibernate.proxy.CGLIBLazyInitializer@5146} and under target.. Why is this happening and how do I fix it? Regards, BTJ