]
Andreas Joseph Krogh commented on HHH-3075:
-------------------------------------------
I cannot see how this issue is resolved. How is it possible to specify what Martin
originally suggested?:
{code}
<mappable-type class="org.joda.time.DateTime"
usertype="org.joda.time.hibernate.DateTimeType"/>
{code}
The point is to be able to register a mapping which expresses "All instances of
class=org.joda.time.DateTime should be mapped using
mapperclass=org.joda.time.hibernate.DateTimeType"
Or is this possible now and it's only me not getting it?
Should be possible to register UserTypes for known property types
(classes) in configuration
--------------------------------------------------------------------------------------------
Key: HHH-3075
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3075
Project: Hibernate Core
Issue Type: Improvement
Components: core
Environment: n/a
Reporter: Martin Probst
Assignee: Diego Plentz
Priority: Minor
Currently, when persisting primitive properties of a class that are not known to
Hibernate, there are only cumbersome ways to tell Hibernate that a certain UserType should
be used. Good example is Joda Time:
<pre>
@Entity
class MyClass {
org.joda.time.DateTime foo;
}
</pre>
.. which will result in ugly binary fields in database. Next try:
<pre>
@Entity
class MyClass {
@Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
org.joda.time.DateTime foo;
}
</pre>
That works, but now I have to specify that on all time fields of all classes. Plus
it's different types for different classes, which makes it more messy. And it's
simply a string in code, so it's fragile to refactoring, code move, etc. TypeDefs
allow a shorter handle for certain types, but don't really address the refactoring
issues.
A better way might be to allow configurations to register UserTypes for known classes.
E.g. have a configuration directive like this:
<mappable-type class="org.joda.time.DateTime"
usertype="org.joda.time.hibernate.DateTimeType"/>
This would allow the classes to stay clean from type mappings and reduce coupling between
domain objects and persistence mapping.
This might be as easy as allowing the org.hibernate.type.TypeFactory map to be extended
at configuration time.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: