Helo, I've got this problem. I have a class say "Account" that has a single property "balance". I wold like to create two descendant class "AccountIn" with property "balanceIn" and "AccountOut" with property "balanceOut" that both inherit Account and I would like them to be related one-to-one. Finally both AccountIn and AccountOut should be mapped to the same table having the following fields:
id (PK), balanceIn, balanceOut, balance note that this is only example, that is simplified just to show some ideas, but in real world there are much more sophisticated classes that share common properties and are mapped to exactly the same database records, i.e.if AcountOut and AccountId have the same id, they share the same balance. What happens if (in hibernate) I'll do the following: Long id = new Long(1); accountIn = session.load( AccountIn.class, id); accountOut = session.load(AccountOut.class, id); accountIn.setBalance(5); accountOut.setBalance(10); Am I right that would result with locking problems? What if we assume that AccountIn and AccountOut are mutually exclusive in transactions, would that still be problems (for example) with caching? In my case the problem is that AccountIn and AccountOut have descendant classes, so it's not useful trying to merge them into a single class. Another solution would be to delegate common properties to a third one-to-one class. Of course in theory it would be also possible to intercept field access to have truly shared field storage, but I suppose it's not planned... :-) -- Mike ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel