Closed Mike-the-one closed 4 years ago
I'd do another query to retrieve all images with the list of product ids. You could use a JOIN FETCH (ref), but the @OneToMany
relationship will make for a big query output I think.
Closed due to inactivity, please reopen if needed.
I am facing another problem now :-)
I have a table which stores the orders. The orders table has an 'One to Many' mapping to another table, which stores ordered item, orderItems. For each row of the orderItems, it refers to a row in the Product table. And I have another table which stores product image, the product image table has a foreign key which points to the product. How can I use JPA specifications to join the product image in the query result of the orders?
Something like:
Order -> [orderId, ... orderItems[],...] OrderItem -> [orderitemId, ... product,...] Product -> [productId, productname... ] ProductImage -> [producdImageId, .... productId...]
I am searching on Order table.
thanks!