Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalSessionFactoryBean in Spring 3.1.0.RC1 unable to set NamingStrategy [SPR-8864] #13506

Closed
spring-projects-issues opened this issue Nov 21, 2011 · 1 comment
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 21, 2011

John Kroubalkian opened SPR-8864 and commented

org.springframework.orm.hibernate4.LocalSessionFactoryBean missing ability to set NamingStrategy (this ability is available in org.springframework.orm.hibernate3.LocalSessionFactoryBean)

Not sure if this is a bug (or by design) but since there has been no response on forum (http://forum.springsource.org/showthread.php?118079-How-to-set-namingStrategy-in-LocalSessionFactoryBean-in-Spring-3.1.0-and-hibernate-4) thought I'd post it as an issue. If this is not recommended procedure or if should be posted to another project please let me know.

Also, the Component/s section above does not include a SpringORM item.

The hibernate 3 version of LocalSessionFactoryBean (org.springframework.orm.hibernate3.LocalSessionFactoryBean) had a property of org.hibernate.cfg.NamingStrategy that could be set in xml:

<bean id="sessionFactory"
	class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
	<property name="dataSource">
		<ref bean="myDataSource" />
	</property>
	<property name="namingStrategy">
		<ref bean="myNamingStrategy" />
	</property>
        ...
</bean>

The hibernate 4 version of LocalSessionFactoryBean (org.springframework.orm.hibernate4.LocalSessionFa ctoryBean) does not have this property.

I tried using an hibernate.ejb.naming_strategy entry in the hibernateProperties property but it had no effect:

<bean id="legacy.sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
                <property name="dataSource">
                        <ref local="myDataSource" />
                </property>
                <property name="packagesToScan">
                        <list>
                        </list>
                </property>
                <property name="hibernateProperties">
                        <props>
                                <prop key="hibernate.dialect">${hibernate.legacy.dialect}</prop>
                                <prop key="hibernate.show_sql">${hibernate.legacy.show_sql}</prop>
                                <prop key="hibernate.ejb.naming_strategy">BOGUScom.my.util.NoPrefixNamingStrategy</prop>
                                <prop key="hibernate.cache.region.factory_class">${hibernate.legacy.cache.region.factory_class}</prop>
                        </props>
                </property>
</bean>

Referenced from: commits 93db3df

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 27, 2011

Juergen Hoeller commented

Good catch! We've added a corresponding "namingStrategy" property to the Hibernate 4 LocalSessionFactoryBean variant for Spring 3.1 RC2 (which is scheduled for immediate release).

Juergen

@spring-projects-issues spring-projects-issues added type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.1 RC2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants