Heyy;
I am developing a small swing based application with hibernate in java. And I want fill combobox from database coloumn.How ı can do that ? And I don't know in where(under initComponents, buttonActionPerformd) ı need to do.
For saving ı'am using jbutton and it's code is here :
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int idd=Integer.parseInt(jTextField1.getText());
String name=jTextField2.getText();
String description=jTextField3.getText();
Session session = null;
SessionFactory sessionFactory = new Configuration().configure()
.buildSessionFactory();
session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
try {
ContactGroup con = new ContactGroup();
con.setId(idd);
con.setGroupName(name);
con.setGroupDescription(description);
transaction.begin();
session.save(con);
transaction.commit();
} catch (Exception e) {
e.printStackTrace();
}
finally{
session.close();
}
}