[JBoss Seam] - Re: two basic questions for EntityHome
by wschwendt
"azalea" wrote : I'm writing a CRUD app using a extended EntityHome class.
|
| I want to reuse one EntityHome instance for more than one CRUD operations in a long-running conversation.
| But EntityHome instance is caching the entity and other states.
| I'm confusing...
| Does EntityHome provide such a reset method now?
|
thanks for asking this question! Incidentally, I spent the last 5 hours on this before looking into this forum and discovering that someone else is interested in this topic.
My idea (that doesn't work yet):
In my class that extends EntityHome/Customer\, where Customer is the type of my example Entity, I thought about adding the following method:
| public String reset() {
| log.debug("wos: kundeHome.reset() called");
| setInstance(null);
| setId(null);
| return "reset";
| }
|
One thing to note is that not only the instance property needs to set to null, but also the id property. If only the instance property is null, but the id property remains at the old value, then when getInstance() is called, initInstance() of org.jboss.seam.framework.Home tries to load the old entity again.
But my approach doesn't work yet. And for some reason I don't know, the instance property of my EntityHome component gets exported to Conversation scope. Why???
For example, if my EntityHome component is named "customerHome", then in Conversation scope the context variable customerHome.instance gets set. I'd like to know why. I looked at the code of EntityHome/E\ and Home/EntityManager, E\, but I do not find where and why customerHome.instance gets set.
Any hints would be highly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063270#4063270
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063270
18Â years, 11Â months
[JBoss Seam] - Configuring POJOs as Seam Components in components.xml
by youngm
I'm using 1.2.0.nightly
Is it legal to configure POJOs as Seam components in components.xml?
For example:
<component name="expanderState" class="java.util.HashMap" auto-create="true" scope="conversation"/>
I get:
| java.lang.RuntimeException: Could not create Component: expanderState
| at org.jboss.seam.init.Initialization.addComponent(Initialization.java:910)
| at org.jboss.seam.init.Initialization.installComponents(Initialization.java:841)
| at org.jboss.seam.init.Initialization.init(Initialization.java:508)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
| at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
| at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
| at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
| at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
| at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
| at org.apache.catalina.core.StandardService.start(StandardService.java:448)
| at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
| at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| at java.lang.reflect.Method.invoke(Method.java:615)
| at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
| at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
| Caused by:
| java.lang.NullPointerException
| at org.jboss.seam.init.DeploymentDescriptor.<init>(DeploymentDescriptor.java:33)
| at org.jboss.seam.Seam.getEjbDescriptor(Seam.java:51)
| at org.jboss.seam.Seam.getComponentType(Seam.java:102)
| at org.jboss.seam.Component.<init>(Component.java:216)
| at org.jboss.seam.Component.<init>(Component.java:207)
| at org.jboss.seam.init.Initialization.addComponent(Initialization.java:896)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063266#4063266
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063266
18Â years, 11Â months