hibernate持久层,java代码创建表

    xiaoxiao2023-03-25  5

    @Override     public void executeUpdate(final String sql) {         getHibernateTemplate().execute(new HibernateCallback<Boolean>() {             @SuppressWarnings("deprecation")             @Override             public Boolean doInHibernate(Session arg0) throws HibernateException,SQLException {                 java.sql.Connection scno=null;                 java.sql.PreparedStatement ps=null;                  try {                      scno=arg0.connection();                      ps=scno.prepareStatement(sql);                      return ps.execute();                 } catch (SQLException e) {                     throw e;                 }catch(HibernateException e){                     throw e;                 }finally{                     if(ps!=null){                         ps.close();                     }                     if(scno!=null){                         scno.close();                     }                 }             }         });     }
    转载请注明原文地址: https://ju.6miu.com/read-1204010.html
    最新回复(0)