Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fine /coarse grained

 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.

Thanks,
 
Stu Glassman
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
-Stu
 
Mahesh Devendran
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pals,
There is a better discussion on this at
http://www.coderanch.com/t/310678/EJB-JEE/java/Coarse-grained-Fine-Grained
Mahesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic