Added DBRefUnproxyObjectAccessHook #738
Conversation
nice, but we need some test, I will write some |
Thank you very much. I thought about doing it myself but I am not very familiar with groovy |
There is a problem with dependency management here. |
I found another problem. If I use the new DBRefUnproxyObjectAccessHook I get some strange things in MongoDB jv_snapshots:
Obviously something is wrong with the cdoID ?! Update: I pause my investigations now. |
I am not sure why this can be. I just reused an existing dependency in the new sub-project of javers. |
It looks like ObjectId, this problem is described here https://javers.org/documentation/repository-configuration/#custom-json-serialization and it's another issue to add out-of-the box support for mongo ObjectId's in JaVers. |
@joha78 I wrote a sketch of a test here https://github.com/javers/javers/pull/742/files |
I am not exactly sure about your question. As far as I know you can't observe uninitialized DBRefs proxy (interface LazyLoadingProxy). But if you call LazyLoadingProxy.getTarget() you get the fresh loaded Entity. Have a look at DefaultDbRefResolver to see how it works. Behind the scenes it is using a LazyLoadingInterceptor. |
I don't know how to update the javers/joha78-master branch.
|
ok will check it. I want to have a test and see how it fails without the new hook and how it passes with the hook. |
btw, could you please provide the second PR to javers/joha78-master branch with this test? |
I did, you should have a pull request. |
ok, I merged your second PR and made few fixes. Now I think the hook works and it's added to the starter. see https://github.com/javers/javers/pull/742/files |
merged from another branch, will be released as 4.0.0-RC5 |
This extension solves problems with MongoDBs DBRef(lazy=true) annotation