5 Replies Latest reply on Oct 31, 2010 11:36 PM by kiran kumar

    Data marshalling problem with Oracle TIMESTAMP(6)

    Jerrold Eads Newbie
      Using seam gen from jboss-seam-2.1.0GA marshalls Oracle TIMESTAMP(6) to java.io.Serializable when generating entities.  This causes a failure when those objects are accessed due to not being able to deserialize them.  JBoss maps the Oracle data types via the standardjbosscmp-jdbc.xml file in this manner.
                       <mapping>
                          <java-type>java.sql.Timestamp</java-type>
                          <jdbc-type>TIMESTAMP</jdbc-type>
                          <sql-type>TIMESTAMP(9)</sql-type>
                       </mapping>
      Am I doing something wrong or is this an annomaly?
      Thanks
      Jerry
        • 1. Re: Data marshalling problem with Oracle TIMESTAMP(6)
          Jerrold Eads Newbie
          After doing some surfing I found that I needed to add a filter to the ..\jboss-seam-2.1.0.GA\seam-gen\hibernatetools\seam-gen.reveng.xml file.  So I added this filter to the file per Hibernate User Forum:
          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
          <hibernate-reverse-engineering>
               <!-- Added by JEEads to take care of TIMESTAMP mapping issue 10/31/08 -->
               <type-mapping>
                    <sql-type jdbc-type="TIMESTAMP" hibernate-type="java.sql.Timestamp" />
                    <sql-type jdbc-type="NUMERIC" hibernate-type="java.lang.Long" />
                    <sql-type jdbc-type="DECIMAL" hibernate-type="java.lang.Long" />
                    <sql-type jdbc-type="VARCHAR" length="1" not-null="true" hibernate-type="java.lang.Character" />
                    <sql-type jdbc-type="VARCHAR" length="1" hibernate-type="char" />
                    <sql-type jdbc-type="VARCHAR" hibernate-type="string" />
               </type-mapping>


            <!-- This file is intentionally generated empty by seam-gen -->
            <!-- You can add any filtering/setup you want for your app -->

          </hibernate-reverse-engineering>

          Afer updating this file and regenerating my entities I still get TIMESTAMP being converted to java.io.Serializable can someone explain to me what I a doing wrong?

          Thanks
          Jerry
          • 2. Re: Data marshalling problem with Oracle TIMESTAMP(6)
            Ingo Jobling Master

            I'm pretty sure that this is a Hibernate issue, have you tried asking this question on the user forum?

            • 3. Re: Data marshalling problem with Oracle TIMESTAMP(6)
              Jerrold Eads Newbie

              I have been on both the Hibernate Forum and this Forum today  I got the type mapping node off of the Hibernate Forum but it didn't work for TimeStamp but it did change the references for NUMERIC and DECIMAL for BigDecimal to Long.  I have to believe someone other than myself has tried to reverse engineer an Oracle database with TIMESTAMP(6) field types.  One other question when will SEAM 2.1 bue compatible with JBoss 5.0?


              Thanks for the response
              Jerry

              • 4. Re: Data marshalling problem with Oracle TIMESTAMP(6)
                Ingo Jobling Master

                Just guessing, maybe add length=6 to the mapping?

                • 5. Re: Data marshalling problem with Oracle TIMESTAMP(6)
                  kiran kumar Newbie
                  Did someone resolve this? Read in hibernate forum that a workaround would be to define a mapping for OTHER with Timesamp.
                  <sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" />