Quote:
works perfectly well when executed on the sqlplus console, but throws ORA-00904 when executed via Hibernate (2.1.8)
Why do some people think that Hibernate has some super-secret means of communicating with the database? It uses JDBC. If you cannot perform a query through JDBC, guess what? Hibernate will not magically be able to do the same.
Have you tried issuing this query through JDBC?
Code:
Connection conn = ...;
PreparedStatement ps = conn.prepareStatement(
"select distinct recurso7_.RECID as RECID0_, " +
" menu8_.MNUID as MNUID1_, " +
" recurso7_.RECNOMBRE as RECNOMBRE0_, " +
" recurso7_.RECDESCRIPCION as RECDESCR3_0_, " +
" recurso7_.RECMNUID as RECMNUID0_, " +
" menu8_.MNUNOMBRE as MNUNOMBRE1_ " +
" from CM_USUARIO usuario0_, " +
" CM_GRUPO grupo1_, " +
" CM_RECURSO recurso2_, " +
" CM_MENU menu3_ " +
" inner join CM_USUARIO_GRUPO usrgrupos4_ " +
" on usuario0_.USRID=usrgrupos4_.USRID " +
" inner join CM_GRUPO grupo5_ " +
" on usrgrupos4_.GRPID=grupo5_.GRPID " +
" inner join CM_GRUPO_RECURSO grprecurso6_ " +
" on grupo5_.GRPID=grprecurso6_.GRPID " +
" inner join CM_RECURSO recurso7_ " +
" on grprecurso6_.RECID=recurso7_.RECID " +
" inner join CM_MENU menu8_
" on recurso7_.RECMNUID=menu8_.MNUID " +
" where (usuario0_.USRLOGIN=? ) " +
" AND(grupo5_.GRPNOMBRE!='Administradores' ) " +
" order by menu8_.MNUNOMBRE"
);
ps.setString( 1, "whatever" );
ps.executeQuery();
What happens?
Also, can you post the result of running "desc CM_USUARIO" in sqlplus?