Need Help with Conversions and Contexts!
bprior Mar 27, 2008 1:20 AMHi Seam Users,
Our team is developing our first production Seam app using Seam 2.1,EJB3, Hibernate JPA, Facelets, and Oracle.
After reviewing the Seam docs, we are having one heck of a time applying the concepts of Conversations and Contexts to our 2 simple Stateful EJB's. It's very similar to the 'booking' example; really just a CRUD app.
If I could describe what my app is trying to do, perhaps someone could help me with some hints on the correct approach.
The app is only one page with a clickable dataTable populated with a list of items on the right, and the item properties on the left (such as item name, item date, etc).
The dataTable is populated correctly on pageload from the Stateful Session scoped bean with @DataModel items. (like booking).
When I click on any item in the list, i simply want to view that items properties, and optionally edit that input text that has
value="#{item.name}"
Additionally, I want to 'Add Item', which simply em.persist(item) a new item, then repopulates the list with the new item, highlighting that new item at the top of the list ready to edit (there is always an 'selectedItem').
That's really it.
We are experiencing behaviour that we don't understand that we think is related to the Seam contexts and conversions that we don't understand well, and that we probably don't have set correctly for what we are trying to do.
For example:
Question: When we edit the item's name (any item property really) it seem's to 'save' the edit (to the cache?), because when we click on another item, then return to item, we see that change. But if some other user in another browser clicks on that item, they don't see the change.
Our business logic is that once someone edits that items properties (like the item name), anyone in any session should be able to see that change.
Interestingly, when we stop the app server, the cache must 'flush' to the database, because we see all the correct changes to the properties. We are not concerned that the database is not updated (yet); that's what the cache is for. But we do want others to see those changes somehow.
We think we don't have our @Scope's set correctly for our 2 EJB's for the business logic we want our app to support;
List all the items.
Add a new item, then see it in the list immediatly.
edit any item's property; any other users can see that change immediatly.
Our EJB's and Entities seem functionally correct, but we don't seem to be in the correct 'conversation' or 'scope', especially for 'edit'.
We are a bit stuck on this. We would very appreciative of any help or advice.
Thanks,
.Burt