Hello,
I would like to ask whether it is possible for Hibernate to run on Oracle xdb query like:
select extractValue(value(h), '/a/b) as {pb.x}, extractValue(value(h), '/a/c') as {pb.y} from xtable pb, table(xmlsequence(extract(value(pb), '/a'))) h
The DAO code is as below
return session.createSQLQuery("select "
+ "extractValue(value(h), '/a/b) as {pb.x}, "
+ "extractValue(value(h), '/a/c') as {pb.y} "
+ "from xtable pb, "
+ "table(xmlsequence(extract(value(pb), '/a))) h ")
.addEntity("pb", Pb.class)
.list();
This will result in bad SQL grammar error as below:
11:38:32,439 ERROR [ActionExceptionHandler] org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not execute query; bad SQL grammar [select extractValue(value(h), '/a/b) as host7_0_, extractValue(value(h), '/a/c) as path7_0_ from xtable pb, table(xmlsequence(extract(value(pb), '/a'))) h ]; nested exception is java.sql.SQLException: Invalid column name
java.sql.SQLException: Invalid column name
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:145)
I was under the impression that there is something missing in the above sql as i believe there should be no problem in using functions for columns and tables if the correct alias format e.g. {}, are used.
Thanks in advance.
|