Displaying data from linked tables in netbeans JTable
Posted
by
Darc
on Stack Overflow
See other posts from Stack Overflow
or by Darc
Published on 2011-11-27T07:53:09Z
Indexed on
2011/11/27
17:50 UTC
Read the original article
Hit count: 179
I have been writing in java for a few months now and have just started using netbeans.
I have spent all day today trying to work out how to connect to an SQL database and display data from 2 tables (ie display the data from from a select statement with an inner join) in a JTable. I have tried using JPQL with the following statment
SELECT j, cust.name FROM Job j JOIN j.jobnumber cust
where the job table has a field called customer that references id in the customer table. This throws the exception:
Caused by: Exception [TOPLINK-8029] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EJBQLException
Exception Description: Error compiling the query [SELECT j, cust.name FROM Job j JOIN j.jobnumber cust], line 1, column 11: invalid navigation expression [cust.name], cannot navigate expression [cust] of type [java.lang.Integer] inside a query.
at oracle.toplink.essentials.exceptions.EJBQLException.invalidNavigation(EJBQLException.java:430)
What am i doing wrong? Can anyone point me to some examples of how to make a linked table java application? I am still in the very early stages of development so a complete change is not out of the question if using a mysql database isnt the best way to go about things thanks
© Stack Overflow or respective owner