db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clute, Andrew" <Andrew.Cl...@osn.state.oh.us>
Subject RE: Patch for BrokerHelper
Date Thu, 16 Oct 2003 21:18:10 GMT
Doesn't like .patch attachments...
 
 
here is the patch
 
 
Index: BrokerHelper.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper
.java,v
retrieving revision 1.25
diff -u -r1.25 BrokerHelper.java
--- BrokerHelper.java 18 Jul 2003 17:23:12 -0000 1.25
+++ BrokerHelper.java 16 Oct 2003 21:12:25 -0000
@@ -294,7 +294,9 @@
   */
  protected Object getAutoIncrementValue(FieldDescriptor fd, Object obj,
Object cv)
  {
-  if ((cv == null) || ((cv instanceof Number) && (((Number) cv).intValue()
== 0)))
+  if ((cv == null) || 
+     ((cv instanceof Number) && (((Number) cv).intValue() == 0)) || 
+     ((cv instanceof String) && (((String) cv).length() ==0))) 
   {
    PersistentField f = fd.getPersistentField();
    try


-----Original Message-----
From: Clute, Andrew [mailto:Andrew.Clute@osn.state.oh.us] 
Sent: Thursday, October 16, 2003 5:17 PM
To: 'ojb-dev@db.apache.org'
Subject: Patch for BrokerHelper



Attached is a patch for BrokerHelper.java. 

The change is a simple one .. When attempting to get the next
AutoIncrementValue -- if the current value is a String, the new code checks
to makes sure if the  String is of zero length it still attempts to get the
value.

Otherwise, a String of 0 length ends up becoming the PK -- which really
isn't valid. 

-Andrew 

<<BrokerHelper.patch>> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message