You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2005/01/18 04:05:27 UTC
[jira] Closed: (MPHIBERNATE-12) Adding POJO from hbm file code generation feature to plugin
Message:
The following issue has been closed.
Resolver: Felipe Leme
Date: Mon, 17 Jan 2005 10:04 PM
Paul,
I committed the changes, with one minor change: using codeGeneration instead of generated on the properties.
I also have a question for you: do you know how to setup hbm2java to add XDoclet tags (@hibernate) on the generated POJOs? I thought that would be possible, but didn't find anything on the CodeGenerator class...
-- Felipe
---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/browse/MPHIBERNATE-12
Here is an overview of the issue:
---------------------------------------------------------------------
Key: MPHIBERNATE-12
Summary: Adding POJO from hbm file code generation feature to plugin
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: maven-hibernate-plugin
Fix Fors:
1.3
Assignee:
Reporter: Paul Kearney
Created: Tue, 2 Nov 2004 4:56 PM
Updated: Mon, 17 Jan 2005 10:04 PM
Environment: N/A
Description:
I have added a feature to my local version of the hibernate plugin which I thought might be worthy of inclusion in a future version.
In the projects I work on there is a need to generate POJOs classes from hibernate hbm files and I have adapted and incorportated an old ant script into our maven-hibernate plugin to do this.
In order to add this goal all you have to do is:
1. Add the following to project.xml:
<dependency>
<groupId>hibernate-extensions</groupId>
<artifactId>hibernate-tools</artifactId>
<version>2.1.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
2.
Add the following goal to the plugin.jelly
<goal name="hibernate:hbm-code-generation" prereqs="hibernate:init" description="Generate POJOs from hbm files">
<ant:echo>Generating POJOs from hbm files</ant:echo>
<ant:fileset id="hbm.fileset" dir="${maven.hibernate.generated.input.dir}" includes="${maven.hibernate.input.includes}"/>
<ant:pathconvert property="hbm.files" refid="hbm.fileset" pathsep=" "/>
<ant:java classname="net.sf.hibernate.tool.hbm2java.CodeGenerator"
failonerror="true">
<ant:classpath>
<ant:pathelement location="${plugin.getDependencyPath('hibernate-extensions:hibernate-tools')}"/>
<ant:pathelement location="${plugin.getDependencyPath('commons-collections:commons-collections')}"/>
<ant:pathelement location="${plugin.getDependencyPath('commons-logging:commons-logging')}"/>
<ant:pathelement location="${plugin.getDependencyPath('jdom:jdom')}"/>
<ant:path refid="maven.dependency.classpath"/>
</ant:classpath>
<ant:arg value="--output=${maven.hibernate.generated.output.dir}"/>
<ant:arg line="${hbm.files}"/>
</ant:java>
</goal>
3.
Add the following properties to the plugin.properties
maven.hibernate.generated.input.dir=${maven.src.dir}/conf/hibernate
maven.hibernate.generated.output.dir=${maven.src.dir}/java
4.
Ensure that hibernate-tools-2.1.2.jar is available at ibiblio.
It should now be possible to generate POJOs from hbm files. The POJOs will be placed in the src/java directory by default.
I am in the process of carrying out Step 4 myself and will hopefully do this soon.
Hope you find this worth consideration and hopefully it can make it into a future release.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org