Attached is a simple class & unit test that demonstrates a MappingException being thrown when a java.sql.Time property is present on a castor mapped object. It appears it doesn't matter if the Time property is on a "simple" (no castor mapped properties or referenced by another class as a property) or "complex" (like my original Project, ProjectRoleAssignment) castor mapped object. Please note the hard-coded path in the database file for the Clock mapping.
--- Bruce Snyder <[EMAIL PROTECTED]> wrote:
>
> Jon Wilmoth wrote:
>
> > The class this java.sql.Time field exists in
> (Project)
> > is used as a field for another class
> > (ProjectRoleAssignment). Both class elements are
> > below:
> >
> > <class name="com.apex.chronos.app.project.Project"
> > key-generator="Project_SEQUENCE"
> > verify-constructable="true" auto-complete="true"
> > identity="id">
> > <cache-type type="unlimited" capacity="100"/>
> > <map-to table="P_PROJECTS"/>
> > <field name="id" type="long">
> > <sql name="ID" type="bigint"/>
> > </field>
> > <field name="organizationId" type="long"
> > required="true">
> > <sql name="ORGANIZATION_ID" type="bigint"/>
> > </field>
> > <field name="sponsorOrganizationId" type="long"
> > required="true">
> > <sql name="SPONSOR_ORGANIZATION_ID"
> type="bigint"/>
> > </field>
> > <field name="phases"
> > type="com.apex.chronos.app.project.Phase"
> lazy="true"
> > collection="collection">
> > <sql many-key="PROJECT_ID"/>
> > </field>
> > <field name="billingTypeId" type="long">
> > <sql name="BILLING_TYPE_ID" type="bigint"/>
> > </field>
> > <field name="name" type="string" required="true">
> > <sql name="PROJECT_NAME" type="char"/>
> > </field>
> > <field name="description" type="string">
> > <sql name="DESCRIPTION" type="char"/>
> > </field>
> > <field name="extFinanceCode" type="string">
> > <sql name="EXT_FINANCE_CODE" type="char"/>
> > </field>
> > <field name="workflowName" type="string">
> > <sql name="WORKFLOW_NAME" type="char"/>
> > </field>
> > <field name="timesheetDaysInterval"
> type="integer"
> > required="true">
> > <sql name="TIMESHEET_DAYS_INTERVAL"
> type="integer"/>
> > </field>
> > <field name="timesheetStartDayOfWeek"
> type="integer"
> > required="true">
> > <sql name="TIMESHEET_START_DAY_OF_WEEK"
> > type="integer"/>
> > </field>
> > <field name="startDate" type="java.util.Date"
> > required="true">
> > <sql name="PROJECT_START_DATE" type="date"/>
> > </field>
> > <field name="endDate" type="java.util.Date">
> > <sql name="PROJECT_END_DATE" type="date"/>
> > </field>
> > <field name="defaultEntryStartTime"
> > type="java.sql.Time" required="true">
> > <sql name="DEFAULT_ENTRY_START_TIME"
> type="time"/>
> > </field>
> > <field name="defaultEntryEndTime"
> > type="java.sql.Time" required="true">
> > <sql name="DEFAULT_ENTRY_END_TIME" type="time"/>
> > </field>
> > <field name="minEntryMinuteInterval"
> type="integer"
> > required="true">
> > <sql name="MIN_MINUTE_INTERVAL" type="integer"/>
> > </field>
> > <field name="color" type="string">
> > <sql name="COLOR" type="char"/>
> > </field>
> > <field name="configComplete" type="boolean"
> > required="true" get-method="getConfigComplete"
> > set-method="setConfigComplete">
> > <sql name="CONFIG_COMPLETE_FLAG"
> type="char[FT]"/>
> > </field>
> > <field name="projectRoleAssignments"
> >
>
type="com.apex.chronos.app.authorization.ProjectRoleAssignment"
> > lazy="true" collection="collection">
> > <sql many-key="PROJECT_ID"/>
> > </field>
> > <field name="createdById" type="long">
> > <sql name="RECORD_CREATED_BY_ID" type="bigint"/>
> > </field>
> > <field name="lastModifiedById" type="long">
> > <sql name="RECORD_LAST_MOD_BY_ID"
> type="bigint"/>
> > </field>
> > <field name="createDate"
> type="java.sql.Timestamp">
> > <sql name="RECORD_CREATE_DATE"
> type="timestamp"/>
> > </field>
> > <field name="lastModifiedDate"
> > type="java.sql.Timestamp">
> > <sql name="RECORD_LAST_MOD_DATE"
> type="timestamp"/>
> > </field>
> > </class>
> >
> > <class
> >
>
name="com.apex.chronos.app.authorization.ProjectRoleAssignment"
> > key-generator="ProjectRoleAssignment_SEQUENCE"
> > verify-constructable="true" auto-complete="true"
> > identity="id">
> > <cache-type type="unlimited" capacity="100"/>
> > <map-to table="P_PROJECTS2A_PERSONS2S_ROLES"/>
> > <field name="id" type="long">
> > <sql name="ID" type="bigint"/>
> > </field>
> > <field name="project"
> > type="com.apex.chronos.app.project.Project"
> > required="true" lazy="true">
> > <sql name="PROJECT_ID"/>
> > </field>
> > <field name="role"
> > type="com.apex.chronos.app.authorization.Role"
> > required="true" lazy="true">
> > <sql name="ROLE_ID"/>
> > </field>
> > <field name="person"
> > type="com.apex.chronos.app.party.Person"
> lazy="true">
> > <sql name="PERSON_ID"/>
> > </field>
> > <field name="startDate" type="java.util.Date"
> > required="false">
> > <sql name="BEGIN" type="date"/>
> > </field>
> > <field name="endDate" type="java.util.Date"
> > required="false">
> > <sql name="END" type="date"/>
> > </field>
> > <field name="createdById" type="long">
> > <sql name="RECORD_CREATED_BY_ID" type="bigint"/>
> > </field>
> > <field name="lastModifiedById" type="long">
> > <sql name="RECORD_LAST_MOD_BY_ID"
> type="bigint"/>
> > </field>
> > <field name="createDate"
> type="java.sql.Timestamp">
> > <sql name="RECORD_CREATE_DATE"
> type="timestamp"/>
> > </field>
> > <field name="lastModifiedDate"
> > type="java.sql.Timestamp">
> > <sql name="RECORD_LAST_MOD_DATE"
> type="timestamp"/>
> > </field>
> > </class>
>
> I'm still not quite sure why this is occurring. Can
> you post the
> smallest possible test for this that demonstrates
> the problem? I need
> the DDL file, the mapping file, the objects, the
> jdo-conf/database file
> and the build.xml to create and run it all. Please
> keep in mind that the
> idea is to keep this as stripped down as possible so
> that it is very
> small and demonstates the problem with minimal
> requirements.
>
> Bruce
> --
> perl -e 'print
>
unpack("u30","<0G)[EMAIL PROTECTED]&5R\\"F9E<G)E=\\$\\!F<FEI+F-O;0\\`\\`");'
>
> The Castor Project
> http://www.castor.org/
>
> Apache Geronimo
> http://incubator.apache.org/projects/geronimo.html
>
>
>
>
-----------------------------------------------------------
>
> If you wish to unsubscribe from this mailing, send
> mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-user
>
Clock.java
Description: Clock.java
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version 1.0//EN" "http://castor.exolab.org/jdo-conf.dtd"> <database name="unit-test.db" engine="mysql"> <driver class-name="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/SYDNEY"> <param name="user" value="castor"/> <param name="password" value="castor"/> </driver> <mapping href="C:\java\org\exolab\castor\tests\CASTOR-MAPPING-Clock.xml"/> </database>
SqlTimePropertyTest.java
Description: SqlTimePropertyTest.java
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "file:///apex/projects/internal/timeentry/extlib/mapping.dtd"> <mapping> <class name="org.exolab.castor.tests.Clock" key-generator="Clock_SEQUENCE" verify-constructable="true" auto-complete="true" identity="id"> <cache-type type="unlimited" capacity="0"/> <map-to table="CLOCK"/> <field name="id" type="long"> <sql name="ID" type="bigint"/> </field> <field name="time" type="java.sql.Time"> <sql name="CLOCK_TIME" type="time"/> </field> </class> <key-generator name="IDENTITY" alias="Clock_SEQUENCE"/> </mapping>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
