org.lds.stack.validator.NotEmptyTrimed is mispelled
---------------------------------------------------
Key: HHH-3381
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3381
Project: Hibernate3
Issue Type: Improvement
Reporter: Mike Heath
Attachments: configuration.patch, hibernatepersistence.patch
In our applications, we would like to make the "yes_no" Hibernate type the
default for all booleans. We currently use @Type("yes_no") everywhere. This is
annoying.
We could use org.hibernate.cfg.Mappings.typeDefs to set a default. Mappings.typeDefs gets
populated from org.hibernate.cfg.Configuration.typeDefs. However, Configuration.typeDefs
only gets referenced by Configuration.reset(), Configuration.createMappings(), and
AnnotationConfiguration.createExtendedMappings(). Configuration.typeDefs could be very
useful but currently it's a waste of an object reference.
Adding the following method (or something similar) to Configuration would give us a good
first step to making they typeDefs field usable and would open the door to allowing us to
make "yes_no" the default for all boolean fields:
public void addTypeDef(String className, TypeDef typeDef) {
typeDefs.put(className, typeDef)
}
Even if we had Configuration.addTypeDef, there would be now way to add a TypeDef to the
configuration before the EntityManagerFactory gets created.
org.hibernate.ejb.HibernatePersistence creates an Ejb3Configuration object (which holds a
Configuration instance) and immediately creates the EntityManagerFactory. If the call to
"new Ejb3Configuration()" were placed in a protected method, we could override
that method and there obtain the Configuration instance and invoke addTypeDef().
We currently have our own PersistenceProvider that is based on HibernatePersistence.
After we create the Ejb3Configuration instance, we use reflection to get to
Configure.typeDefs to add "yes_no" TypeDefs for "boolean" and
"java.lang.Boolean" and it works very well... except for the fact that it's
an egregious hack.
I've attached a patch for core, and a patch for entitymanager.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira