[Hibernate-JIRA] Created: (HHH-3119) LazyInitializationException from 3.2.4+ onward
by Nick de Graeve (JIRA)
LazyInitializationException from 3.2.4+ onward
----------------------------------------------
Key: HHH-3119
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3119
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6, 3.2.5, 3.2.4.sp1, 3.2.4
Reporter: Nick de Graeve
Priority: Blocker
We used to run JBoss 4.0.4.GA and we included Hibernate 3.2.0CR2 ourselves. Now we migrated to JBoss 4.2.2.GA and in that one Hibernate 3.2.4.sp1 is included by default.
Unfortunately, we're getting LazyInitializationException when the object graph is more than 2 levels deep.
E.g. RtTask --[OK]--> Priority --[FAIL]--> DictionaryEntry
We haven't changed anything to our beans or configuration files.
I did find out that v.3.2.4 is the first version that throws the exception.
Example stack trace:
2008-02-18 13:52:35,425 ERROR [org.hibernate.LazyInitializationException] could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:166)
at com.fpc.nokeos.core.common.beans.persistent.Priority_$$_javassist_13.getEntryName(Priority_$$_javassist_13.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:585)
at com.fpc.nokeos.core.server.dictionary.DictionaryContext.getField(DictionaryContext.java:319)
at com.fpc.nokeos.core.server.dictionary.DictionaryContext.preparePojoAfterGetting(DictionaryContext.java:276)
at com.fpc.nokeos.component.controlpanel.task.server.business.ControlPanelPluginTaskHelper.cleanRtTask(ControlPanelPluginTaskHelper.java:184)
at com.fpc.nokeos.component.controlpanel.task.server.business.ControlPanelPluginTaskHelper.executeQueryToGetCPItem(ControlPanelPluginTaskHelper.java:575)
at com.fpc.nokeos.component.controlpanel.task.server.business.ControlPanelPluginTaskHelper.getControlPanelItemsByFilter(ControlPanelPluginTaskHelper.java:525)
at com.fpc.nokeos.component.controlpanel.task.server.ejb.ControlPanelPluginTaskBean.getControlPanelItemsByFilter(ControlPanelPluginTaskBean.java:59)
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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
2008-02-18 13:52:35,534 ERROR [com.fpc.nokeos.core.server.dictionary.DictionaryContext] Could not get field 'NAME'.
java.lang.reflect.InvocationTargetException
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 com.fpc.nokeos.core.server.dictionary.DictionaryContext.getField(DictionaryContext.java:319)
at com.fpc.nokeos.core.server.dictionary.DictionaryContext.preparePojoAfterGetting(DictionaryContext.java:276)
at com.fpc.nokeos.component.controlpanel.task.server.business.ControlPanelPluginTaskHelper.cleanRtTask(ControlPanelPluginTaskHelper.java:184)
at com.fpc.nokeos.component.controlpanel.task.server.business.ControlPanelPluginTaskHelper.executeQueryToGetCPItem(ControlPanelPluginTaskHelper.java:575)
at com.fpc.nokeos.component.controlpanel.task.server.business.ControlPanelPluginTaskHelper.getControlPanelItemsByFilter(ControlPanelPluginTaskHelper.java:525)
at com.fpc.nokeos.component.controlpanel.task.server.ejb.ControlPanelPluginTaskBean.getControlPanelItemsByFilter(ControlPanelPluginTaskBean.java:59)
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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
Caused by: org.hibernate.LazyInitializationException: could not initialize proxy - no Session
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:166)
at com.fpc.nokeos.core.common.beans.persistent.Priority_$$_javassist_13.getEntryName(Priority_$$_javassist_13.java)
... 46 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 6 months
[Hibernate-JIRA] Commented: (HHH-1759) ClasscQueryTranslator do not make SQL Function substitution
by Sandeep Vaid (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1759?page=c... ]
Sandeep Vaid commented on HHH-1759:
-----------------------------------
Steve, yes i am using weblogic 8 and hence forced to use ClassicQueryTranslatorFactory.
and if i elaborate more on this problem, i get different different error messages in the following 2 cases :
CASE 1: I have extended the DB2Dialect and defined my own function:
registerFunction("svminus1", new SQLFunctionTemplate( Hibernate.TIME, "current time") );
HQL: select svminus1() from Temp c where c.id=1
SQL: select svminus1() as col_0_0_ from TEMP c where c.id=1
The error message is :
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0440N No authorized routine named "SVMINUS1" of type "FUNCTION"
having compatible arguments was found. SQLSTATE=42884
NOTE: In this case, while converting HQL to SQL it has not replaced my custom function name by it's definition.
CASE 2:
registerFunction("svminus1", new NoArgSQLFunction("current time", Hibernate.TIME, false) );
This time the error is :
org.hibernate.QueryException: aggregate function expected before ( in SELECT [select svminus1() from Temp c where c.id=1]
> ClasscQueryTranslator do not make SQL Function substitution
> -----------------------------------------------------------
>
> Key: HHH-1759
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1759
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.3
> Environment: Hibernate 3.1.3, JDK 1.5.0_05, MySQL 4.0.20d, Tomcat 5.5.15
> Reporter: Andrey Grebnev
>
> I have already asked about this problem in forum http://forum.hibernate.org/viewtopic.php?t=959442 but I did not get answer.
> below my text from forum's question:
> Hello
> I have faced with the following problem. I use Hibernate-3.1.3 with ClassicQueryTranslatorFactory under MySQL 4.0.20d.
> I need the SQL function "day". MySQL 4.0 does not have day function, but it has equal "dayofmonth". MySQLDialect.java has the following definition:
> registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
> In order to have compatibility both with MySQL 4.0 and above I have written my own Dialect which override day function in the following way:
> registerFunction("day", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
> With ASTQueryTranslator this dialect works corrrectly, but with Classic one it does not work!!!
> I have examined Hibernate SRC and have found out that we have follwing code in the org.hibernate.hql.classic.SelectParser: 126
> else if ( getFunction( lctoken, q ) != null && token.equals( q.unalias( token ) ) ) {
> // the name of an SQL function
> if ( !ready ) throw new QueryException( ", expected before aggregate function in SELECT: " + token );
> aggregate = true;
> aggregateAddSelectScalar = true;
> aggregateFuncTokenList.add( lctoken );
> ready = false;
> q.appendScalarSelectToken( token );
> if ( !aggregateHasArgs( lctoken, q ) ) {
> q.addSelectScalar( aggregateType( aggregateFuncTokenList, null, q ) );
> if ( !aggregateFuncNoArgsHasParenthesis( lctoken, q ) ) {
> aggregateFuncTokenList.removeLast();
> if ( aggregateFuncTokenList.size() < 1 ) {
> aggregate = false;
> ready = false;
> }
> else {
> ready = true;
> }
> }
> }
> }
>
> we can see that we call
> q.appendScalarSelectToken( token );
> function with original token, we do not use "render" method of org.hibernate.dialect.function.StandardSQLFunction.
> Is this a bug of classic translator?
> I am obliged to use Classic translator because Weblogic's problems with AST. Please give me an advice.
> Thanks beforehand.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 6 months
[Hibernate-JIRA] Created: (HHH-3956) ClassicQueryTranslatorFactory & Custom Functions Doesn't work?
by Sandeep Vaid (JIRA)
ClassicQueryTranslatorFactory & Custom Functions Doesn't work?
--------------------------------------------------------------
Key: HHH-3956
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3956
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.1
Reporter: Sandeep Vaid
I am using hibernate 3.2.1-ga version.
I have extended the DB2Dialect and defined my own function:
registerFunction("svminus1", new SQLFunctionTemplate( Hibernate.TIME, "current time") );
It is working fine with ASTQueryTranslatorFactory
HQL: select svminus1() from Temp c where c.id=1
SQL: select current time as col_0_0_ from TEMP c0_ where c0_.ID=1
But when i use ClassicQueryTranslatorFactory, it gives me errors:
HQL: select svminus1() from Temp c where c.id=1
SQL: select svminus1() as col_0_0_ from LIS.TBCONTROL controldat0_ where (controldat0_.CONTROLID=1000001221 )
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0440N No authorized routine named "SVMINUS1" of type "FUNCTION"
having compatible arguments was found. SQLSTATE=42884
Why am i getting this error?
Also when converting HQL to SQL, it hasn;t replaced my custom function with it's definition.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 6 months
[Hibernate-JIRA] Commented: (HHH-1759) ClasscQueryTranslator do not make SQL Function substitution
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1759?page=c... ]
Steve Ebersole commented on HHH-1759:
-------------------------------------
Is this really still the case with WebLogic? are they still leaking their Antlr usage?
@Sandeep Are you using WebLogic too? Is that why you "need" to use the classic parser? Otherwise, why not just use the Antlr based parser?
> ClasscQueryTranslator do not make SQL Function substitution
> -----------------------------------------------------------
>
> Key: HHH-1759
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1759
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.3
> Environment: Hibernate 3.1.3, JDK 1.5.0_05, MySQL 4.0.20d, Tomcat 5.5.15
> Reporter: Andrey Grebnev
>
> I have already asked about this problem in forum http://forum.hibernate.org/viewtopic.php?t=959442 but I did not get answer.
> below my text from forum's question:
> Hello
> I have faced with the following problem. I use Hibernate-3.1.3 with ClassicQueryTranslatorFactory under MySQL 4.0.20d.
> I need the SQL function "day". MySQL 4.0 does not have day function, but it has equal "dayofmonth". MySQLDialect.java has the following definition:
> registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
> In order to have compatibility both with MySQL 4.0 and above I have written my own Dialect which override day function in the following way:
> registerFunction("day", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
> With ASTQueryTranslator this dialect works corrrectly, but with Classic one it does not work!!!
> I have examined Hibernate SRC and have found out that we have follwing code in the org.hibernate.hql.classic.SelectParser: 126
> else if ( getFunction( lctoken, q ) != null && token.equals( q.unalias( token ) ) ) {
> // the name of an SQL function
> if ( !ready ) throw new QueryException( ", expected before aggregate function in SELECT: " + token );
> aggregate = true;
> aggregateAddSelectScalar = true;
> aggregateFuncTokenList.add( lctoken );
> ready = false;
> q.appendScalarSelectToken( token );
> if ( !aggregateHasArgs( lctoken, q ) ) {
> q.addSelectScalar( aggregateType( aggregateFuncTokenList, null, q ) );
> if ( !aggregateFuncNoArgsHasParenthesis( lctoken, q ) ) {
> aggregateFuncTokenList.removeLast();
> if ( aggregateFuncTokenList.size() < 1 ) {
> aggregate = false;
> ready = false;
> }
> else {
> ready = true;
> }
> }
> }
> }
>
> we can see that we call
> q.appendScalarSelectToken( token );
> function with original token, we do not use "render" method of org.hibernate.dialect.function.StandardSQLFunction.
> Is this a bug of classic translator?
> I am obliged to use Classic translator because Weblogic's problems with AST. Please give me an advice.
> Thanks beforehand.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 6 months