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 Patch for BrokerHelper
Date Thu, 25 Sep 2003 22:29:07 GMT
I have found somewhat of a nasty bug when using struts with OJB.

The long and the short of it, is when I am inserting new objects, my pk
field is an empty string, and that is causing OJB not to lookup a new
primary key.

I am assuming there is no problem with fixing this.

I don't know how to make a patch file, but here is what the code should look
like now:

BrokerHelper.java line 297:

protected Object getAutoIncrementValue(FieldDescriptor fd, Object obj,
Object cv)
		if ((cv == null) || ((cv instanceof Number) && (((Number)
cv).intValue() == 0)) || ((cv instanceof String) && (((String) cv).length()

The only change I made was to check if the cv object passed in was a String,
to make sure it's length was >0, to ensure a non-empty string.

I hope this is acceptable, and in a format for it to be committed to CVS.

Please email back if there is any problems.


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