Hibernate query grouping by column -


I am developing an API REST using jerseys and hibernation. My database has this table:

CODDOMINIO | Cadigo | Description (CODDOMINIO, CODIGO) is the overall PK.

I want to return a Jason with this structure:

  [[CODDOMINIO: "1, CODIGOS: [[CODIGO:" 12 ", DESCRIPCION:" Example "CODIGOIO:" 2 ", Codigos: [[CODIGO:" 14 ", Description:" Example "}, {CODIGO:" 15 ", {CODIGO:" 13 "}, {CODIGO:" 13 ", Description:" Example "} DESCRIPCION: "Example"}]},]   

And so on ... is there any way to do it automatically by hibernate annotation?

First of all, you have a hushmap, or any type of map Java archive that mapped the keys and values ​​of that archive (m Documentation on the shopping archive) - I think the best option store map & lt; EntityPK, someValue & gt; will map the map composite PK Second, if you want separate output for that archive (like the output you provided) you can declare the code as @transient Manipulating the archive and output Because it is suitable for you Land You can find examples on the Hibernate documents, and you will find many examples of working with transient properties to Hibernate if you google it.

Comments

Popular posts from this blog

php - how to change mysql_result($res, 0, "url"); to mysqli -

c# - Textbox not clickable but editable -

Matlab transpose a table vector -