• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Order by with two columns

 
Diego Gusava
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have two objects

Objects: Objeto, Comunicado and ComunicadoTramite




The problem is, i want a list of Comunicado that is ordered by dataCriacao, the two objects (Comunicado and ComunicadoTramite) extends Objeto that contains dataCriacao.

if Comunicado.tramites.size() > 0 then get dataCriacao from the last ComunicadoTramite inserted

if Comunicado.tramites.size() = 0 then get dataCriacao from Comunicado.

Native SQL I did this




I dont know how to do it in JPA... can anyone help me?

 
Diego Gusava
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did this

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic