Skip to content

Add documentation on how to use the @EntityListeners annotation #163

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

Closed
wants to merge 1 commit into from

Conversation

wimdeblauwe
Copy link
Contributor

I was trying out the auditing support, but I did not get it working from the documentation alone. Luckily, I found http://www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-auditing-part-one/ that explained I neede the @EntityListeners annotation (I am not using an orm.xml). I think it would be good to add this to the official docs as well.

I was trying out the auditing support, but I did not get it working from the documentation alone. Luckily, I found http://www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-auditing-part-one/ that explained I neede the `@EntityListeners` annotation (I am not using an `orm.xml`). I think it would be good to add this to the official docs as well.
odrotbohm pushed a commit that referenced this pull request Jan 21, 2016
…annotation to enable auditing.

Added instructions to the reference documentation on how to register the AuditingEntityListener using JPA's @EntityListeners annotation.

Original pull request: #163.
odrotbohm added a commit that referenced this pull request Jan 21, 2016
Original pull request: #163.
odrotbohm pushed a commit that referenced this pull request Jan 21, 2016
…annotation to enable auditing.

Added instructions to the reference documentation on how to register the AuditingEntityListener using JPA's @EntityListeners annotation.

Original pull request: #163.
odrotbohm added a commit that referenced this pull request Jan 21, 2016
Original pull request: #163.
odrotbohm pushed a commit that referenced this pull request Jan 21, 2016
…annotation to enable auditing.

Added instructions to the reference documentation on how to register the AuditingEntityListener using JPA's @EntityListeners annotation.

Original pull request: #163.
odrotbohm added a commit that referenced this pull request Jan 21, 2016
Original pull request: #163.
@odrotbohm
Copy link
Member

That's merged, thanks!

@odrotbohm odrotbohm closed this Jan 21, 2016
@odrotbohm odrotbohm self-assigned this Jan 21, 2016
@halower
Copy link

halower commented Sep 27, 2019

I have an audit interceptor very similar to this : http://www.mkyong.com/hibernate/hibernate-interceptor-example-audit-log/

Whenever i do in my service method:


 User user = this.userRepository.findOne(id);
 user.setX(x);
 user.setY(y);
I get an audit just fine! works perfect.

But when i use a query from whithin the respository like so:

UserRepository {

   @Query("UPDATE User u SET u.password = ?2 WHERE u.id = ?1 ")
   @Modifying
   public void updatePassword(Long userId, String encodedPassword);

}  

I always thought that since spring-boot-jpa supports @query, it definitely supports auditing. However, the reality is very bad. The official documentation is not clear enough, so I have dug a big pit.,because my project is nearing the end, only to find this problem, so it is impossible to switch other ways, do not know how to solve it, or alternatives,I hope everyone can help me, I will wait for results online.

@pivotal-issuemaster
Copy link

@wimdeblauwe Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@wimdeblauwe Thank you for signing the Contributor License Agreement!

@wimdeblauwe
Copy link
Contributor Author

@halower I suggest to ask this kind of question on StackOverflow as your comment is not directly related to this PR.

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

Successfully merging this pull request may close these issues.

4 participants