Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] SessionCustomizer to modify/detect database platform: impossible

On Thu, Feb 21, 2013 at 10:15 AM, Tom Ware <tom.ware@xxxxxxxxxx> wrote:
I did this originally.  The very next thing that happens is
DatabaseSessionImpl.loginAndDetectDatasource blows the platform away.  See line
687 (on the trunk) of DatabaseSessionImpl.java and preceding.  :-(

I see this code in login in 2.3.2:

    protected static void login(DatabaseSessionImpl session, Map properties) {
        String eclipselinkPlatform = (String)properties.get(PersistenceUnitProperties.TARGET_DATABASE);
        if (!session.isConnected()) {
            if (eclipselinkPlatform == null || eclipselinkPlatform.equals(TargetDatabase.Auto) || session.isBroker()) {
                // if user has not specified a database platform, try to detect
                session.loginAndDetectDatasource();
            } else {
                session.login();
            }
        }
    }

Based on the code above, when you have a target database set, we should not go into loginAndDetectDAtasource.  Is your experience something different.

No, I think I didn't try the combination you're suggesting (explicitly specify a platform (the "wrong" platform) AND then run my auto-detection logic (really, just emulate yours) DURING a preLogin() event.  I've done some combination of that with the SessionCustomizer (that's what I was thinking of) but it looks like setting the target platform to a "dummy" value may get me out of the woods here....

Best,
Laird

--
http://about.me/lairdnelson

Back to the top