Discussion:
[Middlegen-user] Problems with javaTypeMapper
Diego
2004-03-23 08:22:05 UTC
Permalink
Hi everyone!

I'm having problems using the Hibernate plugin
(http://www.hibernate.org/98.html).

I want middlegen to generate only non-primitive types for the hbm.xml files. As
far as I know, this can be made through the javaTypeMapper attribute of the
<hibernate> tag inside build.xml.

I created a class similar to this one:

http://cvs.middlegen.sourceforge.net/viewcvs.py/*checkout*/middlegen/middlegen/plugins/hibernate/src/middlegen/plugins/hibernate/HibernateJavaTypeMapper.java?content-type=text%2Fplain&rev=1.2

but returning always object types (just as this one does for primary keys, but
for all fields).

I've referenced my class this way in build.xml:

<hibernate
destination="${build.gen-src.dir}"
package="${name}.persistence"
genXDocletTags="true"
genIntergratedCompositeKeys="false"
javaTypeMapper="mypackage.MyTypeMapper"
/>

And I placed it inside a jar under /lib directory.

The problem is that middlegen seems to overlook it. No matter what I return in
getPreferredJavaType method, the hbm.xml files are generated always the same
way.

Middlegen finds the class, because if I remove it from the /lib directory, I get
a ClassNotFound exception when I run "ant hbm2java".

Any ideas of what am I doing wrong?

Thanks in advance.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Eivind Waaler
2004-03-24 07:18:06 UTC
Permalink
Hi, seems like a weird problem.

This seems to work with the HibernateJavaTypeMapper. You could try asking
at the hibernate tools forum, as the developer for the hibernate plugin is
more likely to answer the question there:

http://forum.hibernate.org/viewforum.php?f=6

Cheers
.eivind
Post by Diego
Hi everyone!
I'm having problems using the Hibernate plugin
(http://www.hibernate.org/98.html).
I want middlegen to generate only non-primitive types for the hbm.xml files. As
far as I know, this can be made through the javaTypeMapper attribute of the
<hibernate> tag inside build.xml.
http://cvs.middlegen.sourceforge.net/viewcvs.py/*checkout*/middlegen/middlegen/plugins/hibernate/src/middlegen/plugins/hibernate/HibernateJavaTypeMapper.java?content-type=text%2Fplain&rev=1.2
but returning always object types (just as this one does for primary keys, but
for all fields).
<hibernate
destination="${build.gen-src.dir}"
package="${name}.persistence"
genXDocletTags="true"
genIntergratedCompositeKeys="false"
javaTypeMapper="mypackage.MyTypeMapper"
/>
And I placed it inside a jar under /lib directory.
The problem is that middlegen seems to overlook it. No matter what I return in
getPreferredJavaType method, the hbm.xml files are generated always the same
way.
Middlegen finds the class, because if I remove it from the /lib directory, I get
a ClassNotFound exception when I run "ant hbm2java".
Any ideas of what am I doing wrong?
Thanks in advance.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Loading...