View Javadoc

1   /***
2    * 
3    */
4   package hu.elte.tribus.services;
5   
6   import hu.elte.tribus.interfaces.AnsverFinder;
7   import hu.elte.tribus.model.Conversation;
8   import hu.elte.tribus.model.QA;
9   
10  import java.sql.SQLException;
11  
12  import org.hibernate.HibernateException;
13  import org.hibernate.Session;
14  import org.springframework.orm.hibernate3.HibernateCallback;
15  import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
16  
17  
18  /***
19   * @author kocka
20   *
21   */
22  public class HibernateSimplifiedAnsverFinder extends HibernateDaoSupport implements AnsverFinder{
23  
24  	public QA getQuestionAndAnsver(final String question, Conversation conversation) {
25  		return (QA) getHibernateTemplate().execute(new HibernateCallback(){
26  
27  			public Object doInHibernate(Session session) throws HibernateException, SQLException {
28  				return session.createCriteria(QA.class).list().get(0);
29  			}});
30  	}
31  
32  
33  }