EJB programming & troubleshooting: How to handle business logic inside a session bean
I had a question on how to use a session bean correctly. I have a process where I need to access the database, perform some calculations and run many business rules. Should I have DAOs for data access, util classes for calculations and validations and then create these objects when the session bean is created and cache them so that I could reuse them throughout. Is this the right approach or is there a better way to handle it.
- Posted by: antony augusty
- Posted on: December 14 2004 10:12 EST
- How to handle business logic inside a session bean by Pampa S B on December 29 2004 04:13 EST
Its always better to separate out your DB layer processing in a DAO, so that whereever necessary you can use it. Session bean (Use SessionFacade pattern here) will just call the DAO and gets the related objects. If possible use value objects also.