craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > Non-Database mode - Dataobjects/EJB/Hibernate/File/Array/Vector Post New Topic   Post A Reply
Can use QuickTable with Hibernate? printer friendly version
next newest post | next oldest post
Author Messages
gusbelmar
Private

Gender: Unspecified
Location:
Registered: Jun 2004
Status: Offline
Posts: 2

Click here to see the profile for gusbelmar Send email to gusbelmar Send private message to gusbelmar Find more posts by gusbelmar Edit or delete this message Reply w/Quote
Posted Sunday, June 13, 2004 @ 07:11:33  

Help me
Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Sunday, June 13, 2004 @ 20:55:40  

You can easily integrate quicktable with hibernate

To show a list of objects which are retreived using Hibernate

Session session =sessionFactory.openSession();

List allAuctions = session.createQuery("from AuctionItem").list();

dbTable.refreshDataObject(allAuctions,null);

When user modifies data in QuickTable, if you have to update the data using Hibernate, then you have to attach a DatabaseChangeListener to QuickTable and implement the DatabaseChangeListener as below

class HibernateListener extends DatabaseChangeListener
{

public boolean beforeUpdate(int row)
{

Session session =sessionFactory.openSession();
Transaction tx =session.beginTransaction();
AuctionItem item = (AuctionItem)session.get(ActionItem.class, itemId);

tx.commit();
session.close();

//get value from each cell in this row and set the value into AuctionItem
//e.g
item.setXXX(dbTable.getValueAt(row,1);

Session session2 =sessionFactory.openSession();
Transaction tx =session2.beginTransaction();
session2.update(item);
tx.commit();
session2.close();

return true;
}

public boolean beforeInsert(int row)
{
//get the objects in this row & insert using hibernate
return true;
}

public boolean beforeDelete(int row)
{
//delete this Object using hibernate

return true;

}

}

gusbelmar
Private

Gender: Unspecified
Location:
Registered: Jun 2004
Status: Offline
Posts: 2

Click here to see the profile for gusbelmar Send email to gusbelmar Send private message to gusbelmar Find more posts by gusbelmar Edit or delete this message Reply w/Quote
Posted Monday, June 14, 2004 @ 04:44:31  

tank you, i wiil do

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios