Thanks for your reply Rob. Yes, in this case I do need the DataSource, or more specifically the OracleConnection. The class that I'm using to convert a JTS Geometry to SDO_Geometry requires it (not quite sure why).
I was hoping to inject the DataSource using Spring, but since I don't control the creation of that typehandler class it's a little awkward. Looked like there might be a way to configure Spring using AOP, but it seemed a bit intrusive and was hoping there was a simpler way. --john ----- Original Message ----- From: Rob Sonke <[email protected]> Date: Sunday, February 8, 2009 2:22 am 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 > >> >
