Posts

Showing posts with the label hibernate

Disable creation of _AUD tables with Hibernate Envers for entities?

Disable creation of _AUD tables with Hibernate Envers for entities? How to disable creation of _AUD tables with Hibernate Envers for entities ? I want do custom audit just by using the AuditListeners instead of allowing control to Hibernate to create tables. 1 Answer 1 Short answer: just do not mark your entities with @Audited annotation. @Audited Long one: you're probably mixing these concepts. Envers has nothing to do with EntityListeners , that is a hibernate concept. If you want to manually implement auditing you're probably don't need envers after all, just hibernate will be enough. EntityListeners By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Spring Boot JPA Lazy Fetch is not working

Spring Boot JPA Lazy Fetch is not working I have following two domain objects Suggestion and UserProfile They are mapped with each other in one to many relationship. When I fetch all suggestions using Spring Data JPA, I get corresponding user object with each suggestion objects. This result is observed even when I have set fetch as FetchType.Lazy . Following is my code: fetch FetchType.Lazy Suggestion.java @Entity @Table(name="suggestion") @JsonIgnoreProperties({"suggestionLikes"}) public class Suggestion { public Suggestion() { // TODO Auto-generated constructor stub } @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="suggestion_id") private Integer suggestionId; @Column(name="description") private String description; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="suggestion_by") private UserProfile user; //getters and setters } UserProfile.java @Entity @Table(name = "user_master") @JsonIgnoreProp...