I think problem maybe not this. I change my code to:
Code:
public class TestHiber {
static SessionFactory sf=null;
public static void main(String[] args)throws Exception {
Session s=HibernateUtil.currentSession();
Transaction t=s.beginTransaction();
java.util.List list=s.find("from Sellhouse");
t.commit();
HibernateUtil.closeSession();
}
}
It can't work too. The Exception remaind happen. The following code will throw the same exception:
Code:
Sellhouse sellhouse=(Sellhouse)session.load(Sellhouse.class,sell_id);
Why? The sell_house table can't be operated using Hibernate. If I change the code to JDBC:
Code:
String sql="select * from sell_house";
Connection conn=session.connection();
Statement stm=conn.createStatement();
ResultSet rs=stm.executeQuery(sql);
while(rs.next()){
String sell_name=rs.getString("sell_name");
String sell_date=rs.getString("sell_date");
}
Now it works well! I mean that the database is not the problem. So I think the exception will happen If I use Hibernate here. HOw to solve the problem.Why couldn't I use Hibernate here? THks!