3 Replies Latest reply on Nov 8, 2004 9:48 AM by Wolf-Dieter Fink

    Help on DATE format error

    Jack Ling Newbie

      Hi,


      Finally, I'm able to start JBoss with MySQL database server. But when I login to the Duke's bank example, the following error come out stating problem on DATE conversion. Pls help...:


      (code)
      Server Error
      Your request cannot be completed. The server got the following error:

      EJBException:; nested exception is: javax.ejb.EJBException: getAccountsOfCustomer: ejbLoad: Cannot convert value '2004-11-08 15:45:49' from column 6(2004-11-08 15:45:49 ) to DATE.; nested exception is: javax.ejb.EJBException: ejbLoad: Cannot convert value '2004-11-08 15:45:49' from column 6(2004-11-08 15:45:49 ) to DATE.
      (/code)


      thanks in advance,
      jackling

        • 1. Re: Help on DATE format error
          Wolf-Dieter Fink Master

          Hi,
          looks like an Configuration/Mapping or Programmers fail.

          I'm not working with MySQL.
          But it seems that the DB has a incompatible datatype.

          For more you must post the mapping (if you change) the JBoss version and a pice of your DeployDesc and code...

          • 2. Re: Help on DATE format error
            Jack Ling Newbie

            Hi,


            Thanks for your reply.
            I simply follow the Duke bank's example and didn't change anything.

            But I was compiling/packaging the programs from a Windows XP workstation and then copy the EAR file to JBoss on a Linux server. Would this make a difference (causing the problem)?

            thanks,
            jackling

            • 3. Re: Help on DATE format error
              Wolf-Dieter Fink Master

              Sorry,
              I'm not familiar with the SUN 'Duke Bankaccount' example.

              But the result of you deployment for EJB must have an ejb-jar.xml, jboss.xml and jaws.xml in the META-INF of the EJB.jar file

              ejb-jar.xml:

              <entity><ejb-name>EntityBean</eib-name>
              ....
              <cmp-field><field-name>xxxDate</field-name></cmp-field>
              

              jaws.xml:
              <entity>
               <ejb-name>EntityBean</ejb-name>
              
               <cmp-field>
               <field-name>xxxDate</field-name>
               <column-name>yyyDate</column-name>
               </cmp-field>
              


              In the .java code of AccountEJB an attribute like java.sql.Timestamp and the Table a coresponding column, see XML-files.
              Have a short look into jboss.../server/default/conf/standardjaws.xml, here you will find the mapping:
              <type-mapping-definition>
               <name>mySQL</name>
               <mapping>
               <java-type>java.util.Date</java-type>
               <jdbc-type>DATE</jdbc-type>
               <sql-type>DATETIME</sql-type>
               </mapping>
              


              I think this can be your problem ...