adding sum column on jtable that is binded to a database table
I hope this is the correct thread to make this post.
I have a database application created with NetBeans very similar to this one:
Creating a Custom Java Desktop Database Application - NetBeans 6.5 Tutorial
I would like to add another column on the customer (master) table that will display the sum of the orders cost that each customer has done.
I dont think I need to create another column on the database table to hold that value. I tried to create a new property on the Customer entity but it requires that this property exists in the database table as well so I removed the new property.
I also tried to change the query to
SELECT c, SUM(c.orders.price) From Customer c
and then map the sum to the appropriate column but also didnt work.
Any ideas on how I could make this work?