[JBoss Seam] - Beginning conversations in @Factory methods
by iradix
I have a pretty typical CRUD application. A @DataModel is generated by a @Factory method which is also annotated with @Begin(join = true); so far so good. However when a create operation occurs the corresponding method is annotated with @End and this is where things go wrong. If I don't set the list to null my subsequent page displays the list generated by the ended conversation, even though I've issued a redirect. I'd imagine this is because a conversation's state is not cleared until a response is rendered? Anyway, if I do set the list to null, it seems that the @DataModel annotation causes the @Factory method to be called directly after the create method thereby re-propogating the conversation I just tried to end. I can't seem to find a way around this. Any suggestions on how to fix the problem or an alternate design?
-Dave
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957108#3957108
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957108
19 years, 9 months
[JBossCache] - Re: TreeCache/Hibernate/JBossAS optimistic locking problem
by steve.ebersole@jboss.com
Here is the test to which I refer, which works (from the Hibernate test suite):
| public void testNoVersioningProvided() throws Throwable {
| // note : mimic query cache interactions...
| Fqn fqn = Fqn.fromString( "org/hibernate/querycache" );
| TreeCache treeCache = ( ( OptimisticTreeCacheProvider ) sfi().getSettings().getCacheProvider() ).getUnderlyingCache();
|
| Long long1 = new Long(1);
| Long long2 = new Long(2);
|
| Option option = new Option();
| option.setFailSilently( true );
|
| try {
| System.out.println( "****** General put... *******************************************" );
| DummyTransactionManager.INSTANCE.begin();
| treeCache.put( fqn, "ITEM1", long1, option );
| DummyTransactionManager.INSTANCE.commit();
| System.out.println( "****** General put... *******************************************" );
| DummyTransactionManager.INSTANCE.begin();
| treeCache.put( fqn, "ITEM1", long2, option );
| DummyTransactionManager.INSTANCE.commit();
|
| System.out.println( "****** General put... *******************************************" );
| DummyTransactionManager.INSTANCE.begin();
| treeCache.put( fqn, "ITEM2", long1, option );
| DummyTransactionManager.INSTANCE.commit();
|
| // try puts outside scope of transaction...
| System.out.println( "****** No-txn put... *******************************************" );
| treeCache.put( fqn, "ITEM1", long2, option );
| System.out.println( "****** No-txn put... *******************************************" );
| treeCache.put( fqn, "ITEM2", long2, option );
|
| // actual processing in handling a cached query
| System.out.println( "****** actual query cache put logic ****************************" );
| DummyTransactionManager.INSTANCE.begin();
| if ( treeCache.get( fqn, "ITEM3", option ) == null ) {
| // run the query, then put...
| treeCache.put( fqn, "ITEM3", long1, option );
| }
| System.out.println( "****** actual query cache put logic ****************************" );
| if ( treeCache.get( fqn, "ITEM3", option ) == null ) {
| // run the query, then put...
| treeCache.put( fqn, "ITEM3", long1, option );
| }
| DummyTransactionManager.INSTANCE.commit();
|
| // actual processing in handling a cached query (no txn)
| System.out.println( "****** actual query cache put logic ****************************" );
| if ( treeCache.get( fqn, "ITEM3", option ) == null ) {
| // run the query, then put...
| treeCache.put( fqn, "ITEM3", long1, option );
| }
| System.out.println( "****** actual query cache put logic ****************************" );
| if ( treeCache.get( fqn, "ITEM3", option ) == null ) {
| // run the query, then put...
| treeCache.put( fqn, "ITEM3", long1, option );
| }
| }
| finally {
| try {
| treeCache.remove( fqn, "ITEM1", option );
| treeCache.remove( fqn, "ITEM2", option );
| treeCache.remove( fqn, "ITEM3", option );
| }
| catch( Throwable ignore ) {
| }
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957101#3957101
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957101
19 years, 9 months