Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Handling db specific datatypes, specifically PgSQL CIDR

Funny you asked this, search the archives for this list, I asked the
same question a few weeks ago.

Here's what I ended up doing:
I made a view for each table that needed to persist a cidr column, and
that view has insert/update/delete rules on it that does the casting
automatically ( ::cidr ), I then just point my entities to the views
instead of the tables.

There was another solution offered up in the discussion, but I forgot
what it was, you should be able to find it if you search on nabble.

./tim


On Thu, Jul 10, 2008 at 3:08 PM, David Nedrow <dnedrow@xxxxxxx> wrote:
> PostgreSQL (and soon MySQL) provides custom data types dealing with IP
> networking.
>
> They effectively hide the implementation details of storage used to hold
> integral representations of CIDR and INET addresses. Doing this allows the
> DB to use whatever internal representation it needs for ~24 bytes on a
> particular platform. So, in short, there is a valid reason to use them. ;)
>
> In any case, is there a "recommended" way for integrating eclipselink and DB
> specific types?
>
> Eg., I have an annotated class that I would like to include CIDR fields in.
> The CIDR input to pgsql is a string and the db provides several utility
> functions of some interest. My main concern is simply being able to CIDR
> with eclipselink persistent entities.
>
> Here is some info if needed...
>
> http://www.postgresql.org/docs/8.3/static/datatype-net-types.html
> http://www.postgresql.org/docs/8.3/static/functions-net.html
>
> Thoughts?
>
> David
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>


Back to the top