This is the solution I have to get seam-gen to work on existing entities:
1) Either append the following target to the seam-gen/build.xml or just modify 
the generate-entities target:


  | <target name="generate-domain" depends="validate-project"
  |     description="Generate based on existing domain entities">
  | 
  |     <taskdef name="hibernate"
  |         classname="org.hibernate.tool.ant.HibernateToolTask">
  |         <classpath>
  |             <fileset dir="lib">
  |                 <include name="*.jar" />
  |             </fileset>
  |             <fileset dir="../hibernate/lib">
  |                 <include name="*.jar" />
  |             </fileset>
  |             <pathelement path="${driver.jar}" />
  |             <pathelement path="../jboss-seam-gen.jar" />
  |         </classpath>
  |     </taskdef>
  | 
  |     <hibernate templatepath=".">
  |         <jpaconfiguration persistenceunit="testproject" />
  |         <classpath>
  |             <pathelement path="${project.home}/dist" />
  |         </classpath>
  | 
  |         <property key="hibernatetool.util.toolclass"
  |             value="org.jboss.seam.tool.Util" />
  | 
  |         <hbmtemplate filepattern="{class-name}List.xhtml"
  |             template="view/list.xhtml.ftl"
  |             destdir="${project.home}/view" />
  |         <hbmtemplate filepattern="{class-name}.xhtml"
  |             template="view/view.xhtml.ftl"
  |             destdir="${project.home}/view" />
  |         <hbmtemplate filepattern="{class-name}.page.xml"
  |             template="view/view.page.xml.ftl"
  |             destdir="${project.home}/view" />
  |         <hbmtemplate filepattern="{class-name}Edit.xhtml"
  |             template="view/edit.xhtml.ftl"
  |             destdir="${project.home}/view" />
  |         <hbmtemplate filepattern="{class-name}Edit.page.xml"
  |             template="view/edit.page.xml.ftl"
  |             destdir="${project.home}/view" />
  |         <hbmtemplate filepattern="{package-name}/{class-name}List.java"
  |             template="src/EntityList.java.ftl"
  |             destdir="${project.home}/src" />
  |         <hbmtemplate filepattern="{class-name}List.page.xml"
  |             template="view/list.page.xml.ftl"
  |             destdir="${project.home}/view" />
  |         <hbmtemplate filepattern="{package-name}/{class-name}Home.java"
  |             template="src/EntityHome.java.ftl"
  |             destdir="${project.home}/src" />
  |         <hbmtemplate filepattern="menu.xhtml"
  |             template="view/layout/menu.xhtml.ftl"
  |             destdir="${project.home}/view/layout" />
  |     </hibernate>
  | 
  |     <taskdef name="javaformatter"
  |         classname="org.hibernate.tool.ant.JavaFormatterTask">
  |         <classpath>
  |             <fileset dir="lib">
  |                 <include name="*.jar" />
  |             </fileset>
  |         </classpath>
  |     </taskdef>
  | 
  |     <javaformatter>
  |         <fileset dir="${project.home}/src">
  |             <include name="**/*.java" />
  |         </fileset>
  |     </javaformatter>
  | 
  |     <echo
  |         message="Type 'seam restart' and go to 
http://localhost:8080/${project.name}"; />
  | 
  | </target>
  | 
2) Run 'seam setup' and 'seam new-project' to generate the project skeleton

3) create a 'dist' directory under the newly created project directory

4) copy all your compiled classes for the domain model into the 'dist' 
directory 

5) copy all your src code for the domain model into the 'src' directory under 
the newly created project directory

6) create a META-INF directory inside 'dist' directory

7) copy the persistence-dev.xml from the resources directory in the newly 
created project to the dist/META-INF directory and rename it to persistence.xml

8) Now change the persistenceunit under <jpaconfiguration .../> in the 
seam-gen/build.xml to match the persistentunit in the persistence.xml

9) download the put the javassist.jar  into your [Seam installation 
dir]/hibernate/lib  directory

10) run seam generate-domain  (or seam generate-entities if you modify the ant 
target)


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4015981#4015981

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4015981
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to