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 fine /coarse grained Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "fine /coarse grained" Watch "fine /coarse grained" New topic

fine /coarse grained

james edwin
Ranch Hand

Joined: Nov 22, 2001
Posts: 393
Can some one tell what is fine/coarse grained entity beans(definition,difference and example).
B'coz my net research says everything different,no two same matched are found,everyone says something different.


Stu Glassman
Ranch Hand

Joined: Jul 01, 2002
Posts: 91
The terms fine-grained and coarse-grained describe how data is passed. Let's say that you need to pass an ID number, first name, and last name to an EJB named foo. Here's an example of doing it fine-grained:

This works fine in most programs, but when these methods are called remotely (which is the case with all EJBs), it takes a really long time. A better way of passing this data is to use a coarse-grained approach. Put the data into a class and pass it with a single method call. Here's how:

Then you would make the method call like this:
foo.setData(new DataClass(id, firstName, lastName));
Instead of three method calls, you are only making one. Like I said, this is only useful if the method calls cost a great deal in performance, and therefore perfect for EJBs.
Hope my incoherent ramblings made some sense,
Mahesh Devendran

Joined: Dec 23, 2002
Posts: 3
Hi Pals,
There is a better discussion on this at
I agree. Here's the link:
subject: fine /coarse grained
It's not a secret anymore!