org.hibernate.exception.SQLGrammarException: could not load an entity: [PCode#1]

Hibernate JIRA | umesh phirke | 1 decade ago
  1. 0

    Hi, I am trying to use MS SQL Stored Procedures (SQL 2K) )from Hibernate.(Hibernate 3.0.3) My named query is cached. (With a Default Region + Default Settings) My First time load is working without error. When I try to access it second time I get a the following error. From Log I can see that the the "UpdateTimestampsCache" is getting missed. After that It tried to load the object from the database. The initial loading was done using Stroed Procedure and the second time Hiberante tries to load it using normal "SQL" which it is not supposed to do. It is suppoed to use the StoredProcedure to load the objects. Is any one else is having similar issues? Is there any fix for this Thanks, patkeep. FYI:------- org.hibernate.exception.SQLGrammarException: could not load an entity: [PCode#1] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.loadEntity(Loader.java:1285) at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:141) at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:126) at org.hibernate.persister.entity.BasicEntityPersister.load(BasicEntityPersister.java:2496) at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:387) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:368) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:166) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:140) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:119) at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:577) at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:59) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:80) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134) at PCode$$EnhancerByCGLIB$$d1a01281.getProcedureCode(<generated>) at MCode.load(LoadNomenclatures.java:89) Caused by: com.inet.tds.SQLException: Msg 208, Level 16, State 1, Line 1, Sqlstate S0002 [SQLBOX]Invalid object name 'AutoId'. at com.inet.tds.a.a(Unknown Source) at com.inet.tds.g.if(Unknown Source) at com.inet.tds.g.a(Unknown Source) at com.inet.tds.g.for(Unknown Source) at com.inet.tds.c.int(Unknown Source) at com.inet.tds.c.executeQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:68) at org.logicalcobwebs.cglib.proxy.Proxy$ProxyImpl$$EnhancerByCGLIB$$971ccf12.executeQuery(<generated>) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118) at org.hibernate.loader.Loader.getResultSet(Loader.java:1197) at org.hibernate.loader.Loader.doQuery(Loader.java:366) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:206) at org.hibernate.loader.Loader.loadEntity(Loader.java:1271)

    Hibernate JIRA | 1 decade ago | umesh phirke
    org.hibernate.exception.SQLGrammarException: could not load an entity: [PCode#1]
  2. 0

    Hi, I am trying to use MS SQL Stored Procedures (SQL 2K) )from Hibernate.(Hibernate 3.0.3) My named query is cached. (With a Default Region + Default Settings) My First time load is working without error. When I try to access it second time I get a the following error. From Log I can see that the the "UpdateTimestampsCache" is getting missed. After that It tried to load the object from the database. The initial loading was done using Stroed Procedure and the second time Hiberante tries to load it using normal "SQL" which it is not supposed to do. It is suppoed to use the StoredProcedure to load the objects. Is any one else is having similar issues? Is there any fix for this Thanks, patkeep. FYI:------- org.hibernate.exception.SQLGrammarException: could not load an entity: [PCode#1] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.loadEntity(Loader.java:1285) at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:141) at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:126) at org.hibernate.persister.entity.BasicEntityPersister.load(BasicEntityPersister.java:2496) at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:387) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:368) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:166) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:140) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:119) at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:577) at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:59) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:80) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134) at PCode$$EnhancerByCGLIB$$d1a01281.getProcedureCode(<generated>) at MCode.load(LoadNomenclatures.java:89) Caused by: com.inet.tds.SQLException: Msg 208, Level 16, State 1, Line 1, Sqlstate S0002 [SQLBOX]Invalid object name 'AutoId'. at com.inet.tds.a.a(Unknown Source) at com.inet.tds.g.if(Unknown Source) at com.inet.tds.g.a(Unknown Source) at com.inet.tds.g.for(Unknown Source) at com.inet.tds.c.int(Unknown Source) at com.inet.tds.c.executeQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:68) at org.logicalcobwebs.cglib.proxy.Proxy$ProxyImpl$$EnhancerByCGLIB$$971ccf12.executeQuery(<generated>) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118) at org.hibernate.loader.Loader.getResultSet(Loader.java:1197) at org.hibernate.loader.Loader.doQuery(Loader.java:366) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:206) at org.hibernate.loader.Loader.loadEntity(Loader.java:1271)

    Hibernate JIRA | 1 decade ago | umesh phirke
    org.hibernate.exception.SQLGrammarException: could not load an entity: [PCode#1]
  3. 0

    Hibernate Community • View topic - org.hibernate.exception.SQLGrammarException:

    hibernate.org | 11 months ago
    org.hibernate.exception.SQLGrammarException: could not insert: [org.Login]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    SQLException not thrown with connection from data source

    Oracle Community | 1 decade ago | 666705
    com.inet.tds.SQLException: Msg 2627, Level 14, State 2, Line 1, Sqlstate 23000 [CS]Violation of UNIQUE KEY constraint 'UQ__BROKERAGE_HOUSE__40064DAA'. Cannot insert duplicate key in object 'BROKERAGE_HOUSE'.
  6. 0

    SQLException not thrown with connection from data source

    Oracle Community | 1 decade ago | 666705
    com.inet.tds.SQLException: Msg 2627, Level 14, State 2, Line 1, Sqlstate 23000 [CS]Violation of UNIQUE KEY constraint 'UQ__OFFICE__4CA12EB9'. Cannot insert duplicate key in object 'OFFICE'.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.inet.tds.SQLException

      Msg 208, Level 16, State 1, Line 1, Sqlstate S0002 [SQLBOX]Invalid object name 'AutoId'.

      at com.inet.tds.a.a()
    2. com.inet.tds
      c.executeQuery
      1. com.inet.tds.a.a(Unknown Source)
      2. com.inet.tds.g.if(Unknown Source)
      3. com.inet.tds.g.a(Unknown Source)
      4. com.inet.tds.g.for(Unknown Source)
      5. com.inet.tds.c.int(Unknown Source)
      6. com.inet.tds.c.executeQuery(Unknown Source)
      6 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:324)
      3 frames
    4. org.logicalcobwebs.proxool
      ProxyStatement.invoke
      1. org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:68)
      1 frame
    5. org.logicalcobwebs.cglib
      Proxy$ProxyImpl$$EnhancerByCGLIB$$971ccf12.executeQuery
      1. org.logicalcobwebs.cglib.proxy.Proxy$ProxyImpl$$EnhancerByCGLIB$$971ccf12.executeQuery(<generated>)
      1 frame
    6. Hibernate
      Loader.loadEntity
      1. org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118)
      2. org.hibernate.loader.Loader.getResultSet(Loader.java:1197)
      3. org.hibernate.loader.Loader.doQuery(Loader.java:366)
      4. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:206)
      5. org.hibernate.loader.Loader.loadEntity(Loader.java:1271)
      5 frames