[Opensource] Problem with DBMaint and the UpdateUpdate class

Kris Thompson kris.thompson at seurat.com
Thu Jul 11 10:48:23 PDT 2002


First off my database I am conntecting to is Oracle... not sure if that 
matters though.  The problem is I am going through the Expresso admin 
Security screens to update a row in a data object that I created.  Some 
of the the fields are nullable.  When I hit the update button it calls 
DBMaint which produces an SQL statement like the following


UPDATE CUSTOM_USER SET EXPUID= 4, PERSON_NAME = , PERSON_JUNK=  WHERE 
EXPIUD = 4

The problem is the PERSON_NAME =  ,   Oracle crators stating an missing 
expression error.  As a hack solution I did the following in 
com.jcorporate.expresso.services.controller.dbmaint.UpdateUpdate.java 
 (changes are in bold)


line 80   StringTokenizer stk = new StringTokenizer(allKeys, "|");
            String oneKeyFieldName = null;
            for (Iterator e = myDBObj.getKeyFieldListIterator(); 
e.hasNext(); ) {

                oneKeyFieldName = (String) e.next();
                if (!stk.hasMoreTokens()) {
                    throw new DBException("Not enough key "
                    + "field values for all key fields");
                }
                String holder = decode(stk.nextToken());
                if (holder.equals(""))
                    holder = null;
                myDBObj.setField(oneKeyFieldName, holder );
            }
            myDBObj.retrieve();

This will now create

UPDATE CUSTOM_USER SET EXPUID= 4, PERSON_NAME =null , PERSON_JUNK=null 
 WHERE EXPIUD = 4

which works.  BUT I can't imagine that I am the first person to run into 
this problem.  So, am I doing something wrong or is this fix valid?

Thanks

Kris Thompson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.jcorporate.com/pipermail/opensource/attachments/20020711/4024b8d5/attachment-0002.htm


More information about the Opensource mailing list