Hibernate Statistics is a Hibernate class where we can back several methods that can help us to find bottlenecks. How … More
[Hibernate] – How to work with cache ?
What is cache ? To improve performance, we could then put the results of searches in some intermediate place in … More
[Hibernate] – How to work with locks ?
Problem : Imagine the situation where in a store, you need to publish daily promotions and perform editing products. … More
[Hibernate] – Increase performance using @DynamicUpdate or @DynamicInsert
When you change only the value of a single attribute of an object we know that Hibernate makes an update … More
Hibernate : How to build a primary key with annotations ?
You can use the @GeneratedValue annotation. The agreement of the strategy type that you choose this annotation will generate automatically a … More
Hibernate : How to create a unique constraint for a table with annotation ?
Annotation @Table(name = “tableName”, uniqueConstraints = @UniqueConstraint(name = “uniqueName”, columnNames = “columnName”)) Example: If you want all emails of the … More
Hibernate : How to map a list of values of one attribute ? ( @OneToMany / @ManyToOne )
If you want for example mapping the atribute State of Country entity. Any way, for ONE Country you can have MANY … More
Hibernate : How to mapping a column with a enum type class ?
Look the example and see how mapping with hibernate annotation a enum type column. Example : /** User.java**/ @Entity @Table(name … More
Hibernate : How to resolve “org.hibernate.PersistentObjectException: detached entity passed to persist” error ?
This error may occur in two situations, look below: Do you have an object and one of his attributes has … More
Hibernate : How to map boolean definitions column for postgreSQL?
@NotNull @Column(name = “column_name”, columnDefinition = “boolean default true”) private boolean columnName ;