You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Nathaniel Reed <na...@seastar.jpl.nasa.gov> on 2002/01/31 19:19:47 UTC
test case fails in Torque-generated code
This seems like a pretty basic case (simple object semantics) but it
seems to have gotten by testing:
Description: A data object contains a null FK reference. The getter
method for this attribute should return null. Instead it attempts to
query the database on this field, using 'null' as the primary key
criterion! The base Peer for the referenced object's class checks to
see if a Vector of exactly 1 element is returned, EVEN THOUGH THE FIELD
IS NOT REQUIRED.
Example:
FOO
-----
FOO_ID NOT NULL
FOO_DATA NOT NULL
BAR_ID (can be null) REFERENCES BAR.BAR_ID
BAR
-----
BAR_ID NOT NULL
BAR_DATA
An instance of Foo might contain FOO_DATA but a null BAR reference.
Invoking getBar() results in
SELECT * FROM BAR WHERE BAR_ID IS NULL
Which always returns 0 rows and results in an exception ("Failed to
select one and only one row").
Fix: The generated DO should simply check to see if the FK reference is
null and bypass the query.
--
Nate Reed
Physical Oceanography Distributed Active Archive Center
Jet Propulsion Laboratory (Raytheon)
nate@seanet.jpl.nasa.gov
(626) 744-5528
(626) 744-5506
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>