i've the following statement:
Code:
String query = "select elements(rel.turma.detalhe) from Relatorio as rel where rel.turma.ano = " + oano + " AND turma = " + aturma;
This query returns several strings (corresponding to field
estrategia in table
detalhes), and i'd like to order them "asc".
But everything i try gives me sintax error or else doesnt show up at all.
I tried (without success):
order by elements asc
order by elements(rel.turma.detalhe) asc
order by rel.turma.detalhe asc
order by rel.turma.detalhes.estrategia - sql syntax error
and so on...
my mappings:
DetalheCode:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name = "relatorio.Detalhe" table = "detalhes">
<id name = "id" column = "id" unsaved-value = "null">
<generator class = "increment" />
</id>
<property name = "estrategia" column = "estrategia" />
</class>
</hibernate-mapping>
Detalhe is a child of
Turma:
[code]<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name = "relatorio.Turma" table = "turmas">
<id name = "id" column = "id" unsaved-value = "null">
<generator class = "increment" />
</id>
<property name = "turma" column = "turma" />
<property name = "ano" column = "ano" />
<property name = "masculinos" column = "masculinos" />
<property name = "femininos" column = "femininos" />
<!--
retirei lazy = true para poder fechar a sess