开发者

how to use hibernate as the datasource within the JTablemodel

开发者 https://www.devze.com 2023-02-04 20:45 出处:网络
I would like to do something similar to the following (which is using jdbc as the datasource in the table model) but with hibernate.

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

精彩评论

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