[JBoss Seam] - Re: how can I do optimistic locking with crud framework?
by cja987
I'm probably doing this completely wrong... I took contactHome out of components.xml and replaced it with this class:
| @Name("contactHome")
| @Scope(ScopeType.CONVERSATION)
| public class ContactHome extends EntityHome<Contact> {
|
| @Logger
| private Log log;
|
| public ContactHome() {
| super();
| setCreatedMessage("New contact #{contact.firstName} #{contact.lastName} created");
| setDeletedMessage("Contact #{contact.firstName} #{contact.lastName} deleted");
| setUpdatedMessage("Contact #{contact.firstName} #{contact.lastName} updated");
|
| }
|
| @Begin
| public String beginEdit() {
| log.info("Conversation begun by beginEdit()");
| return null;
| }
|
| @End
| public String update() {
| log.info("Conversation ended by update()");
| return super.update();
| }
|
| @Factory("contact")
| public Contact initContact() {
| return getInstance();
| }
| }
|
|
And I edited pages.xml to add the beginEdit action:
| <page view-id="/editContact.xhtml" action="#{contactHome.beginEdit}">
| <param name="contactId" value="#{contactHome.id}" converterId="javax.faces.Long"/>
| </page>
|
Everything works the way it did before (including "last edit wins") though now I get a traceback on the console after update:
| 14:22:42,553 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
| java.lang.IllegalStateException: EntityManager is closed
| at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:41)
| at org.hibernate.ejb.AbstractEntityManagerImpl.getReference(AbstractEntityManagerImpl.java:137)
| at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.entityIdsToRefs(ManagedEntityIdentityInterceptor.java:156)
| at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:76)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979488#3979488
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979488
19 years, 8 months
[JBoss Portal] - Re: programmatically disabling caching
by jlacy
Yes, as a matter of fact I got back to this issue a few days ago and hadn?t got around to posting my findings.
Unless I am missing something, it doesn?t appear that this was implemented anywhere (as of the 2.4 final release). I believe the problem is on line 65 of
org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor.invoke(). The cache expiration value is being updated on each request using the configured EXPIRATION_CACHE value regardless of whether an EXPIRATION_CACHE property was set on the response. I added the following test which seems to work based on what little testing I have done so far.
// Update the fragment cache info only if the value has not been overridden during render processing
| if ( fragmentResult.getProperties().getProperty(RenderResponse.EXPIRATION_CACHE) == null ) {
| fragmentResult.setExpirationSecs(cacheInfo.getExpirationSecs());
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979486#3979486
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979486
19 years, 8 months