I want to use an autoincrement ID for a field that is a String, like this:
@Id
@GeneratedValue(strategy = TABLE, generator = "MY_GENERATOR")
@TableGenerator(name = "NAME", table = "MY_TABLE", pkColumnName = "MY_COLUMN", pkColumnValue = "MY_REF", valueColumnName = "SOMETHING", allocationSize = 1)
@Column(name = "COL", unique = true, nullable = false, length = 3)
public String getFcvCval() {
return this.fcvCval;
}
But I get an exception of type:
org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String
I cannot change the type of the column (it needs to be String). Is there a way to map the generated Numerical ID to its String value?