Falci
Falci

Reputation: 1873

Envers - Showing audit data with relationships

But all relationships are lazy, including the @ManyToOne.

I found many post about problems with @OneToMany, but this is not the case

What can I do to access these properties?

PS: I tried, but could not highlight the code.

Upvotes: 4

Views: 3521

Answers (2)

Maverick
Maverick

Reputation: 131

From version 4.x in hibernate-envers you do not need to configure the listeners. you can easily audit an entity with @Audited.

Upvotes: 0

adamw
adamw

Reputation: 8606

All relations in the objects returned by Envers are lazy, regardless if it's a one-to-many or many-to-one.

In an object, to access the related object's properties just call the getter :)

In a query, it's not possible. Joins are not supported, also regardless of the relation type. You can only constraint the id of the related entity, but not its properties.

Upvotes: 3

Related Questions