Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 
3.2 rc2
Mapping documents:
<class name="br.com.vivo.grc2.model.ServicoDocumentacao" table="GR2_SERVICO">
 <id name="id" type="java.lang.Long">...</id>
 <one-to-one name="status" class="br.com.vivo.grc2.model.Status" foreign-key="idstatus" cascade="none"/>
 <one-to-one name="estado" class="br.com.vivo.grc2.model.temp.Estado" foreign-key="idestado" cascade="none" />
 <one-to-one name="servico" class="br.com.vivo.grc2.model.temp.PaServico" foreign-key="idservico" cascade="none"/>
 <property name="numeroMovel" not-null="true"/>
 <property name="esn" not-null="true"/>
 ...
</class>
<class name="br.com.vivo.grc2.model.Status" table="GR2_STATUS">
 <id name="id" type="java.lang.Long">...</id>
 <property name="descricao"/>
 <property name="tipo" not-null="true"/>
 <one-to-one name="estado" class="br.com.vivo.grc2.model.temp.Estado" foreign-key="idestado"/>
</class>
 <class name="br.com.vivo.grc2.model.temp.Estado" table="PA_ESTADO">
 <id name="id" type="java.lang.Long">...</id>
 <property name="sigla"/>
 <property name="descricao"/>
</class>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I am writing a DetachedCriteria object generator method based on 
a Class passed and a map of parameter -> vale. Some of these map parameters can be nested (eg.: status.tipo = 'TE')
I would like to create a DetachedCriteria for ServicoDocumentacao class
with: numeroMovel = "5151515151", esn="DBDBDBDB", status.tipo="PE", estado.id = 2.
My generator created:
DetachedCriteria dc = DetachedCriteria.forClass(ServicoDocumentacao.class);
dc.add(Restrictions.eq("numeroMovel", "5184016351"));
dc.add(Restrictions.eq("esn", "DBDBDBDB"));
DetachedCriteria dcTemp;
		
dcTemp = dc.createCriteria("estado");
dcTemp.add(Restrictions.eq("id", new Long(2)));
dcTemp = dc.createCriteria("status");
dcTemp.add(Restrictions.eq("tipo", "PE"));
A record exists in Oracle Database, but it is not retrieved. It seems like Hibernate is doing some wrong outer joins using two-sides PKs istead FK->PK association.
SQL Generated:
 
  select ... 
  from GR2_SERVICO this_,
          GR2_STATUS status2_,
          PA_ESTADO estado5_,
          PA_ESTADO estado1_,
          PA_SERVICO paservico7_
where 
this_.id=status2_.id 
   and status2_.id=estado5_.id(+)
   and this_.id=estado1_.id
   and this_.id=paservico7_.id(+)
   and this_.numeroMovel=? 
   and this_.esn=? 
   and estado1_.id=? 
   and status2_.tipo=?
this_.id=status2_.id ? It should be this_.idstatus=status2_.id 
status2_.id=estado5_.id(+) ? It should be status2_.idestado=estado5_.id(+)
this_.id=paservico7_.id(+) ? It should be this_.idservico=paservico7_.id(+)
What is wrong here? 
Thank you!