java - Defining database independent JPA object uid -
It turns out that the following example works when using mysql 5.x, but this is not when an oracle 10g database.
name = "id") Private long ID; @ ID @ Generated Values (strategy = GenerationType.IDENTITY) @ Column (
I tested it in Hibernate and the following exception occurs when Oracle is used:
org.hibernate.MappingException: Colloquial Identification Generation does not support
Use a database table to generate an identifier Portable way.
@ ID = Generated Values (strategy ================================= ========== If you are using schema generation then the provider will create the default table; If not, then you must specify an existing table:
@TableGenerator (name = "invabab", table = "id_ng", pkColumnName = "id_NAME", valueColumnName = "ID_VAL", pkColumnValue = "INV_GEN") @ ID @ Generated Values (generator = "invoice") @column (name = "id") Private long ID;
Comments
Post a Comment