do i have to open and close session and transcation in each function (make object ,delete object ,findbyID)
can u give me a DAO implenetation for findall (lazy initialization ).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should have a transaction for each complete business operation. I For instance: The operation includes selecting some values, updating it and inserting others. If each of the elementary operations create their own transaction, you will fail writing a multi-user application.
You should create the session at the beginning of the business operation, create a transaction, then perform all the operations (you ‘functions’) within that transaction, and commit or rollback them all together.
Transactions are defined in the business layer.