Satish,
first of all: thanx for your reply!
Satish Srinivasan wrote:
-1- Use SLSBs for transaction demarcation, and maybe some workflow logic. Let them delegate the actual domain logic to Hibernate POJOs. The aim must be to make the SLSBs as thin as possible. These POJOs shouldn't really know they are being used from an SLSB context. Assuming you are using some kind of DAO factory, i.e., your DAOs are coded to interfaces, it should be trivial for your SLSB to use HibernateDAOs to load, save these POJOs
Personally, I also like this option the most. The problem is that I will have to replace all existing JDBC DAO code by HibernateDAO's and extract the business logic from the SLSB business objects and place it in the POJOs (if I understand u correctly). It shouldn't be really a problem for small or new applications, but I'm talking about more then 60.000 LOC in the current JDBC DAO layer that has to be replaced. (It's hard to sell to my boss).
We decided to follow this option for all new modules.
Satish Srinivasan wrote:
-2- Use Middlegen or something to generate metadata mapping (*.hbm.xml files). Use hbm2java to generate *dumb* Hibernate POJOs. Hand-tune mapping and POJO source as you see fit (this would make round-tripping more painful, but that may not be important to you). Retain business logic in your SLSBs, and use the DAOs to load and store these POJO data objects
With this approach, I don't have to change anything to my SLSB business objects (which saves me a lot of time :)) but I still have to write the mappers and modify my DAOs, so they can persist the POJOs with Hibernate (again, those 60.000 lines of JDBC code, pfff, I wish they didn't exist :))
Satish Srinivasan wrote:
-3- Upgrade to Hibernate 3; use Hibernate like a JDBC framework (like Clinton Begin's iBatis) to take away the pain of maintaining your DataHelper class; Hibernate will take care of the result-set mapping.
Sounds nice, since we're starting with Hibernate, it might be useful to move to Hibernate 3 right away but I was told this version makes use of some new JDK 5 features (like generics or annotations) which aren't supported by our app server (we're using Oracle 10G App Server). I must confess I haven't investigated this, though... Are there any limitations with using the new-and-improved Hibernate 3 when used in the '
older' environments?
I've just re-read my reply and I'm starting to think I want to do things that, technically, are just not possible... I think I have to choose between either migrating to Hibernate (as a whole) or staying with my old-school JDBC DAOs... If I could turn back time, a few years, I would have chosen to use Hibernate immediatly... ;-)
Anyway, Thanx for your help...
Greetz,
Stijn Janssens