Hi,
I would like to know if there's some way to abstract how a UserType is created based on some information pulled from SessionImplementor.
My usecase is the following: I would like to store some XML data in an Oracle's XMLType column in production but would like to fallback using CLOB for testing purposes (HSQL, H2).
To store the XML, I need 2 custom UserTypes (one using Oracle's XMLType and another one using CLOBS) but how would I tell Hibernate which one to use without changing anything in my configuration files (persistence.xml as I'm using hibernate-entitymanager) and mappings?
Maybe there's some way I'm not aware of that would let met instantiate the right UserType based on the SessionImplementor. Instead of specifying the UserType I want to use, it would be nice to specify a UserTypeFactory which would have a "UserType create(SessionImplementor)" method.
There could be another solution: SessionImplementor extends LobCreationContext, maybe there could be some sort of XMLCreationContext which would take care of storing XML.
Regards,
Xavier
|