Reputation: 1123
I'm trying to find a solution for an architectural error and I'm not the architect :P
Is there the possibility to have two mappings for the same table in Hibernate3? The first one would have some lazy attributes set to true. The second mapping would ha some lazy attributes set to false; besides, mappings are equals. I know, it is a strange and bizarre behaviour, but the customer asks for a quick solution.
Upvotes: 2
Views: 460
Reputation: 403481
In theory, there's no reason why not, but you should be careful. The hibernate cache (session and L2 caches) will treat them as distinct, so if you manipulate the table row using both mappings in the same session, you run the risk of data loss, since hibernate won't know they're referring to the same underlying data.
Upvotes: 2
Reputation: 6231
The very quick solution would be to have 2 different classes mapped to the same table.
Upvotes: 0