Hi Tom 
     
    I tried running my code with the default PersistenceProvider
    implementation. But my usecase requires multiple
    EntityManagerFactory's to be instantiated. If in the PersistenceProviderResolverHolder
    I specify 
    new PersistenceProvider() in place of new
        MyPersistenceProvider() then I cannot specify the
    name of the PersistenceUnit which is not able to located the
    specific Persistence Unit. 
     
            emf =
        Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, 
                properties); 
            dynamicHelper = new JPADynamicHelper(emf); 
            serverSession = (ServerSession)
        JpaHelper.getServerSession(emf); 
     
    Can I somehow do away with the PersistenceProviderResolverHolder
    while still using the default PersistenceProvider?
    I want to avoid using a persistence.xml but if that is the
    recommended way I will use that. 
     
    Thanks 
    Rohit 
     
    On 5/31/2011 7:06 PM, Tom Ware wrote:
    Hi
      Rohit,
       
       
        I think you are only the 2nd person we have heard from on this
      group that was considering implementing their own provider.  As a
      result, we have not put alot of effort into providing that kind of
      example.
       
       
        There is quite alot of work done in our PersistenceProvider
      code.  If possible, it would likely be considerably easier to
      leverage that code.  What do you need to customize?
       
       
      -Tom
       
       
      Rohit Banga wrote:
       
        Hi Tom
         
         
        Thanks for pointing out the insufficiency of the code.
         
        Since I am not doing any customizations should I consider using
        org.eclipse.persistence.jpa.PersistenceProvider. Will that be a
        reasonable substitute?
         
        Are there any examples / documentation available for creating
        Custom Persistence Providers. Most of the documentation I could
        find is about persistence.xml.
         
         
        Thanks
         
        Rohit
         
         
        On 5/31/2011 6:40 PM, Tom Ware wrote:
         
        Hi Rohit,
           
           
            To be honest, I am surprised such a sparse implementation of
          PersistenceProvider with such a sparsely populated instance of
          SEPersistenceUnitInfo works.  If you are implementing your own
          persistence provider you will definitely have to do more work
          with things like the classloader than the typical user.  As an
          initial step, it is probably a good idea to take a look at
          every property of PersistenceUnitInfo and make sure you set it
          correctly.
           
           
          -Tom
           
           
          Rohit Banga wrote:
           
            Hi Tom
             
             
            Class.forName() does not throw the same exception.
             
             
            I figured out another way to ensure that the Class Loader is
            picked up correctly.
             
             
                  SEPersistenceUnitInfo puInfo = new
            SEPersistenceUnitInfo();
             
                 
            puInfo.setClassLoader(MyLogger.class.getClassLoader());
             
             
             
            EntityManagerSetupImpl.predeploy() contains the following
            line to merge the properties:
             
             
                        Map predeployProperties =
            mergeMaps(extendedProperties,
            persistenceUnitInfo.getProperties());
             
             
             
            The properties member variable of SEPersistenceUnitInfo and
            the actual member variables like classLoader are not in sync
            with each other.
             
            Though the setClassLoader method registers the class loader
            a call to setProperties() on the SEPersistenceUnitInfo does
            not populate the classLoader member variable.
             
            As a result the realClassLoader field in
            EntityManagerSetupImpl.predeploy() is null.
             
             
                 
            puInfo.setClassLoader(MyLogger.class.getClassLoader());
             
             
            I am not sure whether my implementation of
            PersistenceProvider is correct or not. Can you please see if
            I am missing something else in MyPersistenceProvider code I
            sent earlier?
             
             
            Thanks
             
            Rohit
             
             
            On 5/30/2011 9:19 PM, Tom Ware wrote:
             
            My best guess about your logger is
              that the string you are passing in isn't formatted
              correctly (likely due to the fact that it is an inner
              class).  To debug:
               
               
              - try using a non-inner class to see if you're getting the
              right loader
               
              - Ensure you can do a Class.forName() using that string to
              see if the string is correct
               
               
              -Tom
               
               
              Rohit Banga wrote:
               
                Hi Tom
                 
                 
                Yes that was a slip in my test code. Sorry about that.
                So the properties are inherited by default.
                 
                 
                Other than that instead of using SessionCustomizer I am
                planning to use "eclipselink.logging.logger" to
                configure my CustomLogger. But I am getting Class not
                found exceptions. The CustomLogger is a public static
                class nested inside the main class. Any ideas what could
                be causing this? I don't know what to specify in the
                class loader property. I tried setting it  to
                System.getProperty("|java.system.class.loader|"). does
                not work.
                 
                 
                On 5/30/2011 8:47 PM, Tom Ware wrote:
                 
                Hi Rohit,
                   
                   
                    The only call I see to setLogLevel in your example
                  is on line 73.  It sets the log level on the
                  clientSession.  Am I missing something?
                   
                   
                    A clientSession will have the same logger as the
                  server session that created it, so any logging
                  settings should be the same between the sessions.
                   
                   
                    SessionCustomizers don't really make sense on
                  ClientSession since the things you are likely to set
                  in them are all handled by the server session.
                   
                   
                    Is there some other setting that is causing you
                  problems?
                   
                   
                  -Tom
                   
                   
                  Rohit Banga wrote:
                   
                    Hi All
                     
                     
                    I have a small question. I have attached a sample
                    program to make it easy to see the problem.
                     
                     
                    I have set the LogLevel property on the
                    ServerSesssion. However if I do not explicitly set
                    the LogLevel property on the clientSession, the logs
                    for the query execution are not available on the
                    console. I want a way such that any property
                    specified on the server session, say
                    SessionCustomizer, Log Level etc. is also available
                    on the client session automatically. Can anyone
                    please tell me how to do that using the sample code
                    provided?
                     
                     
                    --  
                    Thanks and Regards
                     
                    Rohit Banga
                     
                    Member Technical Staff
                     
                    Oracle Server Technologies
                     
                     
                     
                    ------------------------------------------------------------------------
                     
                     
                    _______________________________________________
                     
                    eclipselink-users mailing list
                     
                    eclipselink-users@xxxxxxxxxxx
                     
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
                     
                   
                  _______________________________________________
                   
                  eclipselink-users mailing list
                   
                  eclipselink-users@xxxxxxxxxxx
                   
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
                   
                 
                 
                --  
                Thanks and Regards
                 
                Rohit Banga
                 
                Member Technical Staff
                 
                Oracle Server Technologies
                 
               
             
             
            --  
            Thanks and Regards
             
            Rohit Banga
             
            Member Technical Staff
             
            Oracle Server Technologies
             
           
         
         
        --  
        Thanks and Regards
         
        Rohit Banga
         
        Member Technical Staff
         
        Oracle Server Technologies
         
       
     
     
    --  
      Thanks and Regards
       
      Rohit Banga
       
      Member Technical Staff
       
      Oracle Server Technologies
       
     
  
 |