To be honest with you, I have spent considerable amount of time in understanding the associations (specially bidirectional) but still not really able to understand the basics. I could not get a simple one to many bidirectional mapping to work and I need your help in understanding the mistake and a fix.
I have two classes Stock and StockDailyRecords. (These examples are taken straightly from example. My stock class is defined as below
Similarly StockDailyRecord is as follows
My entire mapping files are as below
I'm facing two issues here
1) if I have same column in Set element of Stock and Many to One element of StockDailyRecord, I'm getting an exception
I'm not sure why I should make insert and update false here.
If I manage to change the name of the either of the columns say, from STOCK_FK_ID to STOCK_ID (Which does not make any sense to me here? Why?), I get another error
while trying to persist Stock and StockDailyRecord.
My client looks like below
create(Object) method looks as below
How do I persist both the records. When I run my client, I'm successful in persisting only Stock, but not StockDailyRecord. How do I make sure that upon persisting Stock, it should also persist StockDailyRecord without using Cascase option.
Does it make any difference in using "inverse" attribute ?