Skip to main content

JPA Query error....

2 replies [Last post]
eliasn
Offline
Joined: 2005-02-04

Hello!

Im create the WebProject using the Entity Database from Database for my POJO's and JSD Pages from Entity Class for the presentation view...

Some classes they possess composite key's...

In the classes that possess composite keys, for the listing the data from database I receive this error:
org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Error getting property 'lastItem' from bean of type br.com.sequor.wsqo.domain.WsqosequenciamentoestacaoController: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query

For this query generated by NetBeans automatically:
int count = ((Long) em.createQuery("select count(o) from Wsqosequenciamentoestacao as o").getSingleResult()).intValue();

Somebody already faced this problem?
Some solution?

Best regards,
Elias Nogueira

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mb124283
Offline
Joined: 2005-06-17

Hi,

provided that Wsqosequenciamentoestacao is a valid entity class the query looks ok to me. Does hibernate give more details about the error? So is there a nested exception with more information?

Regards Michael

eliasn
Offline
Joined: 2005-02-04

[i]org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Error getting property 'lastItem' from bean of type br.com.sequor.wsqo.domain.WsqosequenciamentoestacaoController: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)[/i]

and other:

[i]caused by: java.sql.SQLException: ORA-00907: parêntese direito não encontrado

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1038)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1133)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
... 68 more[/i]