Hello All, We have to create a Java backend application which will need to run as a deamon. This would be running in parallel with a front end web based system using the same database. Now, the question is, Can i have a java application sharing the same entity beans created and used by the Application server(we have IBM WAS 4.0.2). Is there any special considerations that i need to keep in mind while designing this application. Also, is there any site which i can refer to get more information on the best practices for designing EJBs. Thanks in advance Sriram Sankar
Can i have a java application sharing the same entity beans created and used by the Application server
There is, basicly, nothing wrong with ejbs being called by different applications ( local or remote ones using jndi) if it applies to your needs. in the case of entities the way you should look at it is an object presentation of your infrastraction, thus if you want different application to use same DataBase it is possible to do that.ideally you wont access the entities directly but call session beans as facade. I think that while the senario of different applications calling the entity beans sounds abit un healthy( even though possible strictly speaking) the senario of several web applications communicating with the same EJBs ( and maybe others as well , like third party's ) is a very nice way of implemanting the j2ee architecture have a look at this: Deciding whether EJB is appropriate cheers shai
Shai koren<br />SCJP2 <br />SCEA (well yea only part 1 so far)
Check out theserverside.com for design patterns. Also if you have any other application sharing the entity beans, definetely use the facade pattern to reduce the network traffice. Also depending on how many web concurrent users you may have and also how heavily your backend application uses entity beans you may want to consider clustering with your WAS. I think it would all depend on how much load your background applications adds, how often it calls the entity beasn etc..
One of the things that EJBs were designed to do was make it easy for multiple applications to share resources efficiently and in a co-ordinated way. Please note though that if you're not resolving all EJB references from a single server (that is, the webserver it its own EJB serverand the external app gets EJBs from some other server, that those benefits are mainly lost, since the management is mostly done internal to the EJB server(s) - omitting the concept of clustering, anyway. In other words, usually you have the daemon app do its bean lookups to the JNDI port exposed by the web app server - WebSphere, in your case.
An IDE is no substitute for an Intelligent Developer.