<div dir="ltr"><div>i need to add a unique index to my db like this:</div><div><br></div><div>CREATE UNIQUE INDEX d_7col_uni_idx ON m.dv </div><div>(fk_id, name, coalesce(make,&#39;~~~NULL~~~&#39;), coalesce(model,&#39;~~~NULL~~~&#39;)</div><div>, coalesce(type,&#39;~~~NULL~~~&#39;), coalesce(cbo_id,-1), coalesce(pt,&#39;~~~NULL~~~&#39;))</div><div>WHERE expiration_date IS NULL;</div><div><br></div><div>i&#39;m using hbm2java to generate my java classes from the db by providing a reveng.xml file to help. adding this constraint causes the generated java code to have :</div><div><br></div><div>@Table(name=&quot;dv&quot;</div><div>, uniqueConstraints = @UniqueConstraint(columnNames={&quot;fk_id&quot;, &quot;name&quot;, &quot;(COALESCE(make, &#39;~~~NULL~~~&#39;::character varying))&quot;, &quot;(COALESCE(model, &#39;~~~NULL~~~&#39;::character varying))&quot;, &quot;(COALESCE(type, &#39;~~~NULL~~~&#39;::character varying))&quot;, &quot;(COALESCE((cbo_id)::integer, (-1)))&quot;, &quot;(COALESCE(pt, &#39;~~~NULL~~~&#39;::character varying))&quot;}) </div><div>)</div><div><br></div><div>When running my unit tests, I get an exception:</div><div><br></div><div>java.lang.NullPointerException</div><div>at org.hibernate.mapping.Constraint$ColumnComparator.compare(Constraint.java:134)</div><div><br></div><div>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? can i specify that the unique index should be skipped?</div><div><br></div><div><br></div></div>