Constants for Java EE

When working with Java EE there are situations, in that constants occur. As there are no enums but only int constants this is a pretty tough task in case you don’t remember the values of the constants. But of course there is a solutions for that.

E.g. when having a problem with transaction handling you try to analyze the transaction state. But only an int constant occurs. Maybe you remember that 0 represents an active transaction. But in case there is a deviation to the expected state it’s good to know the meanings of all that constants that may occur.
Maybe your transation is STATUS_MARKED_ROLLBACK than the constant 9 is used.

So simply have a look into the java documentation for having an overview over all the constants used in Java EE. With that overview you are able to analyse your problem. This is applicable for all Java EE specifications. Starting with transaction handling using javax.transation.* over your persistence layer javax.persistence.*. The following describes all the constants that represent the transaction states.

Transaction States


0 STATUS_ACTIVE
1 STATUS_MARKED_ROLLBACK
2 STATUS_PREPARED
3 STATUS_COMMITTED
4 STATUS_ROLLEDBACK
5 STATUS_UNKNOWN
6 STATUS_NO_TRANSACTION
7 STATUS_PREPARING
8 STATUS_COMMITTING
9 STATUS_ROLLING_BACK

Sources

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.