javapda wrote:
Here is what works:
Well.. actually my experience is that there are a lot of tweaks to do to get hibernate with maven and xdoclet. I'm using Maven 1.0.2 and Hibernate 3.0.5.
maven-hibernate-plugin last version is 1.3. This doesnot have support for 3.0. There is a diff file in their JIRA (
http://jira.codehaus.org/browse/MPHIBERNATE-14) which can be applied and maven-hibernate-plugin. The patch supports 2.0 as well as 3.0 based on the package name it finds in the classpath. Somehow, this has not been released. Alteast, there is no info in the issue tracker whether this has been added to their present code base. If this patch is not used, maven tries to get net.sf.hibernate classes during schema-export..
Now, to the xdoclet. Again, xdoclet 1.2.3 does generate 3.0 mapping files, but there are some issues. One is with the unique. If you have unique attribute set for any of the properties, it generates the attribute twice. I'm not sure if this is fixed yet, but this was the problem when I got the xdoclet 1.2.3 i think about a week back. The solution for this is to use xdoclet 1.2.2 and xdoclet-hibernate-plugin from (
http://opensource.atlassian.com/project ... e/XDT-1257). Note that this maynot support ALL the attributes of 3.0 but it works for me.
I have tested with these changes with maven. I think it should work ok with ant too. Also to generate the 3.0 mappings from hibernate, the following has to be set in maven.
maven.xdoclet.hibernatedoclet.hibernate.0.Version=3.0
There is a small price to pay for working with the cutting edge versions :)
I can update the wiki by tomorrow if you think its useful (it maynot be useful for long because I think these problems will be fixed by the xdoclet and maven-hibernate-plugin teams fast)
Also, others who have used Maven + Hibernate 3.0.5 + Xdoclet, please let me know if things can be done better.. (well because diff and path were never my forte.. )