I am newbie for learning J2EE and still many concepts confuses me. I found a entity class looks like a javabean.
1 Is an entity class javabean? (please explain something here... )
2 what the relationship between entity class and JPA? (my understanding: is JPA a tech/API used with entity class, which persists the data from database?)
Thank you guys!!
posted 2 years ago
1. Since EJB 3.0, Entity Bean is modeled as a POJOs (Plain old Java Object). These are in a way simple Java beans with fields and their getters/setters encapsulated in it. However using JPA annotations makes it special and they are then called as JPA Entities. I am not sure if you have looked at the Entity beans prior to 3.0 specifications. That will be helpful to appreciate the change the specifications made to Entities.
2. I believe #1 pretty much says about the relationship between Entities and JPA. Using JPA annotations or deployment descriptor based configuration, you can persist the entities in the database. It is not only about persistence though, lot many things are also going on in the background. JPA helps you map the Java Objects to Relational database tables. You can refer ORM(Object Relational Mapping) to gain a better understanding. You can find this in any EJB or Hibernate reference material.