Initializing relationships in orm entities

178 views
Skip to first unread message

d1rtym0nk3y

unread,
May 16, 2012, 1:13:58 PM5/16/12
to ra...@googlegroups.com
I have a Product entity with a one-to-many relationship to Image, mapped like this

property name="Images" cfc="ProductImage" fieldtype="one-to-many" 
         singularname="Image" inverse="true" lazy="true";

By default variables.images is null when a Product is created so i want to initialize the relationship either in the pseudo constructor or the init method. As this relationship is an array i do;

variables.images = [];

but i get this error..

railo.runtime.type.ArrayImpl cannot be cast to org.hibernate.collection.PersistentCollection 

So what have i missed ?
Cheers, Chris


Greg Moser

unread,
Jun 14, 2012, 12:29:11 PM6/14/12
to ra...@googlegroups.com
I am running into the same issue, did you find a solution to this issue ever?

-Greg

Chris Blackwell

unread,
Jun 14, 2012, 4:27:50 PM6/14/12
to ra...@googlegroups.com
nope not yet, should probably post a bug report

Michael Offner

unread,
Jun 15, 2012, 4:19:56 PM6/15/12
to ra...@googlegroups.com
Please open a ticket in jira for this, do you have a java stack trace for this?
Of course a test case would help a lot.

/micha

Von meinem iPad gesendet

Greg Moser

unread,
Jul 10, 2012, 11:45:42 AM7/10/12
to ra...@googlegroups.com
Hey Chris,

I run into this error in my application, and I've been trying for the past couple of weeks to create a test case, but for some reason i can't reproduce in a simple example.  Are you able to build a test case so that I can open up an issue for Michael?

-Greg

Greg Moser

unread,
Aug 27, 2012, 2:58:21 PM8/27/12
to ra...@googlegroups.com
I have opened an issue for this because it still persists on the latest bleeding edge version of railo 3.3.5.003


Unfortunately I have not been able to create a testcase that is simple outside of our Slatwall software.  But when I comment out the line in our base entities init method that sets variables.xxx = []; then I no longer get this error.

-Greg

Greg Moser

unread,
Aug 27, 2012, 4:40:45 PM8/27/12
to ra...@googlegroups.com
I finally was able to reproduce this issue as a test-case and it turns out that at least for me... it has nothing to do with variables.xxx = [] in the constructor.  In my case it had to do with setting a new entity as both a many-to-one and one-to-many  of another entity... and then also calling a setter in the preInsert.

-Greg

Gert Franz

unread,
Aug 27, 2012, 4:55:31 PM8/27/12
to ra...@googlegroups.com
Can you provide this test case?

Maybe in a/the existing JIRA ticket?

Gert

Sent from my iPhone

Greg Moser

unread,
Aug 27, 2012, 5:03:47 PM8/27/12
to ra...@googlegroups.com
Ya, I added the test case on that jira issue.  You guys should have everything you need... there are actually 3 test cases but the one attached called (railo_2049_moresimple) is probably the simplest representation of the problem.

-Greg

Seth Johnson

unread,
Jan 24, 2013, 4:39:11 AM1/24/13
to ra...@googlegroups.com
Hi Guys,

I'm bumping up against this error as well, here's a stack trace.

railo.runtime.type.ArrayImpl cannot be cast to org.hibernate.collection.PersistentCollection at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:57):57 at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:124):124 at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:84):84 at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:78):78 at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:165):165 at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219):219 at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99):99 at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50):50 at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206):1206 at railo.runtime.orm.hibernate.HibernateORMSession.flush(HibernateORMSession.java:106):106 at railo.runtime.functions.orm.ORMFlush.call(ORMFlush.java:12):12 at com.dao.basedao_cfc$cf._1(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\com\dao\BaseDAO.cfc:115):115 at com.dao.basedao_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\com\dao\BaseDAO.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607 at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490 at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at plugins.slatwall.application_cfc$cf._1(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\Application.cfc:320):320 at plugins.slatwall.application_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\Application.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:774):774 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at plugins.slatwall.application_cfc$cf._1(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\Application.cfc:285):285 at plugins.slatwall.application_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\Application.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:774):774 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at plugins.slatwall.org.fw1.framework_cfc$cf._9(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\org\fw1\framework.cfc:1735):1735 at plugins.slatwall.org.fw1.framework_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\org\fw1\framework.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:774):774 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at plugins.slatwall.org.fw1.framework_cfc$cf._4(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\org\fw1\framework.cfc:877):877 at plugins.slatwall.org.fw1.framework_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\org\fw1\framework.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275 at railo.runtime.ComponentImpl._call(ComponentImpl.java:608):608 at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490 at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1800):1800 at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:749):749 at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1521):1521 at admin.controllers.basecontroller_cfc$cf._2(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\admin\controllers\BaseController.cfc:444):444 at admin.controllers.basecontroller_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\admin\controllers\BaseController.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:774):774 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at admin.controllers.basecontroller_cfc$cf._1(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\admin\controllers\BaseController.cfc:267):267 at admin.controllers.basecontroller_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\admin\controllers\BaseController.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275 at railo.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:783):783 at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:749):749 at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1521):1521 at admin.controllers.basecontroller_cfc$cf._1(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\admin\controllers\BaseController.cfc:143):143 at admin.controllers.basecontroller_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\admin\controllers\BaseController.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607 at railo.runtime.ComponentImpl.onMissingMethod(ComponentImpl.java:531):531 at railo.runtime.ComponentImpl._call(ComponentImpl.java:492):492 at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1800):1800 at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:749):749 at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:743):743 at railo.runtime.util.VariableUtilImpl.callFunction(VariableUtilImpl.java:709):709 at railo.runtime.interpreter.ref.func.UDFCall.getValue(UDFCall.java:47):47 at railo.runtime.interpreter.CFMLExpressionInterpreter.interpret(CFMLExpressionInterpreter.java:188):188 at railo.runtime.functions.dynamicEvaluation.Evaluate._call(Evaluate.java:77):77 at railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:70):70 at railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:23):23 at plugins.slatwall.org.fw1.framework_cfc$cf._6(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\org\fw1\framework.cfc:1110):1110 at plugins.slatwall.org.fw1.framework_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\org\fw1\framework.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:774):774 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at plugins.slatwall.org.fw1.framework_cfc$cf._4(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\org\fw1\framework.cfc:623):623 at plugins.slatwall.org.fw1.framework_cfc$cf.udfCall(C:\Inetpub\wwwroot\dpwaterer_slatwall\plugins\Slatwall\org\fw1\framework.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607 at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490 at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781 at railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:346):346 at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:181):181 at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:18):18 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2255):2255 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2222):2222 at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:310):310 at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:29):29 at javax.servlet.http.HttpServlet.service(HttpServlet.java:722):722 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304):304 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224):224 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169):169 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472):472 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168):168 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100):100 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118):118 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405):405 at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200):200 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515):515 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302):302 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source):-1 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source):-1 at java.lang.Thread.run(Unknown Source):-1

Seth

On Monday, September 24, 2012 3:52:50 PM UTC-4, Lance wrote:
I have read this and similar post (mostly by Greg) on this subject but don't see a fix.

I have a brand new install of railo, mura and slatwall.  and when I try to add my first product I get the error

maximal dump level reached

railo.runtime.type.ArrayImpl cannot be cast to org.hibernate.collection.PersistentCollection

I am not sure if I have set something up wrong but I was able to add a brand but then when I tried to add a product I get an error that looks to be buried very deep in railo.  

How do I fix this?

Reply all
Reply to author
Forward
0 new messages