Tags » Hibernate

Hibernate Auditing - Base Entity and Example Entity

Add Hibernate envers dependency to your pom.xml file :


This is base entity class for enabling auditing :

public class BaseEntity implements Serializable{

    private static final long serialVersionUID = -1591130256151148932L;

    @Column(nullable = false,length = 50,updatable = false)
    private String createdBy;

    @Column(nullable = false)
    private Instant createdDate = Instant.now();

    @Column(length = 50)
    private String updatedBy;

    private Instant updatedDate = Instant.now();
} 114 more words

Hibernate exception: duplicate association path

Hibernate doesn’t provide function to check existing alias. If you try to add the same alias to the criteria, you will get exception: duplicate association path. 46 more words


How to map a @ManyToOne association using a non-Primary Key column with JPA and Hibernate

Follow @vlad_mihalcea


While answering questions on the Hibernate forum, I stumbled on the following question about using the @ManyToOne annotation when the Foreign Key column on the client side references a non-Primary Key column on the parent side. 615 more words


How to store schema-less EAV (Entity-Attribute-Value) data using JSON and Hibernate

Follow @vlad_mihalcea


One of my Twitter followers has recently asked me about a way of storing EAV (Entity-Attribute-Value) data using JPA and Hibernate, and, because this is a very good question, I decided to turn answer it using a blog post. 954 more words


Hibernate Proxies And Lazy Loading

NOTE: If you don’t know basics of hibernate, please read my another blog Here.

Introduction: Database access is very costly for an application in the terms of performance. 658 more words