Re: adding postgresql data types

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jun 29 2004 - 12:55:01 EDT

  • Next message: Elia Morling: "Working with Transient Objects"

    Hi Tore,

    Custom types configuration is done by installing a new
    org.objectstyle.access.types.ExtendedType in the adapter ExtendedTypeMap.
    ExtendedType API provides access to the ResultSet for reading custom
    objects and PreparedStatement for writing them (so you can get the
    underlying connection as well).

    I guess you can install your own ExtendedType for the target Java class,
    implementing is so that autoconfigures the connections whenever
    "materializeObject" or "setJdbcObject" is invoked. If this works we can
    think of better ways to optimize such setup.

    I am curious if this works at all. Could you post the results here please?

    Andrus

    > Hello.
    >
    > The PostgreSQL jdbc driver has the possibility to register addtitional
    > data types for a connection. I would like to use this with cayenne for
    > some postgis data types.
    >
    > In standard jdbc you would do something like this:
    > conn = DriverManager.getConnection(url, "...", "...");
    > ((PGConnection) conn).addDataType("geometry",
    > "org.postgis.PGgeometry");
    > ((PGConnection) conn).addDataType("box3d",
    > "org.postgis.PGbox3d");
    >
    > It looks like this has to be done for every connection. Where is the
    > best place to do this in cayenne?
    >
    > Regards,
    > - Tore.



    This archive was generated by hypermail 2.0.0 : Tue Jun 29 2004 - 12:55:02 EDT