|
There are some questions concerning the validation of data.
I use Hibernate + Session Bean which implementing DAO-pattern
(the server of attachments JBoss)
1) How to work over the exceptions in case the attribute
TransactionStrategy within jboss-service.xml file is set in
CMTTransactionFactory. As far as I understand, in that case the container
performs all the Transaction Managing functions. Can it really be that the
container itself intercepts all the exceptions thrown out by Hibernate? The
point is I'd like to carry out the validation of data on the level of
Hibernate. For example, the universality of a field is broken. The
exception ConstraintViolationException must throw. I try to
catch it at block, but in practice, the block is never carried out. But if
we look at log-file we'll see that the exception really appeared. How in
that case can I catch the exception and work it over? Or, if I want to do
so, only the case with using JTATransactionStrategy is possible?
2) Please give me the e-reference where I can find info on the validation
of data on the side of Hibernate with the use of Annotations. I've read the
documentation on Hibernate Annotations, but I still don't understand how
Validation Framework is organized. Could anybody set me a more detailed
example? I see how to set restrictions on bean-a characteristics using the
annotations. What's not clear is how to catch the unnecessary validation.
|