wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes are entity beans  EJB3? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "are entity beans  EJB3?" Watch "are entity beans  EJB3?" New topic
Author

are entity beans EJB3?

Jaaouane Aymen
Greenhorn

Joined: Sep 22, 2009
Posts: 29
Hello,
Why the entity Beans are considered as EJB?
I learned that an EJB is a java class that can not live away from the application server, but entity beans
are used in standard edition environnement. I writed and used entity beans with Hibernate to develop a
simple CRUD application without application server and the tutorial that I learned do not use the term
of EJB when they talk about Entity beans. so what is the relationship between entity beans and EJB3? why they
are treated as EJB3 whereas we can use them without application servers?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


but entity beans
are used in standard edition environnement

No, they are not. Entity beans are part of EJB2 are were replaced by JPA. Entity beans do not feature in EJB3.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jaaouane Aymen
Greenhorn

Joined: Sep 22, 2009
Posts: 29
This is a sentence taken from the web site of JBOSS from a tutorial about Seam

"The EJB3 standard @Entity annotation indicates that the User class is an entity bean"

what does it mean? is it wrong?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Yes, it is wrong. The EJB 2.0 specification defined entity beans, the EJB3 specification does not include them (other than legacy reference). The term used in the specification is "Entity Class" or "Entity".
Jaaouane Aymen
Greenhorn

Joined: Sep 22, 2009
Posts: 29
Hello,
From what i understood from my researches, i think that the specification of EJB3 includes the @Entity annotation,
i understood that the spec of JPA is included in the spec of EJB3, but my problem is that we can use JPA in standard
edition environnement and it is not necessary to use JPA in an entreprise edition environnement. Thus, i will change my question.
why the spec of JPA is included in the spec of EJB otherwise it is not necessary to have an application server installed to work with JPA?
to work with JPA, we need only a provider such as HIBERNATE?
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489


why the spec of JPA is included in the spec of EJB otherwise it is not necessary to have an application server installed to work with JPA?
to work with JPA, we need only a provider such as HIBERNATE?


JPA is used in EJB3.0 to replace Entity bean in EJB2.0..
the main differences between EJB2.0 and EJB3.0 is annotations, and the version of Java technology..
@Entity is used to mapping table into Java class... //this is new approach in JEE5..
@Entity and all annotation in the package of javax.persistence is included in the spec of EJB3.0...
Because in EJB3.0 there are many annotations could be used to access, and to "communicate" with entity class..

its depend on what application that you want to build..
if you want to build an Web or EJB or WebService application, you should use an application server installed to work with JPA, and commonly application server could handle many low level processes that important for us, such as open/close connection, connection pooling, and etc...
if you just want to build desktop application, you won't need an application server to work with JPA...

Hibernate is an implementation of JPA standard..
you could use other, such as EclipseLink, OpenJPA, TopLink and etc..

Hope that helps..

please correct me if i'm wrong...

Thanks..


Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Jaaouane Aymen
Greenhorn

Joined: Sep 22, 2009
Posts: 29
Thnak you Leonardo for your help,
my problem is not the definition of @Entity or when we use AS and when we do not use.
my problem is why the javax.persistence package is included in the spec of EJB3.0 whereas
we can use JPA for desktop applications?
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Yes, of course we could use JPA in Desktop application..
but, sometimes, people use Hibernate in Desktop application..
Jaaouane Aymen
Greenhorn

Joined: Sep 22, 2009
Posts: 29
Sorry Leonardo, you do not reply to my question.
why the javax.persistence package is included
in the spec of EJB3.0 whereas we can use JPA for desktop applications?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
Many APIs that are part of JEE can be used outside of it: servlets/JSP, JAX-WS, JAX-RS, JPA, etc. It just means that if you want to call your container JEE-compliant, then you need to support those APIs.


Ping & DNS - my free Android networking tools app
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Jaaouane Aymen wrote:Sorry Leonardo, you do not reply to my question.
why the javax.persistence package is included
in the spec of EJB3.0 whereas we can use JPA for desktop applications?


Oopss sorry if i was mistaken..

JPA is a standard, and it's included in the spec of EJB3.0..
while JPA is used in the spec of EJB3.0, it plays a role a Entity Bean...
JPA in EJB3.0 and JPA in desktop application is used for different purpose, and with the different feature also..
if we work JPA in EJB3.0 we have been supported many features (such as connection pooling, JTA, etc) by Application Server...

hope you know what i mean..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: are entity beans EJB3?