Entity Bean home interface can have creaters, finders and home business methods.
1) creater or rather create methods are used to create a row in the database.
My point comes below.
2) finder methods : Client uses finder methods to get a collection of( or one remote ref if it is find by primary key) of the remote references. To get to the data he wants, he iterates through the collection and calls business methods of the remote interfaces. This can be network heavy. If we have 5000 remote interfaces in the collection, it will be atleast so many number of remote calls!!!
3) home business methods : Client uses these methods to get to data directly. This happens only once. Compare 5000 remote calls to one!!
Now the question is when to choose between entity home finders and entity home business methods. If the home business methods returning a collection of data are reducing the network traffic, why do you want to use finders, except for findbyprimarykey?
I POSTED THIS ON EJB FORUM. BUT COULD NOT GET A SATISFACTORY REPLY. SO I AM POSTING IT AGAIN HERE.
5000 records to be fetched from remote? You may have to reconsider your design. Remote Entity Beans are not for bulk data reads. You are better off with a 'ValueList Iterator' - Just fetch how much you need at a time.
I presume that in the other case you want to have a home business method that returns a Collection of Value Objects. I don't prefer this either because transporting 5000 Value Objects over-the-wire (Your entity bean is remote. Right?) will be a severe performance hit.
If you just want to create or delete or update records, use a Facade wrapped over Entity Beans to do it. If you want to bulk fetch records, use ValueList Iterator.
Thanks Keerthi! That was a nice answer to my problem. But even if you use Iterator pattern, again the dilemma comes whether to use home business methods or finders. I can use the pattern to get as many remote ref(finder way) as needed. But still I have to call remote business methods on them. But if I use the same iterator pattern for home business methods(using ofcourse value objects!), the number of remote calls will reduce. Don't you think so?
Hi, If as you are talking about bulk data reads then home business methods make more sense. The home business method can return a collection of value objects and the client can work with those value objects returned. This will reduce the remote calls. But then as keethi pointed you may want to reconsider your design [ fetch 5000 record ].
Sawan<br />SCJP,SCWCD,SCBCD<br /> <br />Every exit is an entry somewhere.
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad: