i added a unique index to my db
CREATE UNIQUE INDEX d_7col_uni_idx ON m.dv (fk_id, name, coalesce(make,'~~~NULL~~~'), coalesce(model,'~~~NULL~~~') , coalesce(type,'~~~NULL~~~'), coalesce(cbo_id,-1), coalesce(pt,'~~~NULL~~~')) WHERE expiration_date IS NULL;
i'm using hbm2java to generate my java classes from the db by providing a reveng.xml file to help. adding this constraint causes the java code to have :
@Table(name="dv" , uniqueConstraints = @UniqueConstraint(columnNames={"fk_id", "name", "(COALESCE(make, '~~~NULL~~~'::character varying))", "(COALESCE(model, '~~~NULL~~~'::character varying))", "(COALESCE(type, '~~~NULL~~~'::character varying))", "(COALESCE((cbo_id)::integer, (-1)))", "(COALESCE(pt, '~~~NULL~~~'::character varying))"}) )
When running my unit tests, I get an exception:
java.lang.NullPointerException at org.hibernate.mapping.Constraint$ColumnComparator.compare(Constraint.java:134)
My quick thought is to just get hibernate/hbm2java to ignore that constraint and not have that annotation on the generated class. is this possible?
|