JBoss SEAM Reverse Engineer Guide
The reverse engineering flash demo for SEAM showcases the powerful eclipse CRUD plugin(s) that allow a developer to reverse engineer a CRUD application from a database. If you haven't viewed the flash demo, here it is: http://www.jboss.com/products/seam/SeamHBTools.html.
Once you've viewed the demo, you'll probably want to take the plugins for a test drive against an existing database schema. In order to get the CRUD plugins up and running, you'll have to do a few things. Keep in mind that these steps are only required because the plugins are being actively developed, but the nightly plugin builds are stable enough to be incredibly useful.
Here's a list of existing uses for the plugin:
Point to any hibernate supported database - HSQL, Oracle, Postgres, MySQL, SQL Server, etc...
Generate Hibernate POJOs/XML or EJB3 entity beans - On any table or set of tables for a hibernate supported db schema
Generate the CRUD JSP pages and JSF config files - JSF based with validation based on table/column constraints
Build/Deploy the application via the generated build script - Ant script that handles compile/build/deploy
Great way to kick start a new SEAM/EJB3 application. Basically 90%+ of the code is generated for you
You can hand edit any of the generated code and re-build/re-deploy. The generated code is surprisingly clean.
Here's what you need to do as of 2/20/2006 to get up and running:
Download eclipse 3.1.1 from: http://download.eclipse.org/eclipse/downloads/drops/R-3.1.1-200509290840/index.php
Download the nightly all eclipse plugins from: http://download.jboss.com/jbosside/builds/nightly/
Unzip the JBoss IDE nightly features/plugins directories into your 3.1.1 eclipse home
Follow the flash demo steps: http://www.jboss.com/products/seam/SeamHBTools.html
Helpful hints that aren't a big deal, but do explain why the SEAM plugins are not in JBossIDE stable yet:
Make sure you include the following jars in your project /lib directory. These jars must be added manually:
ejb3-persistence.jar - can be found at: $JBOSS_HOME\server\default\deploy\ejb3.deployer
hibernate-annotations.jar - can be found at: $JBOSS_HOME\server\default\deploy\ejb3.deployer
jboss-annotations-ejb3.jar - can be found at: $JBOSS_HOME\server\default\deploy\ejb3.deployer
jboss-ejb3x.jar - can be found at: $JBOSS_HOME\server\default\deploy\ejb3.deployer
jboss-seam.jar - can be found at: $JBOSS_SEAM_1.0BETA2_HOME
myfaces-api.jar - can be found at: $JBOSS_HOME\server\default\deploy\jbossweb-tomcat55.sar\jsf-libs
Make sure your JBoss test server supports EJB3. A quick JBoss 4.0.4 ejb3 configuration can be created via the JBossAS installer, http://jboss.sourceforge.net/jnlp/jboss-4.0.4RC1-installer.jnlp.
Make sure you change build.properties jboss.home entry
$PROJECT_HOME/resources/persistence.xml defaults to the DefaultDS and org.hibernate.dialect.HSQLDialect. You must change the entries accordingly if you've generated from a non HSQL db or jboss default datasource.
<property name="hibernate.hbm2ddl.auto" value="create-drop" /> will drop the existing tables and re-create when the EAR is deployed and drop the tables when the EAR is undeployed. You may or may not want to remove/edit this property.
Make sure that you don't use the word "test" in your reverse engineer java package name. By default, the ant EAR build task will exclude any classes that have "test" anywhere in the package name.