Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 41868 invoked from network); 18 Apr 2005 20:54:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Apr 2005 20:54:06 -0000 Received: (qmail 94322 invoked by uid 500); 18 Apr 2005 20:54:05 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 94268 invoked by uid 500); 18 Apr 2005 20:54:04 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 19414 invoked by uid 99); 18 Apr 2005 19:30:28 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Message-ID: <2109482665.1113852585932.JavaMail.jira@ajax.apache.org> Date: Mon, 18 Apr 2005 21:29:45 +0200 (CEST) From: "Thomas Dudziak (JIRA)" To: ojb-dev@db.apache.org Subject: [jira] Commented: (OJB-24) Feature Request: enumerates and field conversions In-Reply-To: <1077746712.1113821265447.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/OJB-24?page=comments#action_63071 ] Thomas Dudziak commented on OJB-24: ----------------------------------- Is this similar to commons-lang's Enum types ? I regularily use them with OJB where in general this involves one FieldConversion per Enum-subtype so the target type is clearly defined and the conversion does not need more info. If not, could you add some sample code to show the usage scenario ? > Feature Request: enumerates and field conversions > ------------------------------------------------- > > Key: OJB-24 > URL: http://issues.apache.org/jira/browse/OJB-24 > Project: OJB > Type: New Feature > Components: PB-API > Versions: 1.1 CVS > Reporter: Martin Taal > Priority: Minor > > Hi, > In my model I have enumerates which are represented as a java object in memory. An enumerate java object has an int and a String value. When the owner object is persisted I want to convert the enumerate object to either the int or the string and store it in a field. When the owner object is retrieved then the primitive type database field should be translated into the enumerate object. > It seems logical to use fieldconversions to achieve this, however the field conversion interface only passes the value from the database and from this database value it can not be determined which Enumerate object should be created. This is so because different enumeratetypes can have the same value (with a different meaning). To identify which enumerate object should be created the fieldconversion interface could be extended so that also the field descriptor is passed. > This is really just a very-low-priority-nice-to-have because there are many workarounds, e.g. store the enumerate class in the field also (etc.). But maybe somebody else also requires it or this has come-up earlier or maybe field conversions are looked at anyhow for a new larger release. > gr. Martin Taal -- 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