Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.3.5, 1.3.6
-
Fix Version/s: 2.3-M2
-
Component/s: Configuration, Persistence
-
Labels:None
-
Environment:Spring 3.0.5 and Grails 1.3.6
Description
When using GORM outside of Grails in a traditional Spring application as specified here:
http://www.grails.org/GORM+-+StandAlone+Gorm
an application becomes completely broken when upgrading to 1.3.5 or 1.3.6 from 1.3.4 because the
naming strategy was switched from the default naming strategy to ImprovedNamingStrategy.INSTANCE
without giving the user the ability to configure it back.
This was broken by this commit:
https://github.com/grails/grails-core/commit/5171b2b61bed0bb93e4e0cf7f4f4e69663e2a6ea
Solution:
Allow a specifying a naming strategy similar to how you would do it with the spring session factory:
http://francisoud.blogspot.com/2006/03/change-hibernate-namingstrategy-from.html
e.g.:
<gorm:sessionFactory id="sessionFactory" base-package="isnotused" data-source-ref="v4DataSource"
config-location="classpath:hibernate.cfg.xml"
message-source-ref="messageSource">
<property name="namingStrategy" ref="namingStrategy"/>
</gorm:sessionFactory>
<bean id="namingStrategy" class="org.hibernate.cfg.DefaultNamingStrategy"/>
This could be implemented by setting the "naming_strategy" config property inside
GORMSessionFactoryDefinitionParser.parseGrailsApplication
such that it can be retrieved by GrailsAnnotationConfiguration.configureNamingStrategy():
Object customStrategy = grailsApplication.getConfig().get("naming_strategy");
I am aware that I can simply add @Column to every one of my properties to get my application to work again, but considering I have over 100 domain classes with at least 10 properties each, this becomes a serious blocker for me.
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Actually, adding @Column to the domain classes wouldnt fix it, because that doesnt work either (the annotated column name doesnt work)!
I presume this is caused by the same issue, at any rate, I had to roll back to 1.3.1 to get my annotated java classes to work