Return-Path: Delivered-To: apmail-db-ojb-user-archive@www.apache.org Received: (qmail 95901 invoked from network); 20 Jun 2005 09:24:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jun 2005 09:24:03 -0000 Received: (qmail 51035 invoked by uid 500); 20 Jun 2005 09:24:01 -0000 Delivered-To: apmail-db-ojb-user-archive@db.apache.org Received: (qmail 51006 invoked by uid 500); 20 Jun 2005 09:24:00 -0000 Mailing-List: contact ojb-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "OJB Users List" Reply-To: "OJB Users List" Delivered-To: mailing list ojb-user@db.apache.org Received: (qmail 50985 invoked by uid 99); 20 Jun 2005 09:23:59 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2005 02:23:55 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [213.115.149.212] (HELO manta.curalia.se) (213.115.149.212) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2005 02:23:47 -0700 Received: from manta.curalia.se (manta.curalia.se [213.115.149.212]) by manta.curalia.se (Postfix) with ESMTP id 0C1C1ABC031 for ; Mon, 20 Jun 2005 11:23:46 +0200 (CEST) Received: from [172.20.6.103] (raa-se.raa.se [193.10.40.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by manta.curalia.se (Postfix) with ESMTP id E7BE5ABC008 for ; Mon, 20 Jun 2005 11:23:45 +0200 (CEST) Message-ID: <42B68B91.50109@apache.org> Date: Mon, 20 Jun 2005 11:25:37 +0200 From: =?ISO-8859-1?Q?Martin_Kal=E9n?= Organization: ASF User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Users List Subject: [PB-API] Problem with assertValidPkForDelete and Long(0) as PK Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-AV-Checked: ClamAV using ClamSMTP X-Old-Spam-Check-By: apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Greetings, after updating my local codebase with Jakob's latest fixes for applying FieldConversion classes internally I am having problems with PB-API delete() calls. I have successfully been able to remove all work-arounds for 'manually' applying FieldConversions when reading trigger-set values back from DB and in ReportQuery result collections -- the new code simplifies PB-API usage a lot in these cases (if using FieldConversions)! However; I got stuck on the following - any hints, ideas or suggestions? I am storing an object with a composite PK where one column is allowed to contain numeric 0 values. INSERT and UPDATE are OK but DELETE fails with "Cannot delete object without valid PKs." because the check assertValidPkForDelete in BrokerHelper calls representsNull on line 482 and the Long(0) value is considered invalid... Complete invocation chain for the delete-blocking detection is: DelegatingPersistenceBroker#delete(Object) PersistenceBrokerImpl#delete(Object) PersistenceBrokerImpl#delete(Object, boolean=false) PersistenceBrokerImpl#doDelete(Object, boolean=false) BrokerHelper#assertValidPkForDelete(ClassDescriptor, Object) BrokerHelper#representsNull(FieldDescriptor, Object) The check that fails is line 273 of BrokerHelper rev 1.57.2.17, since the object field is a long (ie type=primitive) and value is instance of Number with longValue=0. IMO the representsNull definition is wrong, since 0 as PK might very well be OK. Am I overlooking something? OJB-version is from CVS, OJB_1_0_RELEASE branch and DB is Oracle9i. DDL: CREATE TABLE G ( O_ID NUMBER(14,0) NOT NULL, G_ID NUMBER(4,0) NOT NULL, ... CONSTRAINT G_PK PRIMARY KEY (GEOMETRI_ID, OBJEKT_ID) ); Repository mapping: Object fields: private long oId; private long gId; Field conversion: public class NonNullBigDecimal2longFieldConversion implements FieldConversion { public Object javaToSql(Object obj) { return obj; } public Object sqlToJava(Object o) { if (o == null) { return null; } if (o instanceof Number) { return new Long(((Number) o).longValue()); } throw new ConversionException("Error: Couldn�t convert BigDecimal to long"); } } Regards, Martin --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org For additional commands, e-mail: ojb-user-help@db.apache.org