-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: hbm2java skip unique constraint
PostPosted: Mon Aug 01, 2016 12:32 pm 
Newbie

Joined: Fri Oct 15, 2004 11:00 am
Posts: 4
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.