Postgresql jsonb support in orm lite servicestack - postgresql

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

Related

JPA, Postgresql: Is there any performance difference between oid and TEXT?

I'm using JPA with a postgresql database and also using Hibernates hbm2ddl to generate the initial DB schema.
I have a Java String field in my entity object that will need to be large. When I annotate it with #Lob hbm2ddl generates an oid db column, however I can also use #Column(columnDefinition = "TEXT") to get a TEXT db column.
I've tried searching the internet but I can't find any comparison between the performance or other benefits of oid's vs TEXT columns. Is there any reason to prefer one over the other?

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

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?

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.

Crate DB exception, no viable alternative at input 'VARCHAR'

I'm using Elastic search to store large amount of data to make it searchable, but for configuration items I'm still using HSQL DB.
Is it possible to eliminate HSQL DB completely and use my existing Elastic search in combination with Crate DB?
Things I have tried:
tried connecting to my existing Elastic search using Crate driver and Crate client but I got an exception No handler found for action "crate_sql". Does that mean I cannot use my existing ES and have to use inbuilt ES in crateDB??
After connecting to crateDB elastic search (and not my existing ES). I was able to get connection using CrateDriver and run SQL queries. But in one of module I'm creating table using below command:
create table some_table_name
(
id VARCHAR(256),
userName VARCHAR(256),
fieldName VARCHAR(256),
primary key (id),
unique (userName, fieldName)
);
...but then I got an exception:
io.crate.action.sql.SQLActionException: line 1:28: no viable alternative at input 'VARCHAR'
Does that mean I cannot write create table query using SQL syntax and SQL data types?
I know it will work if I use string data type instead of varchar, but I don't want to change all those queries now.
1)
No you cannot use existing ES nodes together with Crate. The whole SQL analyzer/planner/execution layer is done server side, not client side. In fact the crate clients are rather dumb.
2)
You'll have to change the types and also remove / change anything that isn't supported by crate. For example defaults or unique constraints aren't supported (up to 0.39 - in the future support might be added)
In your case the varchar type isn't valid in Crate, instead you'll have to use "string".
See Data Types Documentation for a list of supported data types.

DB2 Character Datatype and JPA Not Working

I am working with DB2 Universal database having lots of tables with columns of datatype CHARACTER. Length of these columns is variable (greater than 1 e.g. 18). As i execute a Native query using JPA it selects only first character of the column. Seems CHARACTER datatype is mapped to Java Character.
How can i get full contents in DB column. I can not change the database bening on Vendor side. Please note i need to do it both ways, i.e. :
Using JPQL ( is attribute columnDefinition can work in this case)
Using native DB query (no pojo is used in this case and i have no control over datatypes)
i am using Hibernate implementation of JPA provided by spring.
If these columns are actually common in your database, you can customize a dialect used by Hibernate. See comments to HHH-2304.
I was able to cast the column to VARCHAR to produce padded String results from createNativeQuery:
select VARCHAR(char_col) from schema.tablename where id=:id