Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JaVers should not throw exceptions when a Property is added or removed to a Class which has already persisted snapshots #232

Closed
clxthomas opened this issue Oct 20, 2015 · 4 comments
Labels

Comments

@clxthomas
Copy link

@clxthomas clxthomas commented Oct 20, 2015

Hi,

comitting a class (Farm), from which a property (ownersWife) is removed (in the comitted version the property is stored), the following exception is thrown:

Exception in thread "main" JaversException: PROPERTY_NOT_FOUND JaVers runtime error - property 'ownersWife' not found in class 'de.complex.sandbox.javers.Farm'
at org.javers.core.metamodel.clazz.ManagedClass.getProperty(ManagedClass.java:73)
at org.javers.core.metamodel.object.CdoSnapshotBuilder.withChangedProperties(CdoSnapshotBuilder.java:93)
at org.javers.repository.sql.finders.CdoSnapshotObjectMapper.createObject(CdoSnapshotObjectMapper.java:51)
at org.javers.repository.sql.finders.CdoSnapshotObjectMapper.createObject(CdoSnapshotObjectMapper.java:25)
at org.polyjdbc.core.query.TransactionalQueryRunner.queryCollection(TransactionalQueryRunner.java:88)
at org.polyjdbc.core.query.TransactionalQueryRunner.queryList(TransactionalQueryRunner.java:76)
at org.javers.repository.sql.finders.CdoSnapshotFinder.queryForCdoSnapshots(CdoSnapshotFinder.java:90)
at org.javers.repository.sql.finders.CdoSnapshotFinder.getLatest(CdoSnapshotFinder.java:42)
at org.javers.repository.sql.JaversSqlRepository.getLatest(JaversSqlRepository.java:40)
at org.javers.repository.api.JaversExtendedRepository.getLatest(JaversExtendedRepository.java:100)
at org.javers.core.snapshot.GraphShadowFactory.createLatestShadow(GraphShadowFactory.java:32)
at org.javers.core.snapshot.GraphSnapshotFacade.createLatestShadow(GraphSnapshotFacade.java:22)
at org.javers.core.commit.CommitFactory.create(CommitFactory.java:76)
at org.javers.core.JaversCore.commit(JaversCore.java:61)
at de.complex.sandbox.javers.Application.main(Application.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Maybe this relates to #178? Are there some workarounds or planned fixes for that?
Thx!

@KodeMunkie
Copy link

@KodeMunkie KodeMunkie commented Nov 25, 2015

I'd like to know about this too. Other frameworks like Envers for Hibernate, as far as I know, do not do this (but don't take my word for it :) ).
It would be nice that this (and any similar cases) copied the Envers behaviour and/or attempted a best effort saving what data it has, but warn/error in the logs and/or even in the (best effort) audit record. Unless you're a bank or similar and need to prevent saves without auditing it would be nice if this option was configurable - i.e. on/off. Throwing an unchecked exception (possibly on production) may be un-necessary for systems where auditing is a secondary concern (i.e. nice to have/see who made changes but don't really require them).

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Nov 25, 2015

duplicate to #178

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Nov 25, 2015

Guys, I konw that this exception could be a bloker.
I'm working on a new feature which solves this issue. In the next JaVers version (1.4.0)
you would be able to refactor your property names (and also class names) freely.

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Dec 10, 2015

good news, JaVers 1.4.0-RC1 is ready, it gives you @TypeName annotation
and support for domain classes refactoring.
Check it out and give me feedback, does it solve your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.