You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by bu...@apache.org on 2001/09/07 18:26:51 UTC
[DO NOT REPLY: Bug 3496] New:
Null values in related ids
PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3496
*** shadow/3496 Fri Sep 7 09:26:51 2001
--- shadow/3496.tmp.29626 Fri Sep 7 09:26:51 2001
***************
*** 0 ****
--- 1,47 ----
+ +============================================================================+
+ | Null values in related ids |
+ +----------------------------------------------------------------------------+
+ | Bug #: 3496 Product: Turbine |
+ | Status: NEW Version: 2.1 final |
+ | Resolution: Platform: PC |
+ | Severity: Normal OS/Version: Windows NT/2K |
+ | Priority: Other Component: Torque |
+ +----------------------------------------------------------------------------+
+ | Assigned To: turbine-dev@jakarta.apache.org |
+ | Reported By: dhewitt@objectivity.co.uk |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ When you create a new Torque object, based on a base Torque object, any
+ NumberKey fields it has (eg Id) will return null.
+
+ So those of us used to doing the old remoteapps
+ 'if xxx.getId() == 0'
+ to check for new objects, will have to instead use
+ 'if xxx.getId() == null'
+
+ which is fine. However, if a numberkey represented field is supposed to have a
+ null value, when that object is loaded from the database, its NumberKey field
+ will be a new NumberKey with a null value, so:
+ 'if xxx.getSomeId().getValue() == null'
+ is the check that needs to be used in this case. This is a little inconsistent,
+ and requires most checks to be:
+ 'if xxx.getSomeId() == null || xxx.getsomeId().getValue() == null'
+
+ This is inconsistent, and ideally new objects should have NumberKeys with null
+ values too.
+
+ The problem arises when a related object is optional. Using the example of
+ Prize, which has an optional Sponsor with a SponsorId NumberKey field.
+ Internally, the BasePrize *does not perform the above check* when getSponsor()
+ is called. What should happen is that, before returning the Sponsor, the
+ BasePrize checks that the sponsor_id NumberKey is not null. It should then
+ check that the value of that NumberKey is not null (which it does not). Only
+ then should it attempt to load from the database.
+
+ The result is that, if a related id field is intentionally null, any calls to
+ get[related object] result in an error message.
+
+ Dave.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org