Thursday, October 30, 2014

org.springframework.beans.NotWritablePropertyException: Invalid property 'sqlSessionFactory'

ERROR

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'sqlSessionFactory' of bean class [com.project.rcs.dao.LibrariesDAOImpl]: Bean property 'sqlSessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

SOLUTION
Put a sqlSessionFactory variable and getters and setters in the LibrariesDAOImpl.

public class LibrariesDAOImpl implements LibrariesDAO{
    private SqlSessionFactory sqlSessionFactory;
    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
        this.sqlSessionFactory = sqlSessionFactory;
    }

    public SqlSessionFactory getSqlSessionFactory() {
        return sqlSessionFactory;
    }
}