Why does this project exist?

This project was motivated by a fundamental problem with seam-gen reverse engineering from the database. Quite simply, the strategy results in too much lost information. For example:

  • seam-gen is unable to determine that a field is an enum
  • for some database systems, seam-gen is unable to determine the temporal type for a date/time field
  • seam-gen has trouble with char fields (vs. varchar)
  • complex validation is unavailable (eg. @Length(min=3))
If you instead start with the Java model, then DDL and CRUD are simply derivations of the Java model. This approach is consistent with Domain Driven Design. Use hibernate3-maven-plugin for DDL generation, and this plugin for the CRUD generation.

In addition, this project aims to simplify using JBoss Seam by leveraging Maven.

[top]

How do I use the plugin?

Specify the plugin in your pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>net.sf.stitch</groupId>
            <artifactId>maven-stitch-plugin</artifactId>
            <configuration>
                <entityClasses>
                    <param>com.company.project.EntityClass1</param>
                    <param>com.company.project.EntityClass2</param>
               </entityClasses>
           </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.company.project</groupId>
                    <artifactId>project-model</artifactId>
                    <version>1.0-SNAPSHOT</version>
               </dependency>
           </dependencies>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>crud</goal>
                   </goals>
               </execution>
           </executions>
       </plugin>
   </plugins>
</build>
               

The entityClasses must list the classes that you want CRUD generation.

[top]

What are the plugin goals?

The following goals are available:

stitch:crud
Creates CRUD interfaces for the Entity Classes
stitch:messages
Outputs code for the message resource bundle for the Entity Classes

[top]

Can I customize the CRUD generation?

Yes, of course! There are several things that you can do:

  1. You can define your own templates instead of using the built-in templates.
  2. You can define your own properties that are made available to the template engine.
Groovy templates are used.

[top]

What other projects provided inspiration?

If you are considering this tool, you may also be interested in looking at:

  1. AppFuse is a clever tool that can be used to jump start an application. Version 2.0 includes support for Maven as well as CRUD generation. Several frameworks are supported, but not yet Seam.
  2. Taylor is a Model Driven Architecture implementation. If you like to start with UML, and generate JBoss Seam applications, check this out.

[top]