-->
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.  [ 4 posts ] 
Author Message
 Post subject: Invalid number error when loading related entity
PostPosted: Tue Mar 15, 2011 1:40 pm 
Newbie

Joined: Tue Mar 15, 2011 1:12 pm
Posts: 6
Hi All,
I am new to using hibernate and JPA. I had an issue that is described as follows


I am working with a legacy DB so I am constrained to using a string for P_ID for the person entity even though it's of the form 80776780
I am using Seam 2.2.0.GA, Hibernate Annotations 3.4.0.GA and Hibernate 3.3.1.GA against an Orcle 10g DB all in Tomcat 5.5.

I have detailed the relevant entities (a Report class and a Person class) below as follows;


------------------------------------------------------------------------------------------------------------------------------------------------------------
Code:
@Entity
@Table(name="TBL_REPORT")
public class Report implements Serializable{

   @EmbeddedId
   @AttributeOverrides(value={@AttributeOverride(name="reportId", column=@Column(name="REPORT_ID")),
   @AttributeOverride(name="reportVersion", column=@Column(name="REPORT_VERSION"))})
   ReportPK reportIdPk;

   public Report(){
      reportIdPk = new ReportPK();
   }

   @OneToOne
   @JoinColumn(name = "REPORT_TYPE", referencedColumnName="REPORT_TYPE_CD")
   private ReportType reportType;
   
   @OneToOne
   @JoinColumn(name = "P_ID", referencedColumnName="P_ID")
   private Person participant;       

   @Embeddable
   public static class ReportPK implements Serializable{
      public ReportPK(){}

      Integer reportId;
      
      Integer reportVersion;
      
      @Override
      public boolean equals(Object otherOb) {
         if (this == otherOb) {
            return true;
         }
         if (!(otherOb instanceof ReportPK)) {
            return false;
         }
         ReportPK other = (ReportPK) otherOb;
         return ((reportId == null ? other.reportId == null : reportId
               .equals(other.reportId)) && (reportVersion == other.reportVersion));
      }
      @Override
      public int hashCode() {
         return ((reportId == null ? 0 : reportId.hashCode()) ^ ((int) reportVersion));
      }

      @Override
      public String toString() {
         return "" + reportId + "-" + reportVersion;
      }
      
      @Column(name="REPORT_ID", nullable=false)
      public Integer getReportId() {
         return reportId;
      }
      public void setReportId(Integer reportId) {
         this.reportId = reportId;
      }
      
      @Column(name="REPORT_VERSION", nullable=false)
      public Integer getReportVersion() {
         return reportVersion;
      }
      public void setReportVersion(Integer reportVersion) {
         this.reportVersion = reportVersion;
      }   
      
      
   }
}

------------------------------------------------------------------------------------------------------------------------------------------------------------
Code:
@Entity
@Table(name="TBL_PEOPLE")
public class Person implements Serializable{

   @Id
   @Column(name="P_ID")
   private String id;

   @Column(name="FIRST_NAME")
   private String firstName;
   
   @Column(name="MIDDLE_NAME")
   private String middleName;
   
   @Column(name="LAST_NAME")
   private String lastName;
}

------------------------------------------------------------------------------------------------------------------------------------------------------------

I use seam to initialize and inject and entityManager instance whereever it is needed and it works fine for all inserts updates and deletes and even for searched on stand alone entities (I am able to obtain a resultlist of "Person" entities just fine) but fails for a more complex entity definition such as that of the Report .
when I call entityManager().createQuery("from Report").getResultList();

I get the following exception

Code:
13:07:40,875 INFO  [DefaultLoadEventListener] Error performing load command
org.hibernate.exception.SQLGrammarException: could not load an entity: [fas.admincomp.coi.model.Person#80776780]
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
        at org.hibernate.loader.Loader.loadEntity(Loader.java:1895)
        at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:71)
        at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:65)
        at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3072)
        at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:434)
        at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:415)
        at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165)
        at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223)
        at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
        at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
        at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:873)
        at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590)
        at org.hibernate.type.EntityType.resolve(EntityType.java:412)
        at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139)
        at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
        at org.hibernate.loader.Loader.doQuery(Loader.java:752)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
        at org.hibernate.loader.Loader.doList(Loader.java:2228)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
        at org.hibernate.loader.Loader.list(Loader.java:2120)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
        at fas.admincomp.coi.model.ReportHome.findByParticipant(ReportHome.java:48)
        at fas.admincomp.coi.session.ReportList.listReports(ReportList.java:71)
        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:592)
        at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
        at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
        at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:56)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
        at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
        at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
        at fas.admincomp.coi.session.ReportList_$$_javassist_seam_3.listReports(ReportList_$$_javassist_seam_3.java)
        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:592)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
        at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
        at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
        at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
        at org.jboss.seam.navigation.Pages.callAction(Pages.java:692)
        at org.jboss.seam.navigation.Pages.preRender(Pages.java:330)
        at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)
        at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)
        at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
        at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
        at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
        at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
        at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
        at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
        at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:843)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:679)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1293)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: ORA-01722: invalid number

        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:745)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
        at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1072)
        at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:854)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415)
        at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
        at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
        at org.hibernate.loader.Loader.doQuery(Loader.java:697)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
        at org.hibernate.loader.Loader.loadEntity(Loader.java:1881)
        ... 100 more
13:07:41,360 ERROR [SeamPhaseListener] swallowing exception
javax.el.ELException: org.hibernate.exception.SQLGrammarException: could not load an entity: [fas.admincomp.coi.model.Person#80776780]
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
        at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
        at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
        at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
        at org.jboss.seam.navigation.Pages.callAction(Pages.java:692)
        at org.jboss.seam.navigation.Pages.preRender(Pages.java:330)
        at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)
        at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)
        at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
        at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
        at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
        at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
        at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
        at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
        at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:843)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:679)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1293)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.exception.SQLGrammarException: could not load an entity: [fas.admincomp.coi.model.Person#80776780]
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
        at org.hibernate.loader.Loader.loadEntity(Loader.java:1895)
        at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:71)
        at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:65)
        at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3072)
        at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:434)
        at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:415)
        at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165)
        at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223)
        at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
        at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
        at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:873)
        at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590)
        at org.hibernate.type.EntityType.resolve(EntityType.java:412)
        at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139)
        at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
        at org.hibernate.loader.Loader.doQuery(Loader.java:752)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
        at org.hibernate.loader.Loader.doList(Loader.java:2228)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
        at org.hibernate.loader.Loader.list(Loader.java:2120)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
        at fas.admincomp.coi.model.ReportHome.findByParticipant(ReportHome.java:48)
        at fas.admincomp.coi.session.ReportList.listReports(ReportList.java:71)
        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:592)
        at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
        at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
        at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:56)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
        at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
        at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
        at fas.admincomp.coi.session.ReportList_$$_javassist_seam_3.listReports(ReportList_$$_javassist_seam_3.java)
        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:592)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
        ... 50 more
Caused by: java.sql.SQLException: ORA-01722: invalid number

        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:745)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
        at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1072)
        at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:854)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415)
        at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
        at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
        at org.hibernate.loader.Loader.doQuery(Loader.java:697)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
        at org.hibernate.loader.Loader.loadEntity(Loader.java:1881)



All other entities related to the report load fine save for the person entity. I am of the mind that hibernate is assuming that the P_ID is an number based on the contents of the field rather than on the definition of said field in the DB and the corresponding entity. If there is a work around for this out there I'd really appreciate it, I've been spinning my wheels on this issue for the past couple of days and I'm at my wits end.


Top
 Profile  
 
 Post subject: Re: Invalid number error when loading related entity
PostPosted: Tue Mar 15, 2011 3:08 pm 
Newbie

Joined: Tue Mar 15, 2011 1:12 pm
Posts: 6
Ok so I tried something a bit different and I was able to get rid of the exception but the result set is empty
Code:
((Session)this.getEntityManager().getDelegate()).createCriteria(Report.class).add(Restrictions.eq("participant.id", "'"+participant.getId()+"'")).list();


I contrasted this with a native query
Code:
this.getEntityManager().createNativeQuery("select rpt.* from TBL_REPORT rpt").getResultList();   

to remove the parameter and I do get a result set (size 23) matching the contents of the underlying table but a ClassCast exception
Code:
javax.el.ELException: java.lang.ClassCastException: [Ljava.lang.Object;
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
        at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
        at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
        at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
        at org.jboss.seam.navigation.Pages.callAction(Pages.java:692)
        at org.jboss.seam.navigation.Pages.preRender(Pages.java:330)

I then tried to modify the native query to specify the result class
Code:
this.getEntityManager().createNativeQuery("select rpt.* from TBL_REPORT rpt", Report.class).getResultList();   

and was right back to the invalid number error.

Please if anyone has encountered this before and found a solution or if I'm doing something wrong please let me know.


Top
 Profile  
 
 Post subject: Re: Invalid number error when loading related entity
PostPosted: Wed Mar 16, 2011 9:26 am 
Newbie

Joined: Tue Mar 15, 2011 1:12 pm
Posts: 6
bump


Top
 Profile  
 
 Post subject: Re: Invalid number error when loading related entity
PostPosted: Wed Mar 16, 2011 4:51 pm 
Newbie

Joined: Tue Mar 15, 2011 1:12 pm
Posts: 6
All set on this issue. Really silly problem actually. I had the wrong datatype (String mapping to an integer in the DB) in an entity related to the Person entity. My bad.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.