日期:2014-05-18  浏览次数:20694 次

hibernate 中使用 dual 求助
请各位帮忙看看,谢谢
Dual.java
package   bean;
import   java.io.Serializable;
public   class   Dual   implements   Serializable   {
private   Long   id;
public   Long   getId()   {
return   this.id;
}
public   void   setId(Long   id)   {
this.id   =   id;
}
}

Dual.hbm.xml
<?xml   version= "1.0 "   encoding= "UTF-8 "?>
<!DOCTYPE   hibernate-mapping   PUBLIC   "-//Hibernate/Hibernate   Mapping   DTD   3.0//EN "  
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd ">
<hibernate-mapping>
<class   name= "bean.Dual "   table= "DUAL ">
<id   name= "id "   type= "java.lang.Long "   column= "ID ">
<generator   class= "sequence "> <!--可以替换-->
<param   name= "sequence "> seq_flow </param>
</generator>
</id>
</class>
</hibernate-mapping>

执行select   seq_flow.nextval   from   Dual   这条语句时报错,次句在sqlplus正常执行
错误信息如下:

org.hibernate.hql.ast.QuerySyntaxError:   Invalid   path:   'seq_flow.nextval '   [select   seq_flow.nextval   from   bean.Dual]
at   org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at   org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
at   org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at   org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at   org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at   org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at   org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at   org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at   DAO.LogicDAO.getSeq(LogicDAO.java:106)
at   logic.impl.Logic.getSeq(Logic.java:46)
at   web.LogicAction.gotoApplyQues(LogicAction.java:77)
at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native   Method)
at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at   java.lang.reflect.Method.invoke(Method.java:585)
at   org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at   org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at   org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at   org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at   org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at   org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at   base.SetCharacterEncod