|
Re: Primitives or not: msg#00026jakarta.turbine.torque.devel
On Fri, 1 Dec 2006, Thomas Vandahl wrote: Greg Monroe wrote: There is a similar problem for primary keys. E.g. if a promitive integer is used as a primary key, the value "0" means that the object has no primary key. It is not possible to save an object with the primary key explicitly set to 0. If we do not use Jdk 1.5, two and a half possible solutions come to my mind: 1) Do not use primitives internally, but allow primitive getters and setters. This will allow the user to read in a database row where null is set for a primitive filed, but querying this field will rase an exception (this is the correct behaviour in my eyes). This also will simplify templates a little bit: there are few places where primitive columns are treated differently, and the places where a key oubject is created from a column will also be shorter. Changing the internal representation will not be visible to end users: The field itself is private and only accessible via its getters and setters. The disadvantage of this approach is its slight performance impact of boxing and unboxing every time. 2a) Disallow nullable for primitives and foreign keys. Disallow primitives at all for primary keys. 2b) Disallow nullable for primary keys. Intoduce an extra boolean whether a primary key is already set or not. Personally, I'd prefer 1), because it is the simplest possible solution. 2a) is incompatible with the current implementation (no primitive primary keys), and 2b is too complicated in my eyes. Thomas |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Non-static Peers (was: Torque 4.0 plan): 00026, Thomas Fischer |
|---|---|
| Next by Date: | Maven 2 support in 4.0 (Was: Torque 4.0 plan): 00026, Thomas Fischer |
| Previous by Thread: | Re: Primitives or not (Was: Torque 4.0 plan)i: 00026, Thomas Vandahl |
| Next by Thread: | Non-record type queries/ statements ( Was: Torque 4.0 plan): 00026, Greg Monroe |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |