dcsimg
are static homes evil?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Dirk_Haase
Posted On:   Friday, June 21, 2002 02:11 AM

Hi, we are in need of some sort of utility class that resolves finder functionality for us. This should provide methods in the form of findXXXByPK(String) or findYYYByName(String), returning a local reference. We have some different opinions on how to code this best, considering performance and "political correctness" of the code and code placement. The first version would be a stateless session bean that instantiates all necessary home interfaces in the ejbCreate() method to use them later. Advantage: clean, nice code. Disadvantage: Every SessionBean using this SessionBean needs to make a new JNDI lookup to get this utility class. Second version is a regular class (not an EJB) tha   More>>

Hi,




we are in need of some sort of utility class that resolves finder functionality for us. This should provide methods in the form of findXXXByPK(String) or findYYYByName(String), returning a local reference.
We have some different opinions on how to code this best, considering performance and "political correctness" of the code and code placement.



The first version would be a stateless session bean that instantiates all necessary home interfaces in the ejbCreate() method to use them later. Advantage: clean, nice code. Disadvantage: Every SessionBean using this SessionBean needs to make a new JNDI lookup to get this utility class.



Second version is a regular class (not an EJB) that can be accessed statically to provide these methods. This class would instantiate the relevant home interfaces in a static context and call find methods on these home interfaces from its static methods. Advantage: probably better performance than first version and easier access without JNDI lookup. Disadvantage: I am not sure if those static home interfaces are evil.



I know this might be an ethical question about code beauty, but I would like to hear some input on this.



thanks,

  dirk

   <<Less

Re: are static homes evil?

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, June 21, 2002 07:37 AM

I thought it was "static cling" that was evil? (from some old American TV commercial for laundry detergent or fabric softener or something, lodged somewhere deep in my brain, I fear :-)



Seriously I would ask the question, are the static home interfaces likely to change in the future, requiring a change to your regular class that wraps/finds them? The answer might help, to determine the relative beauty/ugliness of it as a solution....

About | Sitemap | Contact