Hi everybody,

I'm working under Oracle 8i.

In my repository_user.xml, i have amongst other things this class descriptor

<class-descriptor class="Object" table="objects">
   <field-descriptor name="id" column="cid" jdbc-type="INTEGER"
primarykey="true"/>
   <field-descriptor name="begin" column="cbegin" jdbc-type="DATE"
conversion="Calendar2DateFieldConversion"/>
   <field-descriptor name="end" column="cend" jdbc-type="DATE"
conversion="Calendar2DateFieldConversion"/>
</class-descriptor>

where the Calendate2DateFieldConversion looks like following :

/*
 * Created on 19 nov. 2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package MyPackage;

import java.sql.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;

import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;

/**
 * @author ghd
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class Calendar2DateFieldConversion implements FieldConversion {
        /**
         * @see FieldConversion#javaToSql(Object)
         */
        public Object javaToSql(Object source)
        {
                if (source instanceof Calendar)
                {
                        return new Date(((Calendar) source).getTimeInMillis());
                }
                else
                {
                        return source;
                }
        }

        /**
         * @see FieldConversion#sqlToJava(Object)
         */
        public Object sqlToJava(Object source)
        {
                if (source instanceof Date)
                {
                        GregorianCalendar cal = new GregorianCalendar();
                        cal.setTimeInMillis(((Date)source).getTime());
                        return cal;
                }
                else
                {
                        return source;
                }
        }
}

my problemn is that the date are stored without the hour informations under
Oracle. It works fine with SQL Server. :-(

Does somebody knows about this problem ?

Regards.

Éric


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to