Replacement for org.hibernate.Transactions.isActive() in Hibernate 5
Asked Answered
M

1

5

I'm migrating from hibernate 4.2.17 to 5.0.7 which works fine so far, but it seems that the method isActive is deprecated. I just can't use it anymore.

Here's my code:

public void starteTransaktion() {
        try {
            getMySession();

            if(!hibernateSession.getTransaction().isActive()) {
                hibernateSession.beginTransaction();
            }
        } catch (HibernateException e) {

        }
    }

I substituted all other methods, but I can't quite find a replacement for this...

Error message: The method isActive() is undefined for the type Transaction

Matriculate answered 15/1, 2016 at 10:31 Comment(0)
C
11

As per 5.0 Javadoc:

hibernateSession.getTransaction().getStatus() != TransactionStatus.ACTIVE

Cowrie answered 15/1, 2016 at 10:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.