I've got a small project that I've completed many times in many different languages and many different frameworks. It's kind of my own
Java Pet Store if you will. I'm redoing my DAO layer to use JPA and I have a question on OneToMany. A bit of a description.
ProductType.java - This contains types of products which might be Print, Bookmark, or Note Card.
Piece.java - A Piece is like a work of art. So this might contain something like "Cautious Cougar" or "Majestic". This is typically the original piece that gets turned into the different ProductTypes.
Product.java - Product is simply the sellable product. In the past I have called this ProductDetails but I trimmed it down. So as you can see this contains a Piece, a ProductType, size, price, etc.
So, finally, my question now is with respect to the association between Piece and Product. What I do is I display the Piece as an image. Clicking the image then takes me to that Piece's Products. And like I said, the way I have it now works. What I would like to know is if this is the best/preferred/optimal way of handling this type of association.
Thanks.