java - How to get the Hibernate SessionFactory from org.springframework.orm.hibernate4.LocalSessionFactoryBean? -


i migrating 1 old legacy application spring. in data access layer of current legacy code, there 1 basedataaccessor. data accessor provide reference of sessionfactory through 1 method. meet delivery date, have keep structure same, , need reference of hibernate sessionfactory in basedataaccessor.

i able reference of org.springframework.orm.hibernate4.localsessionfactorybean implementing applicationcontextaware, unable convert sessionfactory. there way this?

thanks

the localsessionfactorybean creates sessionfactory:

@bean public localsessionfactorybean sessionfactory() {     localsessionfactorybean sessionfactory = new localsessionfactorybean();     sessionfactory.setdatasource(datasource());     sessionfactory.setpackagestoscan(new string[] { "my.packages" });     sessionfactory.sethibernateproperties(hibernateproperties());     return sessionfactory; } 

then can inject sessionfactory his:

@autowired sessionfactory sessionfactory; 

check this article detailed explanation.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -