¿Hibernar ni siquiera está intentando conectarse?
Hola estoy intentando aprender hibernar 4 y PRIMAVERA 3.2
pero no puedo siquiera hibernar para intentar conectarme a la base de datos que parece. Ya que deliberadamente di las credenciales incorrectas y todavía no estoy recibiendo ningún error. Intenté esto porque estaba obteniendo una excepción de puntero nulo en mi controlador que es:
@Controller
public class HibernateDemoController {
private MovieService movieService;
@RequestMapping(value="/hibernatedemo", method= RequestMethod.GET)
public String index(ModelMap map) {
//map.addAttribute("hibernate", "Hibernate with DAO");
Map model = new HashMap();
//try{
model.put ( "movies", movieService.getAllMovies() );
//}catch(Exception ex){
// model.put("movies", ex.toString());
//}
return "hibernate";
}
}
El servicio de pelicula
@Service("movieService")
@Transactional(propagation=Propagation.SUPPORTS, readOnly=true)
public class MovieServiceImpl implements MovieService {
private HibernateMovieDao movieDao;
@Override
public void addMovie(Movie movie) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<Movie> getAllMovies() {
return movieDao.getAllMovies();
}
}
La pelicula dao
@Repository("movieDao")
public class HibernateMovieDaoImpl implements HibernateMovieDao {
private SessionFactory sessionFactory;
@Autowired
public HibernateMovieDaoImpl(SessionFactory sessionFactory){
this.sessionFactory = sessionFactory;
}
@Override
public void saveMovie(Movie movie) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<Movie> getAllMovies() {
return (List<Movie>) sessionFactory.getCurrentSession().createCriteria (
Movie.class ).list();
}
}
parte de mi dispatcher-xml
<context:component-scan base-package="com.outbottle" />
<context:property-placeholder location="classpath:jdbc.properties" />
<mvc:annotation-driven />
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${database.driver}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.username}" />
<property name="password" value="${database.password}" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<!--<value>com.springmvc.model.User</value>-->
<value>com.outbottle.hellospring.entities.Movie</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${dataSource.dialect}</prop>
<prop key="hibernate.show_sql">${dataSource.show_sql}</prop>
<prop key="hibernate.connection.pool_size">${dataSource.connection.pool_size}</prop>
</props>
</property>
</bean>
<bean id="hibernatemovieDao" class="com.outbottle.hellospring.dao.impl.HibernateMovieDaoImpl" >
<constructor-arg ref="sessionFactory"/>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>'
¿Alguna idea sobre lo que me he perdido?