Hi!

Just "stumbled" across this "bug"/"missing feature" in the codegenerator.

If the user has defined its own UserType, e.g. DoubleStringType then the
codegenerator actually naively
assumes the property is of type DoubleStringType and not String[] (which is
the case for exactly this situation).

My suggestion for solving this is as follows:

Have the codegenerator try to instantiate each type and check if they
implements UserType. If it does, then
call getReturnedClass() and use that as an typename instead.
  - Problems: The UserType then needs to be on the classpath when the
codegenerator runs., it will "slow-down" the codegenerator and there has to
be some additional logic to figure out how the returned type should be
defined in the java file.
  - Good stuff: This will be more or less transparent for the user.

I had thought of just use an <meta> tag (as Gavin has suggested in another
context) that said it is actually this type, and not the type listed in the
hbm.xml file that should be used
 - Problems: The hbm.xml file then contains unneccesary redundant
information that has to be repeated every time the usertype is used.
 - Good stuff: It it is the simplest thing that could possibly work :)

Thus I suggest:

First add support for an extra metatag that overrules the actual type when
the codegenerator renderes the code. (This can also be used in other
situations)
Secondly add the "fancy" UserType handling :)

hmm - maybe I should just shut up and go implement it :)

/max



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to