Tutorial on Entity Beans (EJB3 Specification)

6 views
Skip to first unread message

Ashish Kulkarni

unread,
Jun 26, 2008, 6:40:33 AM6/26/08
to Pune-Java
Dear friends,

I have been using EJBs for some time now. I faced the same problems of
Lazy Loading as many others when using Entity EJBs in EJB 1.x
specification.

When EJB 2.x specification came out, I was both excited and sceptical
at the same time and my scepticism was soon proved right as EJB 2.x
had the same issue with Lazy Loading as EJB 1.x.

However, EJB 3.x specification is a complete re-write as far as Entity
EJBs are concerned.

For beginners, there isn't an Entity EJB any more. They are just
Entities.

Yes, they are still part of the specification. But I feel that is more
for historical reasons than anything else.

While Entity EJBs were receeding in popularity, Hibernate and other
ORM frameworks were gaining in popularity, Hibernate being the market
leader.

What Sun has done with regards to Entity EJBs is they have decided to
go down the Hibernate route and use POJOs with Hibernate style
Annotations as Entities.

You may ask me here, how do you do CRUD (Create, Retrieve, Update and
Delete) on the database rows using Entity EJBs if they are POJOs.

Again, Sun have borrowed the Hibernate concept of Persistence Context.
They have introduced Java Persistence API or JPA which has something
called EntityManager that allows us to do CRUD using the POJO
Entities.

I have created a tutorial that makes use of MyEclipse and a PostgreSQL
database and demonstrates how easy it is to create and use Entities
with JPA.

You can find this tutorial at:

http://www.ebizss.com/wiki/index.php/HelloEntity

I would appreciate any feedback on the same.

Best Regards,

Ashish Kulkarni.
http://www.ebizss.com
http://www.ashishkulkarni.com
http://www.sapforbusiness.com
Reply all
Reply to author
Forward
0 new messages