how to map json in orm.xml in jpaWhat is the “N+1 selects problem” in ORM (Object-Relational Mapping)?JPA EntityManager: Why use persist() over merge()?Infinite Recursion with Jackson JSON and Hibernate JPA issueJPA, MySQL, Hibernate & Maven SkeletonJPA Secondary Table XML ConfigWhat's the difference between JPA and Hibernate?What's the difference between @JoinColumn and mappedBy when using a JPA @OneToMany associationWhat is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?Could not determine type for entityValidationException Exception Description: uses a non-entity as target entity in the relationship attribute

D Scale Question

Could these polynomials be identified?

Why wasn't Linda Hamilton in T3?

How does the search space affect the speed of an ILP solver?

When do we use "no women" instead of "no woman"?

Tasha's Hideous Laughter used on a deaf person?

Should we run PBKDF2 for every plaintext to be protected or should we run PBKDF2 only once?

The Justice Thought & System & its Morals?

How to run a command 1 out of N times in Bash

Function of the separated, individual solar cells on Telstar 1 and 2? Why were they "special"?

If the government illegally doesn't ask for article 50 extension, can parliament do it instead?

How can I modify a line which contains 2nd occurence of a string?

Can authors email you PDFs of their textbook for free?

Different past tense for various *et words

Polarity of gas discharge tubes?

Cheap oscilloscope showing 16 MHz square wave

How do I get my neighbour to stop disturbing with loud music?

How do you manage to study and have a balance in your life at the same time?

Is there anything in the universe that cannot be compressed?

Can a system of three stars exist?

What happens if you just start drawing from the Deck of Many Things without declaring any number of cards?

What is causing gaps in logs?

Why are CEOs generally fired rather being demoted?

What are ways to record who took the pictures if a camera is used by multiple people?



how to map json in orm.xml in jpa


What is the “N+1 selects problem” in ORM (Object-Relational Mapping)?JPA EntityManager: Why use persist() over merge()?Infinite Recursion with Jackson JSON and Hibernate JPA issueJPA, MySQL, Hibernate & Maven SkeletonJPA Secondary Table XML ConfigWhat's the difference between JPA and Hibernate?What's the difference between @JoinColumn and mappedBy when using a JPA @OneToMany associationWhat is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?Could not determine type for entityValidationException Exception Description: uses a non-entity as target entity in the relationship attribute






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have create DTO/Entities from openApi gen and I have orm.xml to map Java Entity to JPA. Problem is I want one of field object(named obj see code below) in java class to be mapped to JSON/JSONB JDBC data type. I am not sure how to do it.



class Test
private String id;
//its not a JsonObject
private Object obj;
// usual boiler plate i.e. Default constructors and getters/setters



orm.xml ->



<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
version="2.0">



<entity class="com.Test" access="FIELD">
<table name="Test"/>

<attributes>
<json name="obj"/>

</attributes>
</entity>

</entity-mappings>



But its saved as "byteArray" psql data type instead of json type on database. Please help me understand how can I create a mapping that creates a "json" column instead of "byteArray" psql data type










share|improve this question
























  • @Vlad Mihalcea can you help in solving my issue

    – user3879753
    Mar 29 at 4:02

















0















I have create DTO/Entities from openApi gen and I have orm.xml to map Java Entity to JPA. Problem is I want one of field object(named obj see code below) in java class to be mapped to JSON/JSONB JDBC data type. I am not sure how to do it.



class Test
private String id;
//its not a JsonObject
private Object obj;
// usual boiler plate i.e. Default constructors and getters/setters



orm.xml ->



<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
version="2.0">



<entity class="com.Test" access="FIELD">
<table name="Test"/>

<attributes>
<json name="obj"/>

</attributes>
</entity>

</entity-mappings>



But its saved as "byteArray" psql data type instead of json type on database. Please help me understand how can I create a mapping that creates a "json" column instead of "byteArray" psql data type










share|improve this question
























  • @Vlad Mihalcea can you help in solving my issue

    – user3879753
    Mar 29 at 4:02













0












0








0








I have create DTO/Entities from openApi gen and I have orm.xml to map Java Entity to JPA. Problem is I want one of field object(named obj see code below) in java class to be mapped to JSON/JSONB JDBC data type. I am not sure how to do it.



class Test
private String id;
//its not a JsonObject
private Object obj;
// usual boiler plate i.e. Default constructors and getters/setters



orm.xml ->



<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
version="2.0">



<entity class="com.Test" access="FIELD">
<table name="Test"/>

<attributes>
<json name="obj"/>

</attributes>
</entity>

</entity-mappings>



But its saved as "byteArray" psql data type instead of json type on database. Please help me understand how can I create a mapping that creates a "json" column instead of "byteArray" psql data type










share|improve this question














I have create DTO/Entities from openApi gen and I have orm.xml to map Java Entity to JPA. Problem is I want one of field object(named obj see code below) in java class to be mapped to JSON/JSONB JDBC data type. I am not sure how to do it.



class Test
private String id;
//its not a JsonObject
private Object obj;
// usual boiler plate i.e. Default constructors and getters/setters



orm.xml ->



<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
version="2.0">



<entity class="com.Test" access="FIELD">
<table name="Test"/>

<attributes>
<json name="obj"/>

</attributes>
</entity>

</entity-mappings>



But its saved as "byteArray" psql data type instead of json type on database. Please help me understand how can I create a mapping that creates a "json" column instead of "byteArray" psql data type







jpa jdbc orm spring-data-jpa jpa-2.1






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 1:06









user3879753user3879753

1




1















  • @Vlad Mihalcea can you help in solving my issue

    – user3879753
    Mar 29 at 4:02

















  • @Vlad Mihalcea can you help in solving my issue

    – user3879753
    Mar 29 at 4:02
















@Vlad Mihalcea can you help in solving my issue

– user3879753
Mar 29 at 4:02





@Vlad Mihalcea can you help in solving my issue

– user3879753
Mar 29 at 4:02












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388719%2fhow-to-map-json-in-orm-xml-in-jpa%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388719%2fhow-to-map-json-in-orm-xml-in-jpa%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현