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.
精彩评论