You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by "Martin Kalén (JIRA)" <ji...@apache.org> on 2006/04/05 10:34:43 UTC

[jira] Commented: (OJB-105) Pluggable "null" definition for persistent fields

    [ http://issues.apache.org/jira/browse/OJB-105?page=comments#action_12373248 ] 

Martin Kalén commented on OJB-105:
----------------------------------

Proposed change is to factor out org.apache.ojb.broker.util.BrokerHelper#representsNull(FieldDescriptor fld, Object aValue) and delegate this to a class that implements a new interface org.apache.ojb.broker.accesslayer.NullCheck with a single method:

     /**
     * Returns wether the given object value represents 'null' for the specified field.
     * @param fld descriptor representation of the persistent field
     * @param aValue the value to check if it represents 'null' 
     * @return true if and only if aValue represents null
     */
	boolean representsNull(FieldDescriptor fld, Object aValue);

NullCheck implementation would be configurable through an attribute on the <field-descriptor/> node in repository_user.xml, with the default implementation beeing backwards compatible with the old code from BrokerHelper.

> Pluggable "null" definition for persistent fields
> -------------------------------------------------
>
>          Key: OJB-105
>          URL: http://issues.apache.org/jira/browse/OJB-105
>      Project: OJB
>         Type: New Feature

>   Components: PB-API
>     Versions: 1.0.4
>     Reporter: Martin Kalén
>     Assignee: Martin Kalén
>     Priority: Minor

>
> OJB 1.0.4 has an unflexible way of checking for "null" values, in particular in primary-/foreign-key fields, that is located in BrokerHelper. For certain use-cases it must be possible to plug in your own definition of "null", preferrably through the repository XML-mapping on the "field-descriptor" node.
> Example: a table has a single numeric column as primary key, the column is mapped to a "long" field in Java which is represented internally in OJB as java.lang.Long. Currently one cannot insert or delte a row in this table where the primary key is 0, since OJB will throw an exception declaring that all primary key fields must be non-null.
> With the possibility to plug in / change to a more relaxed "null" definition on this particular PK field, it's possible to work with 0 values for the PK in this table.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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