Hi,
I have been struggling with this problem long enough to ask for a little help from experts.
I have a really weird behavior but my use case is not that simple, so let me explain.
I have two opened Session on two different database (one is PostgreSQL and the other is HSQL DB) and I try to transfer my persisted objects from PostgreSQL to HSQL.
First, I cannot use the Session.replicate() because I have sequence primary key on my tables. So I have to transfer the objects manually.
Of course, objects are properly evicted before saving them in the other session.
Among the persistent classes in my data model, I have an abstract Document class which has a many-to-many relation with a Segment class.
I also have a ProtectedDocument class which extends Document an is declared persistent.
The ProtectedDocument class has all kinds of association with other classes (one-to-many, many-to-many, many-to-one) , but I only have problems when it comes to transfer the association between Document and Segment.
The link between these two entities is not always recreated, but I don't know why exactly.
The weirdest thing is that the same application code base might produce both results depending on some data which I haven't been able to isolate.
The only thing I could notice is that there is no call to the AbstractCollectionPersister.recreate() method with the Document.segments collection when I experience this bug.
Maybe it could come from a bug on the cascade='save-update' on the many-to-many association ?
Could anybody help me with this ? Any hints ?
I would definitely appreciate some help.
Regards,
Gregory
Hibernate version: 3.0.5
|