Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Coping with non standard data types on insert/update

I wasn't sure if that was what I wanted, they seemed to be XML
specific from the examples, plus the more I thought of it, the more I
knew it was more of a postgres JDBC problem since there is no native
type that maps to an inet or cidr in java.

What I ended up doing was creating a view with an insert rule that
does the cast for me, cuz postgres is crazy like that :)


Really the only thing that could help me would be a way to modify the
SQL used for insert statements (so I could add a cast like ?::cidr to
my bind) on a specific entity and I didn't see anything like that.

Thanks,
Tim



On Tue, Jun 3, 2008 at 3:01 PM, Mohsen Saboorian <mohsens@xxxxxxxxx> wrote:
> Did you try converters?
> http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#Using_EclipseLink_JPA_Converters
>
> Mohsen.
>
> On Tue, Jun 3, 2008 at 5:46 PM, Tim Hollosy <hollosyt@xxxxxxxxx> wrote:
>> I've got a table with a cidr datatype (postgres), on selects JPA maps
>> it to a String, which is fine. However on inserts/updates this of
>> course does not work.
>>
>> In the past (pure jdbc) I'd simply cast like so, "INSERT into table
>> (cidrfield) values(?::cidr)" what's the best practices for dealing
>> with custom datatypes that aren't mapped by eclipselink/jpa?
>>
>> Will I have to write insert queries by hand for all my inserts or is
>> there an elegant way? I was looking at the Converter annotations, but
>> that looks like it's for XML stuff only.
>>
>> Thanks,
>> Tim
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>



-- 
./tch


Back to the top