Thanks for your reply Rahul. Specifying the handler class in the inline parameter map works (I was using the fully qualified class name so I guess the typeAlias was not required).
I'm perplexed that reading types from the database worked using the globally- registered typehandler, but writing to the database didn't. --john ----- Original Message ----- From: Rahul Saluja <[email protected]> Date: Sunday, February 8, 2009 2:36 am Subject: RE: custom type handler w/ database-specific type > And one more thing which I forgot to mention don't forget to > declare your typehandler with alias in you sqlmapconfig file in > following manner > > <typeAlias alias="ArraysToStringTypeHandler" > type="com.hns.hss.nmf.server.log.manager.util.ArraysToStringTypeHandler" /> > > Regards > Rahul Saluja > > -----Original Message----- > From: Rob Sonke [mailto:[email protected]] > Sent: Sunday, February 08, 2009 2:53 PM > To: [email protected] > Subject: Re: custom type handler w/ database-specific type > > DO you need access to the DataSource or the Connection? > > Rob > > > John Cartwright wrote: > > I think I've worked around this problem by explicitly specifying the > > handler class w/in the in-line parameter map. > > Now I seem to have the problem of TypeHandler class needing > access to > > the DataSource... > > > > --john > > > > > > John Cartwright wrote: > >> Hello All, > >> > >> I'm trying to implement a custom type handler to support Oracle's > >> SDO_GEOMETRY type. I've got it (apparently) working for > retrieval of > >> data, but am having trouble w/ inserts into the database. Error > says:>> > >> org.springframework.jdbc.UncategorizedSQLException: SqlMapClient > >> operation; uncategorized SQLException for SQL []; SQL state [null]; > >> error code [0]; --- The error occurred in > >> gov/noaa/ngdc/mgg/ufn/Feature.xml. --- The error occurred while > >> applying a parameter map. --- Check the > >> Feature.insertShape-InlineParameterMap. --- Check the parameter > >> mapping for the 'geometry' property. --- Cause: > >> java.lang.NullPointerException; nested exception is > >> com.ibatis.common.jdbc.exception.NestedSQLException: --- The > error>> occurred in gov/noaa/ngdc/mgg/ufn/Feature.xml. --- The error > >> occurred while applying a parameter map. --- Check the > >> Feature.insertShape-InlineParameterMap. --- Check the parameter > >> mapping for the 'geometry' property. --- Cause: > >> java.lang.NullPointerException > >> > >> I'm registering a global type handler w/: > >> > >> <typeHandler > >> callback="gov.noaa.ngdc.mgg.ufn.dao.ibatis.SdoGeometryHandler" > >> javaType="com.vividsolutions.jts.geom.Geometry" > >> jdbcType="SDO_GEOMETRY" /> > >> > >> > >> and the inline parameter map for the "geometry" column uses: > >> > >> #geometry:SDO_GEOMETRY# > >> > >> > >> I've tried various other values for JDBC types: STRUCT, OTHER > >> w/o success. > >> > >> Can someone please help me understand a little better about the > >> connections between the the types in the parameter map and the > >> typehandler registration? > >> > >> Thanks! > >> > >> --john > >> > The information contained in this e-mail is private & confidential > and may also be legally privileged. If you are not the intended > recipient, please notify us, preferably by e-mail, and do not read, > copy or disclose the contents of this message to anyone. >
