How to access two entity managers from two different servers?

Hello
My test programm is trying to access two glassfish application servers (gf 2.1). The code base of these servers is the same, the persistence layers are just accessing different databases -> one ist the staging/test system, the other the live server.
After setting the connection and obtaining the em via the class persistence i can not fetch the em from the other system.
          properties.setProperty("org.omg.CORBA.ORBInitialHost", "host1");
          properties.setProperty("org.omg.CORBA.ORBInitialPort", "port1");
                InitialContext ctx = new InitialContext(properties);
          entityManagerFactory1 = Persistence.createEntityManagerFactory("pu/refdata");               
          entityManager1 = entityManagerFactory.createEntityManager();After that Persistence seems to have been bound to host1 forever, so i can not fetch a reference to the em of host2. There is another createEntityManagerFactory method accepting a map but i dont find any reference for the properties, maybe that would help - dont know.
Regardless of what i do, any further call to Persistence.createEntityManagerFactory returns the handle of entityManagerFactory1.
Regards

I want to use the EntityManagers bound to the DataSources provided by different app servers.
Below you find an example persistence.xml with three entries. 1 & 2 have the same jta data source, 3 is different.
My point is that Persistence binds the new factory in a wrong way if the jta data source String has already been resolved.
If a progamm sets connection properties for app server 1 and fetches an entityManagerFactory for pu/refdata_Live, then sets connection properties for app server 2 with pu/refdata_Test they get different factory instances bound to the same server, in this case app server 1.
If i know set the connection properties for app server 3 with pu/refdata3 Persistence sees that the jta data source "dbc/ref3" has not yet been resolved and tries to connect to the app server 3. Which it should have done for app server 2 too.
<persistence-unit name="pu/refdata_Live" transaction-type="JTA">
     <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <jta-data-source>jdbc/ref</jta-data-source>
    <properties>
      <property name="toplink.ddl-generation" value="none"/>
    </properties>
  </persistence-unit>
    <persistence-unit name="pu/refdata_Test" transaction-type="JTA">
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <jta-data-source>jdbc/ref</jta-data-source>
    <properties>
      <property name="toplink.ddl-generation" value="none"/>
    </properties>
  </persistence-unit>
    <persistence-unit name="pu/refdata3" transaction-type="JTA">
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <jta-data-source>jdbc/ref3</jta-data-source>
    <properties>
      <property name="toplink.ddl-generation" value="none"/>
    </properties>
  </persistence-unit>

Similar Messages

  • How to place two different indesign documents side by side on my desktop in order to copy and paste images and text from one to the other?

    How to place two different indesign documents side by side on my desktop in order to copy and paste images and text from one to the other?

    Or choose Window > Arrange > Tile
    And, you of course can copy/paste without tiling.

  • How to change two different iCloud account from mac and iPhone?

    How to change two different iCloud account from mac and iPhone?

    Pick one to use, abandon the other.

  • How to connect two different tables from different server?

    Dear all expert,
    I need to develop a report where i need to connect 2 different tables from 2 different servers. For examples:
    BUT000 tables from CRM and KNKK from R3.
    Is it possible to do so? Because i try to link these 2 tables together and when i preview the report, it run very slow and sometime it hang. I did not get any result.
    Thank You.

    Moved to SAP Integration kit forum
    Appears you are using SAP data sources.
    And yes you can but the linked field types must match and be able to be converted into the WHERE portion of the SQL. Click on Database, Show SQL... and see if there is one. If not CR can't figure out how to so it brings all data client side and filters on the second pass.
    Thank you
    Don

  • How to set two radius servers one is window NPS another is cisco radius server

    how to set two radius servers one is window NPS another is cisco radius server
    when i try the following command, once window priority is first , i type cisco radius user name, it authenticated fail
    i can not use both at the same time
    radius-server host 192.168.1.3  is window NPS
    radius-server host 192.168.1.1 is cisco radius
    http://blog.skufel.net/2012/06/how-to-integrating-cisco-devices-access-with-microsoft-npsradius/
    conf t
    no aaa authentication login default line
    no aaa authentication login local group radius
    no aaa authorization exec default group radius if-authenticated
    no aaa authorization network default group radius
    no aaa accounting connection default start-stop group radius
    aaa new-model
    aaa group server radius IAS
     server 192.168.1.1 auth-port 1812 acct-port 1813
     server 192.168.1.3 auth-port 1812 acct-port 1813
    aaa authentication login userAuthentication local group IAS
    aaa authorization exec userAuthorization local group IAS if-authenticated
    aaa authorization network userAuthorization local group IAS
    aaa accounting exec default start-stop group IAS
    aaa accounting system default start-stop group IAS
    aaa session-id common
    radius-server host 192.168.1.1 auth-port 1812 acct-port 1813
    radius-server host 192.168.1.2 auth-port 1812 acct-port 1813
    radius-server host 192.168.1.3 auth-port 1645 acct-port 1646
    radius-server host 192.168.1.3 auth-port 1812 acct-port 1813
    privilege exec level 1 show config
    ip radius source-interface Gi0/1
    line vty 0 4
     authorization exec userAuthorization
     login authentication userAuthentication
     transport input telnet
    line vty 5 15
     authorization exec userAuthorization
     login authentication userAuthentication
     transport input telnet
    end
    conf t
    aaa group server radius IAS
     server 192.168.1.3 auth-port 1812 acct-port 1813
     server 192.168.1.1 auth-port 1812 acct-port 1813
    end

    The first AAA server listed in your config will always be used unless/until it becomes unavailable. At that point the NAD would move down to the next AAA server defined on the list and use that one until it becomes unavailable and then move to third one, and so on. 
    If you want to use two AAA servers at the same time then you will need to put a load balancer in front of them. Then the virtual IP (vip) will be listed in the NADs vs the individual AAA servers' IPs. 
    I hope this helps!
    Thank you for rating helpful posts!

  • Can we access two different Siebel BO in Same OPA Rule Base

    Hi all,
    can we access two different BO's from same rule base.
    what i means is,can we pass siebel data to OPA Rule Base from two different BO's .
    Thank you for your help in advance.

    There are two approaches to do this and they both involve making some small changes on the Siebel side.
    You can create an Integration Object which contains all the business components that you want to send to OPA if you are using an Integration Object mapping.
    If you would prefer to use a Business Object mapping then you will have to create a new Business Object which combines the BCs of all the Business Objects that you want to send to OPA.
    As you can see, although one approach involves Integration Objects and one involves Business Objects they both work by creating a single object which is an amalgamation of the information that you want to send to OPA.
    Cheers
    Frank

  • How to access a web service from a XLet

    Hello,
    I am new in software development to ITV and I dint find too many usefull information teaching how to access a web service from a XLet running in a STB. Are there anybody who can give me some help, maybe sample or tutorial?
    Gratefull
    David

    hi,
    you can "borrow" the source code from [Yambo a free soft open source presentation engine (AKA XML microbrowser Xlet )|http://www.cineca.tv/labs/mhplab/index-en.html] both local and on a http remote connection.
    hope it helps..
    bye
    andrea

  • How to access my macbook pro from a windows pc?

    how to access my macbook pro from a windows pc?

    Depending on what you mean by "access" the following may help:
    File sharing: How to connect with File Sharing on your Mac - Apple Support
    One way (and there are others) for remote control and remote access between Mac and Windows: http://www.teamviewer.com/en/index.aspx

  • How to add two different page numbers in a single page

    How to add two different page numbers in a single page? One is for page number of the whole article, the other one is for page number for each chapter in the article.

    It's quite complicated, see
    Two Page Numbering Schemes in the Same Document.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • How to call two different servlet-url in the same application

    Hi,
    I want to call, consecutively these methods in my application.
    response.sendRedirect(servlet-url1)
    reponse.sendRedirect(servlet-url2)
    but the second method dont answer,
    I think, the first method redirect s with response ,
    but how to call two different servlet ?
    thanks

    if you call the first redirect, the servlet is getting aborted, so you can redirect to the first servlet, working the stuff in it, and then in the second servlet you can redirect to the third servlet

  • How to access internal table data from webdynpro to Flex application.

    Hi Connoisseur
    The data transfer from Abap WebDeypro to flex island works well. I followed , there is an example from Thomas Jung (by the way as always Great Work) and  Karthikeyan Venkatesan (Infosys) but this example covers simple type only.
    There is no example with complex types like arrayCollection which handle the transfer of data from flex to WebDynpro.
    i tried to do pass internal table value  to flex-datagrid.but its not work.
    i would like to know
    1.how to access internal table data from webdynpro to Flex application.
    2.how to pass the internal table to flex-datagrid.
    2.how to pass dynamically in ADOBE flex.
    3. how to do Flex is receiving the wd context data?
    4. how can we update WD context with FLEX data.
    Ple give me sample example and step by step procedure.
    Regards
    laxmikanth

    Hi Laxmikanth,
    Please refer this...
    Flash island: update complex type from flex
    Cheers..
    kris.

  • How to Maintain two different prices for same material in different qty?

    Dear all,
    How to maintain two different prices for same material in different batch quantities in purchase order(ie.,info record)?
    (Vendor is supplying quantities in 2 different batches & also in different prices)
    Expecting valuable reply.
    Jeyakanthan

    In a PO you can create 2 items, and each item can be maintained with a different price in the conditions.
    In info record it is not possible to have different prices for the same period, except for scales.
    so if you have a price of e.g. 2 USD for 1000 kg and 1,90 USD for 2000 kg then you can maintain this in scales, but you still have to have 2 items in the PO so that each one can individually find its price.
    Alternative you can create contracts (as well with more than one item) to reflect the different prices and batches.

  • OOABAP-How to access the protected methos from a class

    How to access the protected methos from a class..There is a built in class..For tht class i have created a object..
    Built in class name : CL_GUI_TEXTEDIT
    method : LIMIT_TEXT.
    How to access this..help me with code

    hi,
    If inheritance is used properly, it provides a significantly better structure, as common components only
    need to be stored once centrally (in the superclass) and are then automatically available to subclasses.
    Subclasses also profit immediately from changes (although the changes can also render them invalid!).
    Inheritance provides very strong links between the superclass and the subclass. The subclass must
    possess detailed knowledge of the implementation of the superclass, particularly for redefinition, but also in
    order to use inherited components.
    Even if, technically, the superclass does not know its subclasses, the
    subclass often makes additional requirements of the superclass, for example, because a subclass needs
    certain protected components or because implementation details in the superclass need to be changed in
    the subclass in order to redefine methods.
    The basic reason is that the developer of a (super)class cannot
    normally predict all the requirements that subclasses will later need to make of the superclass.
    Inheritance provides an extension of the visibility concept: there are protected components. The visibility of
    these components lies between that of the public components (visible to all users, all subclasses, and the class itself), and private (visible only to the class itself). Protected components are visible to and can be used by all subclasses and the class itself.
    Subclasses cannot access the private components  particularly attributes) of the superclass. Private
    components are genuinely private. This is particularly important if a (super)class needs to make local
    enhancements to handle errors: it can use private components to do this without knowing or invalidating
    subclasses.
    Create your class inse24 and inherit this CL_GUI_TEXTEDIT
    class in yours. You can then access the protected methods.
    Hope this is helpful, <REMOVED BY MODERATOR>
    Edited by: Runal Singh on Feb 8, 2008 1:08 PM
    Edited by: Alvaro Tejada Galindo on Feb 19, 2008 2:19 PM

  • Don't know how to access my email away from home

    i don't know how to access my email away from home.
    can't find webmail or email options.
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.1; AOLBuild 4334.5009; Windows NT 6.0; Trident/4.0; GTB6.3; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618)

    Somehow I got it to work, a whole lot easier than i thought, kind of scary how easy... but Im not exactly sure what of several things is how I got it. Scariest thing; watching my iBook I wouldn't know that I was accessing it from the MB. It's only me doing it, but still seems so easy.
    If I have a WPA2 password protected wireless network do I have to worry that others can access it so easily? (not that I have anything interesting, it's just the general privacy paranoia)

  • How to access the abap program from MS Excel?

    Hi ,
    How to access the abap program from MS Excel or MS access ?
    The abap program "z..."  has the below input and output attributes
    Input : Date,Index and file name with location (.htm or .xls)
    Output : htm or xls file downloaded at the above location.
    Please help me here.Do we haev to use BAPI and RFC?If yes,please tell me how to use them
    Regards
    Dinesh

    Maybe this could help you up -;)
    [Simple SE38 Emulator using Microsoft Excel|Simple SE38 Emulator using Microsoft Excel]
    Greetings,
    Blag.

  • Users are not able to access two different SAP portals at a time

    Hi Experts,
    Users are not able to access two different SAP portals at a time, if users login the OLD SAP Portal then they are not able to access NEW SAP Production Portal asking user id's & Password while doing ECC & APO transactions.
    If user clear the Internet Explorer cache then for time being they can access but its not the permanant solution.
    Can any one please help me on this.
    Thanks,
    Jay

    Hello Jay,
    here we are facing this problem, this company users not able to access both the portals at at time
    If you want to access HTC and Armed at the same time you gotta complete SSO Config or User mapping between these two Portals. You can refer to the below link for more details.
    http://help.sap.com/saphelp_nw04/helpdata/en/f8/3b514ca29011d5bdeb006094191908/content.htm
    Thanks
    SM

Maybe you are looking for

  • Why is the footer specified on the master being misapplied to the page

    This is somewhat inexplicable as the page properties for master and page are the same. I have several master pages for the site which were created by duplicating a master then making the changes. Two of the masters created in this way work correctly,

  • HT1539 Why do I only get the SD copy of a digital download when I bought the blu-ray HD film?

    Just bought the 3D Blu-ray version of Prometheus and was pleased to see it came with a digital copy, however on redemption in the iTunes store it only downloads the SD version. Is this standard practice? Why don't they give you the HD version of the

  • Download does not start?

    Hello Adobe Forums, I've been having problems installing Adobe Dreamweaver CS5.5 Trial in Adobe Download Assistant. When I click Download it doesn't load up, even for 10 min  it still doesn't load up. I click it again and it gives me an error like th

  • How do you do to update a profile?

    Hi People: I am newbie and I need your help for this problem. I have a table with a PK with 2 fields. I create the profile and derived this PK. I modified this PK with 3 fields and when I syncronized the profile again this PK no modified. I need know

  • Push default open with program to server users

    Hi All, We have just upgraded to 10.9 server in an effort to speed up file operations to our Synology NAS. Our users have to fill out some PDF forms and I need to force .pdf's to open with Adobe Reader. Using profile manager, I have tried to push cus