Argh!!!
I found the cause:
hibernate.globally_quoted_identifiers=true
I removed this option, and all tables were created ...
In some error message I could see that sometime fields are named with
backtick and sometime not. It was because of the option that JPA could
not find the "category_id" field.
Now UniqueConstraint and JoinColumn do the job ! it's work !!!
AAaahhhh... so good.
this code compile, create tables, and the famous unique index on
(code,category_id)
@Entity
Category {
String code ;
}
@Entity
@Table(uniqueConstraints = {
@UniqueConstraint(columnNames = {"code", "category_id"})})
Categoryvalue {
@Column(name = "code")
String code ;
@ManyToOne(optional = false)
@JoinColumn(name="category_id")
Category category ;
}
Such a bad day ... The lesson is : NEVER USE
"hibernate.globally_quoted_identifiers=true"
Thanks a lot Rob !
Cheers,
Cyrille.