-
1. Re: @DataModel modifications
gzoller Apr 5, 2007 1:44 PM (in response to georgesberscheid)I don't know if this is a best-practice or not, but what I'm doing is in my display page, say foo.xhtml, I have foo.page.xml that has an action tag that executes a refresh() method in the component managing my list.
In this refresh() method I forcibly call the factory method to reload the list.
Like I said--not sure if this is the best/preferred way to do it, but it seems to work well. If anyone knows of a more graceful way of getting around any caching I'd be interested to know as well.
Greg -
2. Re: @DataModel modifications
fhh Apr 5, 2007 1:55 PM (in response to georgesberscheid)
I have a @DataModel (HashSet myEntries) in a SESSION-scoped JAVABEAN Seam component. (...) Is the initial myEntries Set (as returned from the @Factory method) cached somewhere?
Yes. It is session scoped so it is "cached" in the session.
You could simply add the entity to your set after it has been persisted/merged. This will save you a trip to the database.
Regards
Felix -
3. Re: @DataModel modifications
georgesberscheid Apr 5, 2007 5:28 PM (in response to georgesberscheid)Ok, a few more details. The entity itself is not a Seam component, so it doesn't have a Seam context. The Java Bean I'm talking about is a SESSION scoped Seam component that simply holds the Set of entities.
I did add the entity to the Set, but my DataTable doesn't display it. Also, refreshing it from the database would be a little overkill, since it's already in the Set. When does the DataTable read the contents of the Set annotated with @DataModel? -
4. Re: @DataModel modifications
fhh Apr 5, 2007 6:52 PM (in response to georgesberscheid)If you change the collection on which the @Datamodel is based you have to reoutject the @Datamodel. Either annotate you action component accordingly or use a scope such that the life span of the @Datamodel will fit your needs, e.g. eject it into the conversation and end the conversation on deleting the entities.
Regards
Felix -
5. Re: @DataModel modifications
rhinosystemsinc Jun 8, 2007 4:06 AM (in response to georgesberscheid)Georges,
I am having almost the same problem. My scenario is different, but the DataModel is being cached... and if I change the datamodel to stateless or the SFSB to SLSB, it complains w/ exceptions.
How did you solve your problem?
Can you give me code samples?
Thanks! -
6. Re: @DataModel modifications
gavin.king Jun 8, 2007 2:09 PM (in response to georgesberscheid)"georgesberscheid" wrote:
Ok, a few more details. The entity itself is not a Seam component, so it doesn't have a Seam context. The Java Bean I'm talking about is a SESSION scoped Seam component that simply holds the Set of entities.
I did add the entity to the Set, but my DataTable doesn't display it. Also, refreshing it from the database would be a little overkill, since it's already in the Set. When does the DataTable read the contents of the Set annotated with @DataModel?
This might be a bug that I just fixed in CVS.
Try with this new implementation of SetDataModel:
http://fisheye.jboss.com/browse/~raw,r=1.4/JBoss/jboss-seam/src/main/org/jboss/seam/jsf/SetDataModel.java