Hello, im using Hibernate 3.1.2 with last version of Annotations. Im trying to use a multiple Column unique constraint. My constaint definition is:
Code:
@Table(
uniqueConstraints={@UniqueConstraint(columnNames={"techName","version"})}
)
where version is a field that are in a Composite class.
Code:
* Techinque Name.
*/
private String techName = null;
/**
* Version of technique.
*/
private VersionComponent version = null;
My problem is that if the version parameter is not a composite class, then all works perfectly, but if this attribute (like this case) is a composite or a foreign key, two constraits are build. Let me explain that this composite has a field called version:
Quote:
CONSTRAINT technique_techname_key UNIQUE (techname),
CONSTRAINT technique_techname_key1 UNIQUE (techname, version)
and that's a problem because using PostgreSQL 8.0, are used technique_technqme_key violation, and that's incorrect because the constraint validation must affect both fields.
Thank you very much.