I have a table that has ID set to CREATE DEFAULT ID_Tabelas AS NEWID()
, that is, even if I use an insert without the key, it will be generated automatically. How can I do with hibernate to recognize that the database itself will generate the table key?
If I use annotations @GeneratedValue(strategy = GenerationType.AUTO)
or @GeneratedValue(strategy = GenerationType.IDENTITY)
, I get the following error:
SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (default task-17) javax.faces.el.EvaluationException: org.hibernate.AssertionFailure: null identifier
If I use annotaion @GeneratedValue(strategy = GenerationType.TABLE)
, I get the error:
SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (default task-17) javax.faces.el.EvaluationException: org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String
The ID is denoted in the entity as:
@Id
@GeneratedValue(strategy = GenerationType.AUTO) //??
@Column(name = "id", length = 36, updatable = false, nullable = false)
private String id;