I have been using Torque in standalone mode to generate peers and sql. The
project I'm working on has its own means of generating ID's, so I specify
idMethod="none" as an attribute for each table I define in my torque schema
file. I have run into two problems, both of which I have created workarounds
for. I would like to know if anyone else has run into the same issues.
The first problem manifests itself as a nullPointer Exception when I do an
insert. I have table/object called MyObject. I create a new MyObject obj, fill
in all its values, including the PK, and call MyObjectPeer.doInsert(obj).
MyObjectPeer.doInsert ultimately calls BaseObject.doInsert() which returns a
null for an ID. This null then gets handed to the MyObject setId method,
causing a null pointer exception. I work around this by checking for null in
MyObject.setId(). Is BaseObject supposed to return null when idMethod=none?
If so, shouldn't there be a conditional in the Peer template that leaves out
the setId() call if idMethod is "none" ?
The second problem occurs in the buildCriteria() method of the generated Peer
class. The method only inserts primary key columns into the criteria if the
object is not new. For generated ID's, this may be fine, but when I create a
new object, I want to fill in the PK column and have it inserted. So it seems
as though there should be a conditional in the Peer.vm template that handles
this properly. Without this fix, inserts fail because the PK column is not
specified, or else one insert will succeed because of a default
value, but the second insert will fail because the default value will obviously
be the same as the first one.
If other people have the same problems, I can submit patches.
-Peter
Peter Recore
Software Engineer
DMOD
[EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]