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
Aspect around methods from Spring Data repositories #47
Comments
we also need a documentaion for this: /documentation/spring-integration |
Is this issue still open? I implemented and aspect around save and delete methods on spring data mongo repositories. The aspect will write changes after save or delete was executed successfully. If you are interested in this I can try to integrate this into you code line and provide a pull request. |
Hi, issue is implemented and released but not closed due to missing documentation. Would you like to help us in testing this issue and give us some feedback? |
Hi, here you have PR in which the change came: |
I reviewed the pull request. Basically it seems that the implementation is independent from spring data repositories. If class-based annotation is used it seems that a version commit is made on ever method implemented by the given class. |
as far as I remenber there is also a method level annotation, which allow On Mon, Feb 16, 2015 at 6:58 PM, gessnerfl notifications@github.com wrote:
|
This is true but do you think that it is obvious for a library consumer that in the following example a findByName would also result in a version change? Keep in mind that if spring data repositories are used you are not able to user the default repositories out of the box as standard methods like findOne or findAll would also result in version changes.
I'm just thinking from a consumer perspective. I personally thought applying the aspect on a lower level like MongoOperations. I also decided to add the aspect to the repository as it gives more flexibility to the user. |
Well, I think we didn't tested this with spring-data, but excluding certain method name pattern (like find*) seems like a good idea. Not sure about this deep dive to MongoOperations. Javers Spring integration should work well also with other repositories, for example we are working now on JaversSQLRepository. So we would like to stay at higher level (close to the domain/repository layer). So what we can do about this default support for spring-data? Do you think you can came up with some PR for this? |
Hi
e.g: and here is test using this repo: As you can see only |
@gessnerfl give us a while, we need some time for internal discusion ... |
@gessnerfl We can add spring-data support for JaVers as follows: New class-level annotation, to be placed on standard spring-data interfaces. This annotation could be aware of spring-data naming convention and Is this solution suitable for you, do you think you could contribute to this? |
That sounds fine for me. I was just a bit confused because this ticket states support for spring data repositories but would result in a strange behavior.
|
@gessnerfl now we have a lot of things to do around sql repository, maybe you can provide some implementation of this issue? |
I will try to provide a pull request for this. For my implementation I used AspectJ but I will migrate it to an BeanPostProcessor. |
@gessnerfl, great! Give us a notice if you need some support while working on the PR (persmissions, etc). We write tests in Spock and we are crazy about TDD. Concerning object delete, you are right. Currently you commit deletion only using object instance. I'll implement a method allowing deletion by GlobalId |
javers.commitShallowDeleteById()
PR with |
@gessnerfl, thanks for contribution, new version of javers-spring-integration is released in v 1.0.7 |
No problem. Was a lot of fun for me and first time using Spock - and I really like it ;) |
As a Spring Data user i want to have aspect rounding all methods from Spring Data repositories. Aspect should call javers.commit() if arguments from join point have @JaversAuditable annotation.
The text was updated successfully, but these errors were encountered: