aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Doubt in entity bean !! its urgent 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 "Doubt in entity bean !! its urgent" Watch "Doubt in entity bean !! its urgent" New topic
Author

Doubt in entity bean !! its urgent

manish basotia
Ranch Hand

Joined: Jan 12, 2004
Posts: 47
Hi all,
I have a doubt on enity bean. Just to explain i am giving an example.

In a J2ee project say i have some page which takes some input from a user, Then on submit i pass these inputs to a session bean which does some processing of the data and finally store it in database. Later i can display the processed information to the user.

??
now what i want to know is in such kind of scenario where does entity bean fit into picture, what i mean i can directly query some records and display it to the user.
??

Note :- I just taken an example to explain the condition, what i want to now is in high level project where at broad level , typically the scenario will be same so with respect to that please let me know where exactly do we use entity bean, and how it is beneficial.

Thanks
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

Well, typically an entity bean would be used for the "CRUD" operations: Create, Retrieve, Update, Delete. An entity bean represents one row of data from a database table. That's an oversimplification, but essentially true. Any changes you make to an entity bean are reflected in the database. The strengths of entity beans are they (often) allow you to do database operations without writing JDBC/SQL code and they give you easy access to the app server's features, such as transactions, security, connection pooling, etc. The weakness of entity beans is the overhead they add to your application. When you are using session beans to access entity beans, you can greatly reduce this overhead by using local interfaces, rather than the standard remote interfaces. Hope that helps!
manish basotia
Ranch Hand

Joined: Jan 12, 2004
Posts: 47
Thanks Greg, but what advantage it has got over simple client server application. means i could have directly used some SQL statement to do "CRUD" Operations.

with Regards
Manish
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by manish basotia:
[B]ut what advantage it has got over simple client server application. means i could have directly used some SQL statement to do "CRUD" Operations.
Sun originally intended entity beans to be coarse grained business objects with support for transactions, security and remoting. Since most people writing web software have less stringent requirements, they used them as row-level objects. They suit that purpose, but they're overkill in most situations.

For these and other reasons (complexity and configuration), many people have turned to simpler and more efficient ORM (Object Relational Mapping) tools like Hibernate, JDO, etc. They tend to have more flexibility of mappings without the overhead of transactions and security, which most people handled in the session beans anyway.

As well, we are seeing leight frameworks like Spring replacing session beans and other EJB container services.

P.S. You may find that many people read "urgent" and skip the posting, having the opposite effect you intended.
Ellen Zhao
Ranch Hand

Joined: Sep 17, 2002
Posts: 581
get this book if you can: J2EE development without EJB

I'm on chapter 7. Chapter 5 answers manish's question in detail and in depth.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in entity bean !! its urgent
 
Similar Threads
Exception doubt
Doubt on delete of a parent entity
Doubt regarding the cookies.
Doubt...
doubt