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
Column -> setMethodName printer friendly version
next newest post | next oldest post
Author Messages
gumi
Private

Gender: Unspecified
Location:
Registered: Feb 2007
Status: Offline
Posts: 2

Click here to see the profile for gumi Send email to gumi Send private message to gumi Find more posts by gumi Edit or delete this message Reply w/Quote
Posted Saturday, February 17, 2007 @ 07:04:21  

Hi
My name is Mirco
I have some truble with setMethodName. I would like that the table shows only the values from the methode getValue from MeasureList class in a row.
But it dosen't work, have someone a hind for my.

Many thanks in advance.

Best regards
Mirco

public class quicktest extends JFrame {

public quick.dbtable.DBTable dBTable1 = new quick.dbtable.DBTable();
public quicktest() throws ClassNotFoundException
{
setSize(300,200);
setVisible(true);
getContentPane().add(dBTable1);

Session session =HibernateUtil.getSessionFactory().openSession();

List<MeasureList> valueList = session.createCriteria(MeasureList.class).list();

//invert row to column
Vector rowVector = new Vector();
Vector columnVector = new Vector();
columnVector.addAll(valueList);
rowVector.add(columnVector);

try {
String methodName = "getValue";
Column col = null;
dBTable1.refresh(rowVector);
for (int i = 1; i<dBTable1.getColumnCount();i++) {
col = dBTable1.getColumn(i);
col.setMethodName(methodName);
dBTable1.addColumn(col);
}

} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

}

public static void main(String[] args) throws ClassNotFoundException
{
//create a new table frame
quicktest myframe = new quicktest();
}
}

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 Saturday, February 17, 2007 @ 08:25:15  

Hello Mirco,

Please refer to the following thread about how to use hibernate with QuickTable
http://quicktable.org/discussion/cutecast/cutecast.pl?forum=3&thread=93

In order to show only "getValue"
String[] methodNames = new String[]{"getValue"};

List<MeasureList> valueList = session.createCriteria(MeasureList.class).list();
dbTable.refreshDataObject(valueList,methodNames);

gumi
Private

Gender: Unspecified
Location:
Registered: Feb 2007
Status: Offline
Posts: 2

Click here to see the profile for gumi Send email to gumi Send private message to gumi Find more posts by gumi Edit or delete this message Reply w/Quote
Posted Saturday, February 17, 2007 @ 08:59:47  

Thank for your fast replay.

I had read it bevor. may be my description of my problem was not so clear.
here is a new try.
In the database is a tabel like :
----------------------
| id | value | size |
| 1 | 30.23| XS
| 2 | 33.67| M
| 3 | 35.55| L
etc.

now I would like to put the values in one row like : 30.23| 33.67| 35.55 etc.
My solution was to put the value list into a vectors vector.

this works fine when I use

List li = session.createQuery("select value from MeasureList " +
"where id = 1 order by size").list();

, but when I ask just for MeasureList It shows my the names of the object in the cell like tes.MeasureList@234d

I just want all values in one row and not one value per row and also the values from size sould be used for the column names

It would be nice when I do one query with all information and use the query more then onse.

Many thanks
Mirco

[Edit by gumi on Saturday, February 17, 2007 @ 09:03:59]

gumi
Unregistered
Edit or delete this message Reply w/Quote
Posted Monday, February 19, 2007 @ 06:58:25  

It works. I was a bit lost in my one line of code.
Thanks

mirco

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