Hibernate version: 2.1.7c
I have a situation where I am using a one-to-one mapping in a class, using the generated (native hibernate id generator on mysql) primary key of the left side of the one to one as key for the right (foreign id generator) side. My motive for doing this is that I want the right side to be lazily loaded since it is expensive to load if not really necessary( it contains a blob ). This class is declared lazy="true", and has a proxy attribute defined.
The only way I"ve found that I can get the lazy loading to work is to put constrained = "true" on the left side one-to-one property. When I do this lazy loading does work, but when I do that I can no longer insert objects of this type because hibernate tries to insert the right side object first, and doesn't have an id for the foriegn id generator. I am certain that there is a way to do this, as hibernate has not let me down yet, I'm just not clear about what I need to set to do this correctly.
Any ideas?
|