I have an error when I compile my Java code with this annotation:
@Id
@Column(name="\"idClass\"", unique=true, nullable=false, columnDefinition = "serial")
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer idClass;
with <property name="show_sql">true</property>
in debug it returns:
Hibernate: select nextval ('hibernate_sequence')
The id column is serial. Any ideas?
I've tried to compile with @Generated(GenerationTime.INSERT)
but doesn't run. Thanks.
[SOLVED]
My solution is:
@Id
@SequenceGenerator(name="IDCLASS_GENERATOR", sequenceName="\"table_idClass_seq\"", allocationSize = 1)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="IDCLASS_GENERATOR")
@Column(name="\"idClass\"")