From: Mongoose on 14 Oct 2009 09:57 Hi All, I'm a beginner with Hibernate and I'm having trouble understanding how to insert dates into an Oracle database properly. In my Struts application I have my Defect Class (a portion of which is shown below). The relevant portion of my Hibernate Defect.hbm.xml is also shown below. When I fill out my .jsp and submit it . . . I get this error: "java.lang.IllegalArgumentException: Cannot invoke ....Defect.setReportdatetime - argument type mismatch" I don't understand how to do this. Can someone straighten me out? Thanks, Andy ********** Relevant part of Form Bean ************************** public class Defect extends ActionForm { //Form Bean For the Defect Entry Screen private Date reportdatetime; public Date getReportdatetime() { return reportdatetime; } public void setReportdatetime(Date reportdatetime) { this.reportdatetime = reportdatetime; } ********** Relevant part of Defect.hbm.xml ************************** <class name="Defect" table="Defect"> <id name="Defectid" type="integer" column="DEFECTID"> <generator class="native"/> </id> <property name="Reportdatetime"/> <property name="Reporteruserid"/>
From: Lew on 14 Oct 2009 10:32 Mongoose wrote: > <class name="Defect" table="Defect"> > <id name="Defectid" type="integer" column="DEFECTID"> > <generator class="native"/> > </id> > <property name="Reportdatetime"/> > <property name="Reporteruserid"/> Specify the Hibernate types in the XML, and use a lower-case first letter for property names and camel case within names... <property name="reportTime" type="timestamp" column="reportTime" /> <property name="uiserId" type="string" column="userId" /> -- Lew
From: Mongoose on 14 Oct 2009 10:53 On Oct 14, 10:32 am, Lew <l...(a)lewscanon.com> wrote: > Mongoose wrote: > > <class name="Defect" table="Defect"> > > <id name="Defectid" type="integer" column="DEFECTID"> > > <generator class="native"/> > > </id> > > <property name="Reportdatetime"/> > > <property name="Reporteruserid"/> > > Specify the Hibernate types in the XML, and use a lower-case first > letter for property names and camel case within names... > > <property name="reportTime" type="timestamp" column="reportTime" /> > <property name="uiserId" type="string" column="userId" /> > > -- > Lew Hey Lew, I added all the types to the .xml file as shown below: <class name="Defect" table="Defect"> <id name="Defectid" type="integer" column="DEFECTID"> <generator class="native"/> </id> <property name="description" type="string"/> <property name="priorityid" type="integer"/> <property name="reportdatetime" type="date"/> <property name="reporteruserid" type="integer"/> <property name="functionalareaid" type="integer"/> <property name="statusid" type="integer"/> <property name="severity" type="string"/> <property name="teamleadid" type="integer"/> <property name="detectiondatetime" type="date"/> <property name="estfixtime" type="integer"/> <property name="actfixtime" type="integer"/> <property name="statusdate" type="date"/> <property name="assignedtouserid" type="integer"/> <property name="assignedtodate" type="date"/> <property name="fixedbyuserid" type="integer"/> </class> However, I don't think the case is the root cause of the problem because when I change the ReportDateTime from a Date to a String in the Defect Class it works fine with the current case . . . . A
From: ck on 15 Oct 2009 02:42 On Oct 14, 7:53 pm, Mongoose <verygoofy...(a)gmail.com> wrote: > On Oct 14, 10:32 am, Lew <l...(a)lewscanon.com> wrote: > However, I don't think the case is the root cause of the problem > because when I change the ReportDateTime from a Date to a String in > the Defect Class it works fine with the current case . . . . As suggested by Lew, did you try using "timestamp"? -- Ck
From: Mongoose on 15 Oct 2009 12:49
On Oct 15, 2:42 am, ck <chandankuma...(a)gmail.com> wrote: > On Oct 14, 7:53 pm, Mongoose <verygoofy...(a)gmail.com> wrote: > > > On Oct 14, 10:32 am, Lew <l...(a)lewscanon.com> wrote: > > However, I don't think the case is the root cause of the problem > > because when I change the ReportDateTime from a Date to a String in > > the Defect Class it works fine with the current case . . . . > > As suggested by Lew, did you try using "timestamp"? > -- > Ck Lew/Ck, I tried to change all "date" types to "timestamp" types in the hibernate .xml file but get the same error . . . I need more information to solve this problem. Is there some logging mechanism that might provide more info . . . A |