How to map an Array of JSON (of Postgres) into GORM objects and how to process them? - postgresql

I am mapping a Postgres table into Golang's GORM Framework.
How to map the following column type in Postgres?
doc json[] DEFAULT ARRAY[]::json[]
And how do I modify it with GORM?

Related

Ora2PG REPLACE_AS_BOOLEAN property and exclude one column by replacing

I'm using ora2pg to import an oracle db schema into a postgresql db schema. I configured all in the correct way and I'm able to dump the oracle dn into the postgresql db.
In the schema that I'm converting I have some columns number(1,0) that I need to convert as boolean in the pg schema.
At first I used this configuration
REPLACE_AS_BOOLEAN NUMBER:1
so every column with this type will be conmverted as boolean in the pg db.
The problem is that I have a column in the oracle schema defined as number(1,0). This column has to remain numeric and maintain the same type on the pg schema, so it hasn't to be converted as boolean.
This means that i changed the property in this manner
REPLACE_AS_BOOLEAN TABLE1:COLUMN1 TABLE2:COLUMN2 TABLE3:COLUMN3
I have a lot of columns that they have to be converted as boolean and the definition of this property became very long.
Is there a method to define the REPLACE_AS_BOOLEAN property to replace all the column with type number(1,0), but with some exception for one or some of them?
I had to wrote the property with the list of all the tables name and columns name

Can JOOQ alias a Liquibase JSONB data type for H2/Postgresql

I'm using this H2 feature to create an alias for JSONB in the jdbc string:
spring.datasource.url: jdbc:h2:mem:testdb;INIT=create domain if not exists jsonb as text;MODE=PostgreSQL
But JOOQs' codegen liquibase support (generator pointed at liquibase files) doesn't recognize the JSONB column type.
and I keep getting:
Reason: liquibase.exception.DatabaseException: Unknown data type: "JSONB";
Is there a way to tell the generator to alias this data type to TEXT?
You can try to init your h2 with CREATE TYPE "JSONB" AS json

How to map a column to JSONB instead of JSON, with Doctrine and Postgresql?

In my project I'm using Doctrine doctrine 2.5.4/postgres 9.5. I'm trying to add a jsonb field using YAML:
fields:
obj: json_array
This gets interpreted as a json column type (and not jsonb). The specification notes about picking up json or jsonb:
Chosen if the column definition contains the jsonb option inside the platformOptions attribute array and is set to true.
But platformOptions doesn't seem to work (tried to add it below obj, at the top... with no success). How can I add a jsonb field?
This is supported by doctrine/dbal v2.6+ (it requires PHP 7.1). All you need to do is use json_array and set options={"jsonb"=true} I tested this on doctrine/dbal v2.6.3
This is what it looks like in PHP format:
/**
* #ORM\Column(type="json_array",nullable=true,options={"jsonb"=true})
*/
private $details;
and it creates a query such as (for an existing table):
ALTER TABLE mytable ADD details JSONB NOT NULL;
More details about type mapping can be found at Doctrine mapping matrix.
Use boldtrn/jsonb-bundle, it provides a jsonb doctrine type as well as custom functions to access the special operators provided by the PostgreSQL jsonb data type.

Postgresql jsonb support in orm lite servicestack

Can we expect native support for the jsonb field when saving poco objects into a field? (and query for fields inside the jsonb field using the correct postgresql syntax)?
Thanks

Oracle database object type import in JPA

Is there a way to import oracle defined object type in JPA. I have a complex object defined in database :
create or replace TYPE "myType"{
someString varchar2(100),
someString2 varchar2(100),
constructor....}
this object type is than used in a database table.
There is no standard support for object-types in JPA.
If you are using EclipseLink, you can use the #Struct annotation to map object-types,
http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/a_struct.htm#CBBDCAHG
If you are mapped a table of the type, and the type has no nested types, then it will just look like a normal relational table, and you can just map in like a normal relational table.