play1
play1 copied to clipboard
Hibernate 5.2.x with PostgreSQL
Hi,
With the old versions of hibernate (4.x) we made a special class to associate the sequence to an id for each table. But now with hibernate 5.2.x we need to put annotation on the id to specify sequence so it breaks our generic way of associating sequence with the id for each table
Anyone went through this and have a solution?
You can use GenericModel
like this.
package models;
import org.hibernate.annotations.GenericGenerator;
import play.db.jpa.GenericModel;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
@MappedSuperclass
public class BaseModel extends GenericModel {
@Id
@GenericGenerator(name = "uuid", strategy = "uuid")
public String id;
}
Thank you for your help, but this is what I want to avoid actually, to put an annotation on every single "id"
You can extends BaseModel.
If you every table id strategy is not the same, it seems there is no good way
Okay I see, thank you, I'm going to try and let you know if it's working well