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

org.eclipse.persistence.platform.database.DatabasePlatform is likely a good dummy value. (the same as the default)

On 21/02/2013 1:19 PM, Laird Nelson wrote:
On Thu, Feb 21, 2013 at 10:15 AM, Tom Ware <tom.ware@xxxxxxxxxx
<mailto: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


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top