'Bring out association property JSON object and combine it as single JSON using mybatis xml mapper
I am using mybatis XML mapper class to do a CRUD operation with Oracle database in which we have some set of queries using joins and we have to pick columns from multiple tables and map them with respective POJO class entity by using association property I am able to do it but in response JSON I am getting association property block as a separate JSON object but in my case, it has to give all the key-value response as single JSON.
<resultMap id="getUsageCounterListMap" type="joinresult">
<id property="id" column="id"/>
<association property="blog" column="api_consumer"
resultMap="blogresult"/>
</resultMap>
Blogresult resultmap
<resultMap id="blogresult" type="Approval">
<id property="cagId" column="C_ID"/>
<result property="version" column="VERSION"/>
<result property="lId" column="LID"/>
</resultMap>
Result Json
{
"id":"6",
"blog":{
"cagId":"23",
"version":"2",
"lId":"3"
}
}
In the above example blog comes as a separate JSON obj but in my case what I am expecting is my response should be of single JSON
{
"id":"6",
"cagId":"23",
"version":"2",
"lId":"3"
}
need something like this using associate property also if any other approach is applicable specify.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
