These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: I want 2 business object in 1 jTable
PostPosted: Wed Feb 01, 2006 11:03 am 
Newbie

Joined: Wed Feb 01, 2006 10:59 am
Posts: 2
it works with 1 with the code:

private void loadBusinessObjects() {
String eavQuery = "from Eav";

numberOfEaven = DataAccessObject.receiveHQL(eavQuery).size();
eaven = new Eav[numberOfEaven];

DataAccessObject.receiveHQL(eavQuery).toArray(eaven);


numberOfPatienten = DataAccessObject.receiveHQL(eavQuery).size();
patienten = new Patient[numberOfPatientn];

DataAccessObject.receiveHQL(patientQuery).toArray(patienten);
}

public String[][] getRowData() {

// maak rowdata met de lengte van de hoeveelheid BO en het aantal attributen = 4
String rowData[][] = new String[numberOfAfdelingen][2];

for (int i = 0; i < afdelingen.length; i++) {
rowData[i][0] = eaven[i].getEavId();
rowData[i][1] = eaven[i].getPatient().getPatientId();
}
return rowData;
}


I`ve tried a lot but it doesn`t work....

String eavQuery = "from Eav, Patient"; <-- i Think this sql statement is correct and that problem is here:

numberOfEaven = DataAccessObject.receiveHQL(eavQuery).size();
eaven = new Eav[numberOfEaven];


Last edited by kingie on Wed Feb 01, 2006 12:06 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 11:53 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
from Eav, Patient
wil return a list of array of objects
object[0] has type eav and object[1] has type patient.

Have a look at scalar queries in the reference..

Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 12:03 pm 
Newbie

Joined: Wed Feb 01, 2006 10:59 am
Posts: 2
for (int i = 0; i < eaven.length; i++) {
rowData[i][0] = eaven[i].getEavId();
rowData[i][1] = eaven[i].getAfdeling();
rowData[i][2] = patient[i].getpatient().getPatientId();
}
return rowData;
}

it gives error if I put this...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 3:17 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
You should post the exception you run into.
I assume that the method is not found, so you must cast your object.
((Patient)eaven[1]).getId

If this is not true, post your exception and your code. Please use the code tag.

Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.