Hi,

   I have some JSON data represents an eCommerce product subscription, it 
looks kinda like the example below. I'm trying to insert this data into a 
Postgres table 

{
  subscriptionID:'1234',
  sku:'12346',
  every: '6 weeks'
}

I have a pojo that reflects the above 

public class Subscription {
      private String subscriptionId;
      private String sku;
      private String every;
//getters and setters...
}

And my table looks similar but uses the interval data type

CREATE TABLE subscription (
    subscription_id     varchar(30),
    sku                          varchar(30),
    every                       interval 
)

We're using JPA with jooq to do bulk inserts so my getters have the 
annotations like this 
@Column(name="every")

I hoped that using this method I would be able to coerce a string into a 
interval type so long as the format was recognized by postgres, eg 1 week, 
4 months, 3 days etc...

However its not really working. I tried using the org.jooq.types.
YearToSecond type but its not exactly a fit as it doesnt support every 
format of interval that postgres does (for example "6 weeks").

My question is how do insert a string representation of an interval into a 
postgres interval type column via JPA column mappings? Is there a way to 
get postgres to cast it somehow?  






-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/9f2d879c-caa7-461b-9d5f-979e60ea0159n%40googlegroups.com.

Reply via email to