0
我使用Hibernate的spring mvc。我使用Hibernate编写插入,但是我找不到从我的数据库编写搜索数据的方法。我在下面的例子中插入了一个我喜欢的过程。我如何使用SessionFactory Autowired对象编写select?如何使用休眠选择数据?
我想使用Hibernate做select * from employee where username='hesh'
。
@Repository
public class EmployeeDaoImpl implements EmployeeDAO{
@Autowired
private SessionFactory sessionFactory;
@Override
public void AddEmployee(Employee employee) throws ClassNotFoundException, SQLException {
this.sessionFactory.getCurrentSession().save(employee);
}}
http://www.tutorialspoint.com/hibernate/hibernate_query_language.htm – ArunM