openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmoulliard <cmoulli...@xpectis.com>
Subject Re: Violation of unique constraint $$: duplicate value(s) for column
Date Tue, 08 Dec 2009 08:46:26 GMT

I have set the field name with a default value in the class ProcessDefinition
but the error is still there. If I remove the annotation on the method
getName, it works !!!

    //@Column(unique = true) 
    public String getName() {
        return name;
    }

What is the solution for HSQL DB ?

Remark : Even if the reason of the message displayed in the error is that
the field null, the message displayed is not very helpfull for the user
(Violation of unique constraint $$: duplicate value(s) for column) --> must
Violation of unique constraint $$: cannot insert null value(s) for column
!!!

Regards,

Charles


Daryl Stultz wrote:
> 
> On Mon, Dec 7, 2009 at 11:37 AM, KARR, DAVID (ATTCINW)
> <dk068x@att.com>wrote:
> 
>> It doesn't make sense to have a unique constraint on a
>> NULLABLE column.
>>
> 
> I disagree. A property can be optional and be required to be unique when
> it
> is specified. In my application I have such a case. I omitted the Unique
> annotation from my class but left the constraint in the database (OpenJPA
> refused to insert null into a foreign key column). Using PostgreSQL, nulls
> are ignored regarding uniqueness.
> 
> -- 
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:daryl@6degrees.com
> 
> 

-- 
View this message in context: http://n2.nabble.com/Violation-of-unique-constraint-duplicate-value-s-for-column-tp4126767p4131234.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message