I'm working with a legacy schema which has a table with a primary key which is also a foreign key to another table.
Product
=======
Id (PK)
Title
ProductQuantity
==========
Id(PK, FK)
Qty
I mapped the association as a one to one relationship but then batch fetching does not work. I need to use a lazy assosciation here because Product is stored in the 2nd level cache because the product data never changes but the quantity changes often. When I get a products collection, the quantities are retrieved one by one (A select for each quantity). I specified batching in the mapping but the batch capability apparently doesnt work for one-to-one associations.
Is there a way to map this with a many-to-one so that batching will work? Or is it a bug that batching doesnt work for the one-to-one?
Thanks
|