views:

801

answers:

2

Hi, on my company we are developing a ERP-like app using java and jsf, so far the design team has identified about 20 entities,each with diferent properties, usually we'll be building 20 pages of CRUD , is there any better way to do this?, we are using hibernate as db access, so we came up with the idea of a single DAO for this part of the system, have you faced a similiar situation? what are your thoughts on it?

A: 

You might consider codegenerating those 20 screens, much like scaffolding in Ruby does. As far as DAO is concerned, you might pull CUD operations to some generic IBusinessObjectDao, leaving specific R operations (querying by various parameters) to concrete DAO implementations.

Anton Gogolev
+1  A: 

You really should look into Seam. It has a feature called Seam-Gen that will reverse engineer your entire application CRUD pages from the database. You can edit the Seam-Gen templates (which are based on Freemarker) to customise the pages that will be generated to your liking.

I use the Eclipse plugin Azzurri Clay to model my database and generate the DDL. I then run Seam-Gen and in a few seconds you have a running application. It's a very handy combination.

Damo