Хорошо, как указывало duffymo , конфигурация была неправильной.
@Bean
public LocalSessionFactoryBean getSessionFactory () {
LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean ();
Properties props = new Properties();
// Setting JDBC properties
props.put(DRIVER, env.getProperty("driver"));
props.put(URL, env.getProperty("jdbcUrl"));
props.put(USER, env.getProperty("username"));
props.put(PASS, env.getProperty("password"));
// Setting Hibernate properties
props.put(SHOW_SQL, env.getProperty("hibernate.show_sql"));
props.put(HBM2DDL_AUTO, env.getProperty("hibernate.hbm2ddl.auto"));
props.put(DIALECT, env.getProperty("hibernate.dialect"));
// Setting C3P0 properties
props.put(C3P0_MIN_SIZE, env.getProperty("hibernate.c3p0.min_size"));
props.put(C3P0_MAX_SIZE, env.getProperty("hibernate.c3p0.max_size"));
props.put(C3P0_ACQUIRE_INCREMENT, env.getProperty("hibernate.c3p0.acquire_increment"));
props.put(C3P0_TIMEOUT, env.getProperty("hibernate.c3p0.timeout"));
props.put(C3P0_MAX_STATEMENTS, env.getProperty("hibernate.c3p0.max_statements"));
factoryBean.setHibernateProperties(props);
factoryBean.setAnnotatedClasses(User.class, Authorities.class, Exercise.class, ExerciseUnit.class, Routine.class, Training.class);
return factoryBean;
Я забыл установить новые объекты в:
factoryBean.setAnnotatedClasses(User.class, Authorities.class, Exercise.class, ExerciseUnit.class, Routine.class, Training.class);