File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes entity class is a Javabean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "entity class is a Javabean?" Watch "entity class is a Javabean?" New topic

entity class is a Javabean?

Peiyi Xiao

Joined: Feb 06, 2013
Posts: 4
Hello Everybody!!!

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!!
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 544
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.

Hope this helps.

I agree. Here's the link:
subject: entity class is a Javabean?
It's not a secret anymore!