Hi Dominique, On 2 Apr 2012, at 11:00, Dominique Guardiola wrote: > I want to map some geomtry WKT fields from PostGIS with D2R > Is the configurable type mapping mentioned here [1] is now available,
No, we ended up not doing this for now, but rather tried to improve the completeness and correctness of the built-in mappings. > or should I patch D2R code to able to map some geometry PostGIS fields , as > described here [2] Yes, this is still the way to go. The way it was done in [2] unfortunately will break things on other DBs than PostGIS (and will probably even break on other PostGIS types) because it simply overrides the JDBC catch-all “Types.OTHER” type rather than checking the actual type name. After the v0.8 release I've done some refactoring to make it easier to do these extension in a clean way. So here's a better way of doing this: 0. Fork the D2RQ project on GitHub, and commit any changes to that fork. This will allow others to use your code and make improvements to it. This is also how to get changes accepted into the main D2RQ code base. 1. Add a clause for PostGIS to ConnectedDB.ensureVendorInitialized(). For this you need the JDBC product name that PostGIS uses. Run the mapping generator with the --verbose option to see it. 2. Add a new Vendor class for PostGIS to the de.fuberlin.wiwiss.d2rq.sql.vendor package. I suppose this would inherit from the PostgreSQL class already there 3. This class probably only needs one method, getDataType(), which it overrides from the superclass. It needs to handle the specific type you're interested in. You can look at the MySQL, Oracle and HSQLDB classes for some inspiration how to add these custom datatypes based on Types.XXX and actual type names. >From [2] it looks like simply treating the datatypes as a SQLCharaterString is >sufficient, but in case the datatype requires any special processing, then >again some of the MySQL-specific types defined in MySQL.java are good >examples, as are all the standard types in the >de.fuberlin.wiwiss.d2rq.sql.types package. Hope that helps, Richard > > thanks you > > > > [1] https://github.com/d2rq/d2rq/issues/39#issuecomment-3730489 > [2] > http://www.mail-archive.com/[email protected]/msg00216.html > > -- > Dominique Guardiola, QUINODE > • http://www.quinode.fr/ > • Tel : 04.27.86.84.37 > • Mob : 06.15.13.22.27 > > > > > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > d2rq-map-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ d2rq-map-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel
