You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Eric Fenderbosch (JIRA)" <ji...@apache.org> on 2013/07/17 21:45:47 UTC

[jira] [Created] (OPENJPA-2411) Support Postgres casts for non-standard types such as inet, cidr, macaddr, etc.

Eric Fenderbosch created OPENJPA-2411:
-----------------------------------------

             Summary: Support Postgres casts for non-standard types such as inet, cidr, macaddr, etc.
                 Key: OPENJPA-2411
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2411
             Project: OpenJPA
          Issue Type: Improvement
          Components: jdbc
    Affects Versions: 2.2.2
         Environment: postgres 9.0
            Reporter: Eric Fenderbosch


For non-standard types (inet, cidr, macaddr) you can cast to a known Postgres type with a double colon and the type.

Example:

insert into click (ip) values ('127.0.0.1'::inet)

When creating a prepared statement the placeholder marker should be '?::' instead of '?'.

This can be fixed by overriding DBDictionary.getMarkerForInsertUpdate (patch attached) and annotating the field with the non-standard type. Like this:

@Column(columnDefinition = "inet")

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira