2 Replies Latest reply on Feb 17, 2004 5:05 PM by mandrews-flarion

    jbosscmp-jdbc.xml type-mapping limitation?

    mandrews-flarion

      this is a question (at end) about the internals of the type-mapping process:

      i've created a new type-mapping for mysql, for a custom serializable object. lets say for the sake of argument that this object just encapsulates a single 'int' field.

      currently, jboss seems to do some custom serialization of the object, and thus the sql-column type is just 'blob'. thus, i use this type mapping:

      <mapping>
       <java-type>com.companyx.MyCustomObject</java-type>
       <jdbc-type>BLOB</jdbc-type>
       <sql-type>BLOB</sql-type>
      </mapping>
      


      what i would like to do instead is:

      <mapping>
       <java-type>com.companyx.MyCustomObject</java-type>
       <jdbc-type>INTEGER</jdbc-type>
       <sql-type>INTEGER</sql-type>
      </mapping>
      


      but can't because i don't know of any way jboss could figure out the object merely encapsulate an 'int' field, and just write that integer to the table column.

      the reason i want to this is that there can then be other clients of the database, for instance perl or c++, etc etc..., which can then just read 'integers'. otherwise, the database is specific to java & jboss when there are serialized java objects in it.

      the only reason is see how this can be done is if somehow my 'MyCustomObject' implements a special interface that lets jboss marshall/unmarshall as a simple integer in the database.

      is there any such special interface to allow this sort of type-mapping customization? or is there another way to do ti?

      thanks,
      mike