My hibernate configuration class include following code
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
dataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
return dataSource;
}
private Properties hibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
properties.put("hibernate.hbm2ddl.auto", environment.getRequiredProperty("hibernate.hbm2ddl.auto"));
properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
return properties;
}
My package structures like this enter code here
My daoImpl class like this.
@Repository("passArrayDao")
public class PassArrayDaoImpl extends AbstractDao<Integer, Arr> implements PassArrayDao {
@Override
public void passarray(Arr arr) {
}
}
normally we user hibernate for insert update delete data no.
@Override
public Book findBookById(int id) {
return bookDao.findBookById(id);
}
@Override
public List<Book> getAllBooks() {
return bookDao.getAllBooks();
}
@Override
public List<Book> findBooksByTitle(String title) {
return bookDao.findBooksByTitle(title);
}
@Override
public void deleteBookById(int id) {
bookDao.deleteBookById(id);
}
@Override
public void updateBook(Book book) {
bookDao.updateBook(book);
}
bus now i want write insert query into daoImpl class. How I create it.