Return-Path: Mailing-List: contact ojb-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ojb-dev@jakarta.apache.org Received: (qmail 2306 invoked by uid 98); 6 Dec 2002 13:01:47 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Received: (qmail 2276 invoked from network); 6 Dec 2002 13:01:45 -0000 Received: from daedalus.apache.org (HELO apache.org) (63.251.56.142) by nagoya.betaversion.org with SMTP; 6 Dec 2002 13:01:45 -0000 Received: (qmail 79086 invoked by uid 500); 6 Dec 2002 13:00:39 -0000 Received: (qmail 79079 invoked from network); 6 Dec 2002 13:00:38 -0000 Received: from tartarus.telenet-ops.be (195.130.132.34) by daedalus.apache.org with SMTP; 6 Dec 2002 13:00:38 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by tartarus.telenet-ops.be (Postfix) with SMTP id 8155BDC2A4 for ; Fri, 6 Dec 2002 14:00:38 +0100 (CET) Received: from case052.minervasoftcare.com (D5767A96.kabel.telenet.be [213.118.122.150]) by tartarus.telenet-ops.be (Postfix) with ESMTP id 5E0BFDBCC2 for ; Fri, 6 Dec 2002 14:00:38 +0100 (CET) Received: by CASE052 with Internet Mail Service (5.5.2653.19) id ; Fri, 6 Dec 2002 14:00:37 +0100 Message-ID: From: Frank Renaers To: "'ojb-dev@jakarta.apache.org'" Subject: small bug in PersistenceBrokerImpl - method isPKValid Date: Fri, 6 Dec 2002 14:09:02 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C29D28.A604A490" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_000_01C29D28.A604A490 Content-Type: text/plain; charset="ISO-8859-1" Hi, We decided to use in our ojb's, not primitive variables, but the corresponding wrappers (Integer, Double, ...) The usage of wrappers allows us to check for null-values in our business code. But some of our junit-tests fail for the ojb's that use composite primary keys. The reason is that the isPkValid() method returns false for a null - value (wrapper), but not for a 0 - value (primitive). ex. <> // scenario Role role3 = new RoleBean(); role3.setRoleName("projectleader"); role3.setProject(project2); role3.setPerson(person1); broker.insert(role3); --> The insert will not work, because isPkValid() returns false because the persistent fields person_id and project_id equal null. Greetings, Frank Renaers ------_=_NextPart_000_01C29D28.A604A490 Content-Type: application/octet-stream; name="RoleBean.java" Content-Disposition: attachment; filename="RoleBean.java" /* * ProjectBean.java * * Date 24/09/2002 * Copyright MinervaSoftcare N.V. 2002 - 2002, All Rights Reserved.

* * This software is the proprietary information of MinervaSoftcare N.V. . * Use is subject to license terms. */ package com.minervasoftcare.lib.ojb.bo.role; import com.minervasoftcare.lib.ojb.bo.person.Person; import com.minervasoftcare.lib.ojb.bo.project.Project; public class RoleBean implements Role { private Integer person_id; private Integer project_id; private Person person; private Project project; private String roleName; public void setRoleName(String roleName) { this.roleName = roleName; } public String getRoleName() { return roleName; } public void setPerson_id(Integer person_id) { this.person_id = person_id; } public Integer getPerson_id() { return person_id; } public Integer getProject_id() { return project_id; } public void setProject_id(Integer project_id) { this.project_id = project_id; } public Person getPerson() { return person; } public void setPerson(Person person) { this.person = person; } public void setProject(Project project) { this.project = project; } public Project getProject() { return project; } public String toString() { return("PERSON_ID:"+person_id + " PROJECT_ID:"+project_id + " ROLENAME:"+roleName); } } ------_=_NextPart_000_01C29D28.A604A490--