[jboss-user] [JBoss Seam] - Re: two basic questions for EntityHome
wschwendt
do-not-reply at jboss.com
Wed Jul 11 19:52:32 EDT 2007
"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
More information about the jboss-user
mailing list