As long as any given enum instance that corresponds to a theoretically-unique enum value has internally-consistent state, we should be in good shape. IOW, if the enum constructors are called appropriately or internal state is otherwise maintained, then things should work out fine.
-Patrick -- Patrick Linskey BEA Systems, Inc. _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 10, 2007 4:56 PM > To: open-jpa-dev@incubator.apache.org > Subject: Re: OPENJPA-182: reuse Connection constants or > create our own? > > It should be ok anyway in the same VM. Unfortunately I had > conflicting messages > on weather it's the name or the ordinal that is guaranteed to > work across the > VMs :(. > > -marina > > Patrick Linskey wrote: > > Fascinating. Happily, as it turns out, we never compare these things > > directly; instead, we extract a value from the enums and > use that. The > > value is populated in the enum constructor: > > > > public enum IsolationLevel { > > DEFAULT(-1), > > NONE(Connection.TRANSACTION_NONE), > > READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED), > > READ_COMMITTED(Connection.TRANSACTION_READ_COMMITTED), > > REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ), > > SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE); > > > > private final int _connectionConstant; > > > > private IsolationLevel(int connectionConstant) { > > _connectionConstant = connectionConstant; > > } > > > > protected int getConnectionConstant() { > > return _connectionConstant; > > } > > } > > > > Do you know if the getConnectionConstant() method would > return the same > > value for different instances of the "same" module? > > > > -Patrick > > > > Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.