-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate with Oracle xdb grammar error
PostPosted: Sun Apr 02, 2006 11:51 pm 
Newbie

Joined: Sun Apr 02, 2006 11:25 pm
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.