Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>thanks for answering me. I read through the link (spring documentation) and I found the following:</p> <p>"However, the DAO throws plain HibernateException (which is unchecked, so does not have to be declared or caught), which means that callers can only treat exceptions as generally fatal - unless they want to depend on Hibernate's own exception hierarchy. Catching specific causes such as an optimistic locking failure is not possible without tying the caller to the implementation strategy. This trade off might be acceptable to applications that are strongly Hibernate-based and/or do not need any special exception treatment."</p> <p>My DAO is based on Plain Hibernate 3 API, so if I understand it correct, my DAO only throws plain HibernateExceptions. They are unchecked and do not have to be declared or caught. If something goes wrong, with @Transactional the whole operation is rolled back.</p> <p>To make sure that everything works as I expected it to work, I have to tie my DAO even closer to my application code. There I can check for example if an object is given back or not. (if null - else) I could also catch the exception, log it and inform the user that something did go wrong and that his transaction did not work.</p> <p>So at this point, Im still thinking, that - depending on the transaction: if I can work with a result, everything is ok - if not, I can inform the user.</p> <p>when the transaction is not specified to give back a result, I can use try/catch for catching a HibernateException. But is the Transaction still rolled back then? I thought, catching an HibernateException avoids Rolling Back of the transaction. I still do not know what to do. :-(</p> <p>Beside of this unfortunately I do not understand what MVC Exception Handling (@ExceptionHandler) has to do with this. There was a table of handled exceptions, but I did not find the HibernateException. Or do you think it will work with this: @ExceptionHandler(HibernateException.classs)? also you said you would not recommend to handle exceptions this way.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload