I have a project, and his DAO classes extends HibernateDaoSupport, like this:
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class SomeThingDAOImpl extends HibernateDaoSupport implements SomeThingDAO{
//methods here
}
Now, i have made the upgrade of that project, to use spring-boot and i'm using spring-data-jpa, for some reasons. But the problem is, the DAO classes are not in the Spring Application context and one exception occurs, like this:
Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
The session factory, are automatically setted up when you implements JpaRepository interface using spring data, but i can't do that, cause the project needs somethings of HibernateDaoSupport, like getSession().createSQLQuery and other things.
Here are somethings that i already have made to pass by that exceptions:
- I've made the insertion of @Repository, to that class turn into a spring bean and be scanned by application context. don't work;
The question is: How can i start my application whithout that exception and make the session factory be initiated?
Edit 1: Here are some other parts of the code:
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class SomeThingDAOImpl extends HibernateDaoSupport implements SomeThingDAO{
private static final String SQL_SELECT =
"select ............";
@Override
public User user(String name, String adress) {
User result = new User();
result.setName(name);
result.setAdress(adress);
SQLQuery query = getSession().createSQLQuery(SQL_SELECT)
.addScalar("name", Hibernate.INTEGER)
.addScalar("adress", Hibernate.STRING)
query.setString("name", name);
query.setString("adress", adress);
return result;
}