java - Hibernate to Eclipselink, PostgreSQL and UUID -
here's had write uuid working primary key, full uuid types (on ends) in hibernate. since relies on hibernate specific code, have convert code work on eclipselink?
package com.lm.model; import org.hibernate.annotations.genericgenerator; import org.hibernate.annotations.type; import javax.persistence.*; import javax.validation.constraints.notnull; import javax.validation.constraints.size; import java.util.uuid; @entity @table(name = "tasks") public class task { @id @notnull @type(type = "pg-uuid") @generatedvalue(generator = "myuuidgenerator") @genericgenerator(name = "myuuidgenerator", strategy = "uuid2") @column(name = "task_id", columndefinition = "uuid") private uuid id; @notnull @size(min = 1, max = 100) private string description; public string getdescription() { return description; } public void setdescription(final string description) { this.description = description; } public uuid getid() { return id; } public void setid(final uuid id) { this.id = id; } }
Comments
Post a Comment