-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: events and exceptions
PostPosted: Fri Jan 06, 2006 10:40 am 
Beginner
Beginner

Joined: Fri Oct 28, 2005 7:11 am
Posts: 20
In the application I need to built in validation rule framework.
The requirement is that:
- rule has to be checked when main object is deleted/created/updates;
- rule has to be checked when dependent object is deleted/created/updates (depended means in collection);

Choices:
1. Lifecycle interface
Problem: on Update works in strange why, it isn't fired when 'update' goes to db, don't know when it is fired.
Descision: Skip it.
2. Interceptor
The same as in 1.
3. New and preffered is Event.
preInsert, preUpdate, preDelete works like a charm.
Only problem is that when throwing the exception (when rule is broken) it generates ugly JBoss log:

15:23:26,411 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract java.lang.Long xxx.MyObject.updateObject(dto) throws java.lang.Exception, causedBy:
org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=tbech-c/17, BranchQual=, localId=17] status=STATUS_NO_TRANSACTION; - nested throwable: (xxx.MyRuleException)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:354)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:486)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:346)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)

Is there any way to get rid of this log, when RuleException is thrown, but to have log in all other cases? Or different kind of exception should be thrown from event?

And, generaly, is my approach of using events for rule validation correct or there is other better way to implement it,


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.