Hello all!
I'm new in Hibernate annotations. I have a problem mapping an Entity.
Description:
I have an Entity with an EmbeddedId:
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name="uuid", column = @Column(name=PAYMENT_TRANSACTION_ID) ),
})
private EntityPK pk = new EntityPK();
This entity also has a field, that should be auto incremented by the database.
@Column(name=PAYMENT_TRANSACTION_INVOICENR, length=9, insertable=false, updatable=false, unique=true)
@Generated(value=GenerationTime.INSERT)
private int invoicenr;
The Table daclaration should be something like that:
CREATE TABLE PAYMENTTRANSACTION ( .... (other column definitions)...,
invoicenumber INT(9) NOT NULL AUTO_INCREMENT KEY) AUTO_INCREMENT = 100000000;
could somebody help me? I was trying it with:
1.-
@Generated(value=GenerationTime.INSERT)
2.-
@Column(length=9, unique=true, ...)
@GeneratedValue(strategy=GenerationType.AUTO)
but it didnt work.
greetings,
|