db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Shea <s...@gtsdesign.com>
Subject Re: update difficulties
Date Wed, 29 Oct 2003 17:19:14 GMT
I've found some indication of what's going on, not sure if it's a bug or
not.  The key issue is that I've got multipe databases configured and
am using a non-default database.

Calling save(dbName) is converted into save(connection), and right there
the database name is lost.  The call chain builds a criteria for update
and one for select, and the select criteria's db name is explicitly set
to the default from the Base[MyClassNameHere]Peer.  Eventually the chain
reaches BasePeer.doUpdate(selectCriteria, updateValues, connection)
where the database information is pulled out of the database named in
select criteria.  So the connection is to the right database, but the
database metadata will be for the wrong database.  That's my
interpretation anyway.

Should I file a bug report or come up with a patch for this,
or am I missing something?  Also need to go back and see how it can
possibly work fine for doInsert() but not doUpdate()!

I have been unable to get a direct call to the BasePeer.doUpdate(3 args)
method working, keep getting a NPE on the following line:
    ColumnMap[] columnMaps = tempDbMap.getTable(tab).getColumns();

Now that I know why save() doesn't work, I'll start working with
BasePeer.doUpdate(3args) again.

Regards,

        Gary

[2003-10-28 22:50 -0700] Gary Shea (shea@gtsdesign.com) wrote:
> This is probably user error, but I'm having trouble with doUpdate(*).
> I have dug through the code and searched the archives to no avail.  I'm
> going to keep going in the code, but if anyone can explain this, please do!
> 
> I have used Torque to generate a schema and classes.  I do a simple
> lookup:
>         
>         Criteria criteria = new Criteria("summary");
>         criteria.addIn(TransSummaryPeer.XID, xids);
>         Collection records = TransSummaryPeer.doSelect(criteria);
> 
> and then modify a record returned in the collection using Apache BeanUtils:
> 
>         PropertyUtils.setProperty(
>             record, propName,
>             PropertyUtils.getProperty(vo, propName));
> 
> and print out the Torque object to insure that the property
> has in fact changed: it has.  Check if 'modified' is true: it is.
> Attempt to save the changes:
>        
>         record.save("summary");
> 
> Look in the mysql log, and NOTHING HAPPENED!  Nor is an exception thrown,
> unless it's being swallowed somewhere in Torque.  I am completely
> baffled.  I have yet to find a path through the code that can have no
> effect...
> 
> Interestingly, if I create a TransSummary object 'record' with an xid
> (primary key) for which there is as yet no record in the database,
> so that 'new' is true:
> 
>     record.save("summary");
> 
> works fine, storing the object into a database record.
> 
> Clues?
> 
> Thanks,
> 
>         Gary
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message