Jared Jared - 22 days ago 9
Java Question

Generating simple crud applications in Spring based off existing database or hibernate configurations?

I'm attempting to learn Spring MVC but have been spoiled by Grails. While I am able to get a basic web application working I was wondering if there were any tools that could do some of the work to create a crud application given a database or hibernate data model? The only one I've found so far is http://www.skywayperspectives.org/portal/web/guest/downloads/overview I'm not sure how to take the generated code and convert it to use either maven or ant for it's build process.

Answer

I've never tried it but it looks like the Appfuse Maven Plugin (AMP) allows you to do this via Maven. There's a mvn appfuse:gen-model command to reverse engineer from a database and mvn appfuse:gen to create the rest of the scaffold.

I think you have to run these from within a project created with one of the Appfuse Maven archetypes. You can find the quickstart guide here to set that up.

Spring Roo has some nice scaffolding too, but it doesn't have the reverse engineering from the database you're looking for yet. Your persistence objects need to be annotated as @RooEntity objects before you can take advantage of the scaffolding with that framework.