Oracle database object type import in JPA - 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.

Related

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.

Why eclipselink convert BIGINT to string type?

I am using EclipseLink 2.6 and MySQL 5.
In the database, I design a table named User which has a id column as BIGINT datatype.
Then I use Eclipse to generate entity class from the table.
After generating, the entity class User has the id field as String, which I would have expected as long type.
I tried to perform CRUD operations and all worked just fine.
Why a String type can be mapped to a BIGINT 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

Problem with Entity Framework Model Designer and SQL_Variant datatype

I have a table that has a column with SQL_Variant type and some other columns with types like int, bigint,...
When I add this table to edmx file it adds all columns but the SQL_Variant typed column.
Is there a bug or I have to do something to add that column?
The entity framework doesn't support sql_variant. If you have to use that type in your code, you've to use another o/r mapper.
There is a solution for read-only access.