Best way to join, display, edit two tables as one table
posted 8 years ago
I am using the 'bind' feature of NetBeans 6.0 with a JTable (Swing) component to display and edit a Tools List. Every tool is also a 'part' (with its own serial# written on the part). If the Tools and Parts tables are joined (tools.part_id ---> parts.id), the resultant table lists the tools as well as each tool's serial#. It is possible to generate this table by calling an SQL query or a JPAQL query (the former as an inline function if you want).
The question is, what is the "best practice" way to:- - generate the table (JPAQL createQuery(), SQL createNativeQuery(), inline SQL function...) - bind the table (O/R mapping @OneToOne, @JoinColumn, JTable itself...) - display/edit the table (JTable, custom editor component built on JTable, ...)
I know this is a complex question and I'm sorry for lumping it all together. I've been learning Java since August and I'm still getting stuck on this particular issue. Any insight would be appreciated, even simple pointers. Thank you for your time.