GRoK This!

Thursday Apr 26, 2007

XDoclet, Hibernate, many-to-one lazy attribute

I mentioned earlier about how XDoclet was not generating Hibernate's "lazy" attribute for the many-to-one tag. Well, I found an easy fix. I had to download the XDoclet source code and peruse it, but after a while I understood that there's a lot more XML files than Java files, and so all I had to do was modify the correct XML file instead of changing the Java code and rebuilding XDoclet. The file you want to change is in the xdoclet-hibernate-module-1.2.3.jar file that comes with XDoclet binaries. Explode that file into some temp directory and edit the file xdoclet\modules\hibernate\resources\hibernate-properties.xdt. Find the element that has this attribute: tagName="hibernate.many-to-one". Add the following child element to it. I put it after the element that has this attribute: paramName="unique".

<XDtMethod:ifHasMethodTag tagName="hibernate.many-to-one" paramName="lazy"> lazy="<XDtMethod:methodTagValue tagName="hibernate.many-to-one" paramName="lazy" values="no-proxy,proxy,false"/>" </XDtMethod:ifHasMethodTag>

Save the file and zip it back up into a jar file. I called this new jar file xdoclet-hibernate-module-1.2.3.1.jar. Use that jar file instead of the normal xdoclet-hibernate-module-1.2.3.jar file.

Comments:

Post a Comment:
  • HTML Syntax: Allowed

Calendar

Feeds

Search

Links

Navigation

Referers