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

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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)
    via by umesh phirke,
  • 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)
    via by umesh phirke,
    • 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)
    No Bugmate found.