通过spring+hibernate返回一个collection呀。public Collection GetYgdm() throws DataAccessException {
 
return getHibernateTemplate()
.find(
""
+ "select new com.irtn.emp(ygdm,ksdm,ygxm,pydm) from emp  ");
}

解决方案 »

  1.   

    返回一个STRING型的大XML,。NET在读这个XML即可
    XML的格式是定义好的
      

  2.   

    各位高手难道就不能 发一个java 的webservice 全实例 让大家 看看嘛
      

  3.   

    啥都没有,就一个 简单的helloword ,我晕
      

  4.   

    http://blog.csdn.net/caok/archive/2008/12/29/3637734.aspx
      

  5.   

    看了,那意思 我每查询的表不同,那么就要做一个类似 Helloworld.User 的类嘛?谢谢文章打算是用spring +hibernate 实例化所用到的所有表了
    看我的这个 是不是不行呢
    public Collection<Object> getExe(String sql){
    ArrayList arrResultSet=new ArrayList();
    try{
    InputStream in = getClass().getResourceAsStream("/jdbc.properties");
    Properties properties = new Properties();
    properties.load(in);
    String driver = properties.getProperty("jdbc.driverClassName");
    String url = properties.getProperty("jdbc.url");
    String user = properties.getProperty("jdbc.username");
    String password = properties.getProperty("jdbc.password");
    Class.forName(driver);
    Connection conn=DriverManager.getConnection(url, user, password);
    ResultSet rs=conn.createStatement().executeQuery(sql);
    ResultSetMetaData rsmd=rs.getMetaData();
    int cols=rsmd.getColumnCount();
      while   (rs.next())   {   
      ArrayList row=new ArrayList();   
                      for   (int i=1;i<=cols;i++)   {   
                          String cname= rsmd.getColumnName(i);   
                          row.add(rs.getObject(cname));  
                      }   
                      arrResultSet.add(row);   
                  }
      rs.close();
    } catch (ClassNotFoundException ex) {
    ex.printStackTrace();
    } catch (SQLException ex) {
    ex.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }
    return arrResultSet;
    }
      

  6.   

    public Collection<Object> getExe(String sql){
    ArrayList arrResultSet=new ArrayList();
    try{
    InputStream in = getClass().getResourceAsStream("/jdbc.properties");
    Properties properties = new Properties();
    properties.load(in);
    String driver = properties.getProperty("jdbc.driverClassName");
    String url = properties.getProperty("jdbc.url");
    String user = properties.getProperty("jdbc.username");
    String password = properties.getProperty("jdbc.password");
    Class.forName(driver);
    Connection conn=DriverManager.getConnection(url, user, password);
    ResultSet rs=conn.createStatement().executeQuery(sql);
    ResultSetMetaData rsmd=rs.getMetaData();
    int cols=rsmd.getColumnCount();
      while   (rs.next())   {   
      ArrayList row=new ArrayList();   
                      for   (int i=1;i<=cols;i++)   {   
                          String cname= rsmd.getColumnName(i);   
                          row.add(rs.getObject(cname));  
                      }   
                      arrResultSet.add(row);   
                  }
      rs.close();
    } catch (ClassNotFoundException ex) {
    ex.printStackTrace();
    } catch (SQLException ex) {
    ex.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }
    return arrResultSet;
    }
      

  7.   

    有spring与hibernate 干吗不用呀,用JDBC这么麻烦也不好控制。
      

  8.   

    恩,也就一个简单的select 查询,在没有其他事情,用spring 是不是...太...