Auditing in JPA which is similar to Hibernate envers - spring

Does JPA provides any specification for Auditing entities.
The issue is currently we are using Hibernate envers to audit an entity in our application.
I want to move out of this and implement a solution which is generic across ORM layer. as it is just for auditing purpose I have to use Hibernate API in my application

I don't think there is anything in the specification but... if you are using the Hibernate implementation of JPA you could likely use the Envers project with your configuration. Had a look and sure enough there is a guide to do so:
Auditing JPA entities with Hibernate Envers

A useful feature in the JPA specification for auditing is Entity Listeners.
However prior to version 2.1 you could not use injection in them. As of version 2.1 CDI is supported
Hibernate supports JPA 2.1 in version 4.3

Related

spring data jpa and jpa implementation

As we know that, spring data jpa just adds extra layer on jpa provider. Spring community provides some spring data jpa starter example here
https://spring.io/guides/gs/accessing-data-jpa/#initial
I didn't see any jpa provider used in this example, how could that happen?
Thanks
Spring boot provide jpa
For example, if you want to use Spring and JPA for database access, it is sufficient if you include spring-boot-starter-data-jpa dependency in your project.

HikariCP and Spring JPA

I was reading the documentation of Spring Boot and HikariCP and would like to integrate it to my SB app, but I got a little confused when it comes to Hikari and JPA.
I'm currently using Spring Data (spring-boot-starter-data-jpa) and my questions are: can I use HikariCP when using JPA? will it interfere on the way Hibernate connects to database? should I do some other configuration to make Hibernate using HikariCP? it wasn't really clear on documentations
There is no issue with using JPA and HikariCP together. Depending on which JPA implementation you want to use you can look around a bit more, but generally Hibernate and EclipseLink are supported. For example here is an example using the exact set of technologies you described:
HikariCP + JPA + spring-data

Spring data required hibernate or not

I have one doubt about implementation of spring data, have basic knowledge about spring data.
I understand JPA and Hibernate, how it work. Hibernate provide the implementation for JPA.
My questions, Can we work alone with Spring data to persist data in mysql or we need some provider like hibernate or toplink etc for midsize application
The structure is as follows:
Spring Data JPA
|
JPA
|
Hibernate
You need Hibernate as an JPA implementation, but from your perspective you should only see Spring Data JPA.
When designing your entities if you make sure that you use only annotations from the javax.persistence package you will not depend on one concrete JPA implementation (in this case Hibernate) but theoretically you could swap Hibernate for EclipseLink or something else.

Is JPA a specification {Eclipselink and hibernate its implementation} how is it related to spring transaction management?

I am new to the ORM and till now whatever i read on the internet , it implies that JPA as just a specification and internally we need to use either eclipselink or hibernate or any other implementation .
But i got confuse when i saw Spring transaction management in one of my application. Is spring also a implementation of JPA
Can anybody explain what what is the actual difference between JPA ,
(EclipseLink.hibernate) , Spring.
JPA is an specification for object relational mapping, coming with a whole lot of interfaces and annotations that implementations must implement and support. One of the features provided by this specification is the ability to use local transactions with the JPA API.
Hibernate and EclipseLink are implementations of this specification.
Spring is a dependency injection framework that, among other things, allows you to handle transactions in a declarative way. But it doesn't come with any actual transaction manager. It just offers a common layer of abstraction over actual transaction management systems, one of them being JPA. But it can also use JDBC transactions, or JTA transactions. You just have to configure it to use the appropriate transaction management subsystem based on your requirements and technology choices.

Spring roo and jOOQ

jOOQ should be an alternative to standard JPA. Is there any way to use it in Roo as JPA provider? Is it even possible?
The reason for this: We have Oracle database and jOOQ has quick and easy set up for connection to that database. On the other hand, Roo is very usefull tool but lacks on setting up Oracle database connection.
jOOQ doesn't implement JPA. It just happens to support a few JPA annotations, which is far from actually implementing JPA. In other words, no you cannot use jOOQ as a JPA provider in Spring Roo

Resources