开发者

how to use hibernate as the datasource within the JTablemodel

I would like to do something similar to the following (which is using jdbc as the datasource in the table model) but with hibernate. How do I go about it please? Thanks

  // Table Model
    import javax.swing.table.AbstractTableModel;
    import java.sql.*;
    import java.util.Vector;

    public class MyTableModel extends AbstractTableModel {

    Connection myConnect; // Hold the JDBC Connection
    Statement myStatement; // Will contain the SQL statement
    ResultSet myResultSet; // Conta开发者_StackOverflow社区ins the result of my SQL statement


You can do something like:

public class MyTableModel extends AbstractTableModel {
    Session mySession; // Hibernate Session, used to run queries
    String myHQL; // Will contain the HQL statement
    List<?> myResult; // Contains the result of my HQL statement

Hope I could understand you question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜