parent « Key « JPA Q&A

1. How to config many-to-one if maybe no key in parent table?

I have a parent table and a child table, but no foregin key exsit in database. So there are many records exist in child table but not in parent table. I config many-to-one in child table xml file. When I query data, hibernate2 throws Exception for reporting no key exist in parent table. What is the correct way to descible it ...

2. Foreign key in one table has multiple parents

I have a table called "TEST" which has column "Sample_ID" , and it can take values (ID's) from three tables "MATERIAL", "APPLIANCE", "PRODUCT", I have concrete class for all the tables, I used many to many relationship it didn't work. I know that a foreign key cannot have multiple parent key, is there any trick in hibernate where I can specify ...

3. Parent Key Dropped

/** * @hibernate.bag table="account_detail" cascade="save-update" lazy="false" * @hibernate.key column="account_id" * class="org.dlw.model.AccountDetail" */ public List getAccountDetails() { return accountDetails; }