Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
I'm experiencing major performance issues when trying to audit complex objects with Javers.
I'll try to clear that with an example:
The tables would be like this:
If I audit User, Javers will try to fetch the whole person, which has another user, that has another person, and this will go on and on untill the end of the recursion. Combine that with hibernate's lazy initialization of those dependencies, and we will have a bottleneck in the transaction.
What you guys think about this?
Not really. I don't need depth control. I need no depth at all. I think the best solution would be something like: @DiffIgnore(logId = true) where it would ignore the object and just log the id. So, when I retrieve it from Mongo, I just have to lazy initialize the object fetching it by its id.
well, it could be done, think better name for this kind of annotation would be @ShallowReference
So JaVers would only log reference changes for this property but would stop building object graph from it. This ann could also work on class level.
Looks like it's not very hard to implement, maybe you could think about some contribution? I'm quite busy now with older isues waiting in the backlog ...
@bartosz - additional property for @ShallowReference could be usefull - persistIfNotExists
If true, javers should persist the referenced object (so the whole referenced object should be passed)
if false - only referenced object id. If the object does not exists in javers DB, the exception should be thrown (only @id of referenced object should be passed).
Conflicts: javers-core/src/main/java/org/javers/core/metamodel/annotation/AnnotationNamesProvider.java javers-core/src/main/java/org/javers/core/metamodel/annotation/AnnotationsNameSpace.java javers-core/src/main/java/org/javers/core/metamodel/annotation/ClassAnnotationsScanner.java javers-core/src/main/java/org/javers/core/metamodel/annotation/JPAAnnotationsNameSpace.java javers-core/src/main/java/org/javers/core/metamodel/annotation/JaversAnnotationsNamesSpace.java javers-core/src/main/java/org/javers/core/metamodel/type/ManagedClassFactory.java