Re: Violation of unique constraint $$: duplicate value(s) for column

2009-12-08 Thread cmoulliard

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)
> 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:da...@6degrees.com
> 
> 

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


Re: Violation of unique constraint $$: duplicate value(s) for column

2009-12-08 Thread cmoulliard

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)
> 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:da...@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.