The type LocalSessionFactoryBean is deprecated

2.6k views Asked by At

I am using spring-boot 1.4.2 for my simple project.When i insert LocalSessionFactoryBean to the database configuration class then it show "The type LocalSessionFactoryBean is deprecated".Is this spring-boot version problem.I'm tried to find that.But i couldn't find clear answer for this.Please help me. enter image description here

3

There are 3 answers

0
abaghel On

spring-boot-1.4.2.RELEASE will fetch spring-orm-4.3.4.RELEASE.jar if you have spring-boot-starter-data-jpa in your pom.xml. If you check spring-orm jar file, it bundles org.springframework.orm.hibernate3, org.springframework.orm.hibernate4 and org.springframework.orm.hibernate5 packages for hiberante orm. From these packages org.springframework.orm.hibernate3.LocalSessionFactoryBean is deprecated. You can check the details here. For LocalSessionFactoryBean for hibernate4 see here and for hibernate5 see here.

0
ad3bay0 On

You have that warning because you imported org.springframework.orm.hibernate3.LocalSessionFactoryBean into your class. deprecated warning snapshot

To get rid of the deprecated warning import either org.springframework.orm.hibernate4.LocalSessionFactoryBean or org.springframework.orm.hibernate5.LocalSessionFactoryBean into your class. deprecated warning gone snapshot

0
zygimantus On

Check your imports, it should be:

import org.springframework.orm.hibernate4.LocalSessionFactoryBean;

or this one:

import org.springframework.orm.hibernate5.LocalSessionFactoryBean;