Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 93758 invoked from network); 8 Dec 2009 08:46:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Dec 2009 08:46:59 -0000 Received: (qmail 14389 invoked by uid 500); 8 Dec 2009 08:46:59 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 14306 invoked by uid 500); 8 Dec 2009 08:46:58 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 14296 invoked by uid 99); 8 Dec 2009 08:46:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Dec 2009 08:46:58 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists+1214986160035-208411@n2.nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Dec 2009 08:46:48 +0000 Received: from jim.nabble.com ([192.168.236.80]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NHviE-0005Wl-Qp for users@openjpa.apache.org; Tue, 08 Dec 2009 00:46:26 -0800 Date: Tue, 8 Dec 2009 00:46:26 -0800 (PST) From: cmoulliard To: users@openjpa.apache.org Message-ID: <1260261986826-4131234.post@n2.nabble.com> In-Reply-To: References: Subject: Re: Violation of unique constraint $$: duplicate value(s) for column MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: cmoulliard X-Virus-Checked: Checked by ClamAV on apache.org 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: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.