Hmmm, there's probably a business reason why you want redundant product_name data in both tables. Since you have a fk relationship to Product, then you have product_name from the Product table.
But, to answer your question:
Two scenarios - insert and update
If you are inserting/creating an OrderLine and assigning an existing Product then assign OrderLine.productName like this (pseudo-code):
Code:
setProductName(theNameOfYourProductInstance.getProductName());
If you are updating an existing OrderLine then you can use your hierarchy and reach into product like this:
Code:
setProductName(orderline.product.getProductName());
Quote:
Don't reach too far or you'll break all kinds of pragmatic programming rules :-).
I don't think you can map something like this because product_name is not part of the relational hierarchy. <overkill>You could probably use a db trigger to do it </overkill>