db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject Re: Does JPOX support PK fields of type java.sql.Date?
Date Thu, 11 Aug 2005 10:51:21 GMT
Hi Andy,

> Hi Michael,
>>for testing reasons I changed the type of a PK field from java.util.Date
>>to java.sql.Date. Running the JPOX enhancer I noticed that the declaring
>>pc class was not enhanced. After I changed the field type back to
>>java.util.Date, the pc class was enhanced properly. Does JPOX support
>>java.sql.Date for PK fields?
> Don't see why not, but then I don't see somewhere where I'd want to ;-)
>>You can easily reproduce the problem patching class
>>"org.apache.jdo.tck.pc.singlefieldidentity.PCPointSingleFieldDate": Just
>>change the import statement "import java.util.Date;" to "import
>>java.sql.Date;" and run the JPOX enhancer for application identity:
> Well if you do that you need to bear in mind that java.sql.Date is *not* by 
> default persistent (nor is it in the DFG), whereas java.util.Date is. In your 
> class you have no persistence-modifier="persistent" and so the field that you 
> want to be PK is *not* actually persistent. That's likely the issue. If you 
> look in the log from the enhancer you'll probably find something

I agree, fields of type java.sql.Date do not default to persistent, 
where fields of type java.util.Date are persistent by default.

The field is marked as primary-key field and the persistence-modifier of 
a primary-key field defaults to persistent. So we thought there is no 
need to add persistence-modifier="persistent" to the field metadata, 
when changing the type from util.Date to sql.Date.

Regards Michael


Michael Bouschen		Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de	http://www.tech.spree.de/
Tel.:++49/30/235 520-33		Buelowstr. 66			
Fax.:++49/30/2175 2012		D-10783 Berlin			

View raw message