openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
Subject RE: OPENJPA-182: reuse Connection constants or create our own?
Date Tue, 10 Apr 2007 23:49:38 GMT
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

-- 
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: Marina.Vatkina@Sun.COM [mailto:Marina.Vatkina@Sun.COM] 
> Sent: Tuesday, April 10, 2007 4:39 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: OPENJPA-182: reuse Connection constants or 
> create our own?
> 
> One note of caution about using enums - there can be a 
> problem in passing enums 
> from a client to a server using RMI-IIOP serialiazation - see 
> GlassFish issue 
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=193 for 
> some details.
> 
> regards,
> -marina
> 
> Abe White wrote:
> >>I think that JDBCFetchPlan should take a Java 5 enum, and
> >>JDBCFetchConfiguration should use the Connection values.
> > 
> > 
> > Certainly JDBCFetchConfiguration should use the Connection 
> values.  I  
> > personally have never had a problem with symbolic constants for  
> > settings, but enums for the FetchPlan are cool too.  So 
> long as the  
> > JPA QueryImpl parses the enum value and its string form correctly  
> > when using it as a hint.
> > 
> > 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.
> 
> 

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.

Mime
View raw message