Multiple persistence units and OneToMany associations

Hi,
I have an EAR with two persistence units and corresponding entities. Each is contained within a separate library jar file. Some of the entities in one of the jars refer to entities in the other jar. If I refer to just a single entity (i.e., a OneToOne association), everything builds and deploys with no problems, but if I use a collection (OneToMany association), I get errors when trying to deploy the project.
I've been playing around with this for a while and have seen different errors such as the following:
[exec] CLI171 Command deploy failed : Deploying application in domain failed; Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
[exec] Exception Description: predeploy for PersistenceUnit [GrammarUserData] failed.
[exec] Internal Exception: Exception [TOPLINK-7155] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.ValidationException
[exec] Exception Description: The type [interface java.util.List] for the attribute [sentencePatterns] on the entity class [class com.leadingstep.grammar.configuration.CommonElementConfiguration] is not a valid type for a serialized mapping. The attribute type must implement the Serializable interface.
I also had the collection defined as a Set and it complained about that as well. I have many other OneToMany associations used between entities within the same persistence unit that use the List interface with no problems, and so that's why I'm wondering if the problem actually comes from the fact that the entities in the failed case belong to different persistence units?
At another point, the error message I was getting was:
[#|2009-12-22T20:05:02.427-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.tools.deployment|_ThreadID=15;_ThreadName=Thread-32;_RequestID=67ca0eee-64d9-41dc-8093-eec811cb32b6;|Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
Exception Description: predeploy for PersistenceUnit [GrammarUserData] failed.
Internal Exception: Exception [TOPLINK-7250] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: [class com.leadingstep.grammar.configuration.CommonConstructorConfiguration] uses a non-entity [class com.leadingstep.grammar.db.sentences.SentenceGroup] as target entity in the relationship attribute [private java.util.List com.leadingstep.grammar.configuration.CommonConstructorConfiguration.sentenceGroups].
The target entity it refers to here definitely has the @Entity annotation and again, is associated with other entities within the same persistence unit with no problems.
Am I right in thinking the problem comes from the association of entities between the different persistence units? Is there something special I have to do to make this work?
BTW, both persistence units use the <exclude-unlisted-classes> and specifically list every entity that should be included.
Thanks for any help!
Renee

One other thought on this. I'm using Glassfish with Toplink and have it create the tables using:
               <property name="toplink.ddl-generation" value="create-tables" />
Could it be something related to the table creation in this case that's causing the problem?
Renee

Similar Messages

  • Multiple Persistence Units AND one transaction

    Hello,
    I'm using JPA implementation for my EJB Project.
    I have 2 persistence units and I'm using them in the same method.
    I want to persist 2 object belonging each one to a different persistence unit
    The 2 persistence units are related to different databases.
    Everything is going fine and no exception is raised BUT only one object is persisted and the other one is not.
    Have anyone had a similar problem before.
    Any help will be appreciated.
    Thanks in advance.
    Edited by: ImaneA on Jan 18, 2011 9:29 AM

    @Yordan :
    First of all, thanks a lot for you answer.
    At the end, I didn't use two EJB Projects :
    1 - I used only one datasource( associated to one database ) in the persistence.xml
    2 - I created a DBLink in SQL Server
    3 - I created a synonym in the first database to get data from the second database.
    And it works
    But thanks for the answer, I may use you solution in my next project
    @Rolf :
    No, In NWA I've declared my datasources as normal datasources.
    But Plz if you have docs that talks about XDataSources plz share them and thanks in advance.
    Edited by: ImaneA on Jan 25, 2011 9:21 AM

  • Multiple persistence units not supported by OEPE 12.1.1.0.1

    Dear Friends -
    Environment
    Oracle Enterprise Pack for Eclipse 12.1.1.0.1
    JPA version : 2.0
    Platform : Eclipse link 2.3.x
    OWLS Version : 12c (12.1.1)
    JDK : jrockit1.6
    Sybase database.
    While developing JPA projects, we are getting error and warning while using Multiple persistence units in persistence.xml.
    Steps :
    1. Create 2 persistence unit in persistence.xml.
    -- Warning saying that "Multiple persistence units defined - only the first persistence unit will be recognized"
    2. Create 2 database connection in OEPE.
    3. Create JPA Entities from Table using first database connection.
    -- No issues.
    4. Create another JPA Entities from Table using second database connection.
    -- Issue is entities created in step3.(is first JPA Entity classes)
    -- Errors from first JPA Entity classes.
    ----1. Table "table_name1" cannot be resolved.
    ----2. Table "table_name1" for column "column_name1" is not valid for this entity.
    5. Second JPA Entity classes are fine.
    Thanks
    Justin.
    Sample persistence.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
         <persistence-unit name="PU1" transaction-type="JTA">
              <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
              <jta-data-source>DS1</jta-data-source>
              <class>com.test.FirstEntity</class>     
         </persistence-unit>
         <persistence-unit name="PU2" transaction-type="JTA">
              <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
              <jta-data-source>DS2</jta-data-source>
              <class>com.test.SecondEntity</class>
         </persistence-unit>
    </persistence>

    Also, the reason you are seeing those errors in your first project after generating entities from the second connection is because the project wide schema is being updated to the second connections generation schema. If you go into the JPA project properties you can change it back. This workflow would need to change with multiple persistence unit support.
    Neil

  • Is it possible to create a configuration profile that will install multiple network printers and their associated drivers

    Is it possible to create a configuration profile that will install multiple network printers and their associated drivers?
    I was not able to find profile manager on my employer's installation of 10.6 Server. Is this only a feature of 10.7/10.8 server?

    10.6 server does not have profile manager, profile manager is only available in 10/7 and 10.8 server
    for 10.6 server you'll need to use wgm and server admin
    printer management with 10.6, I recommend you read the relevant server manuals regarding
    print server and user management, printer management

  • Multiple persistence units with name "Model" are defined at the same scope

    Hi,
    I get this error when deploying from Jdeveloper 10.1.3.4 to OAS 10.1.3.
    The release notes for Jdev 10.1.3.1 say the following:
    "To avoid this error, update the ViewController project settings to remove the dependency on the Model project before deploying the ADF web application to Standlone OC4J."
    So I removed the dependancy but now none of my EJB's are deployed! If I go to the Enterprise Manager Console I can only see my WEB MODULE but no EJBs.
    Can anyone shed any light on this issue? Perhaps I have configured my incorrectly.
    ps. I am trying to deploy an EJB3 web app so I do not have any deployment descriptors as the documentation say that they are not needed.
    Thanks

    Also, the reason you are seeing those errors in your first project after generating entities from the second connection is because the project wide schema is being updated to the second connections generation schema. If you go into the JPA project properties you can change it back. This workflow would need to change with multiple persistence unit support.
    Neil

  • Multiple Persistence Units in persistence.xml

    Hi,
    in my session bean I want to read data from two ORACLE-database tables, which are located in two ORACLE-schemas (same ORACLE-instance). So I have defined two datasources, one for each schema. Then I defined two persistence-units in my persistence.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
         <persistence-unit name="DACC/AEMA">
              <jta-data-source>AEMA</jta-data-source>
         </persistence-unit>
         <persistence-unit name="DACC/ALLGEMEIN">
              <jta-data-source>ALLGEMEIN</jta-data-source>
         </persistence-unit>
    </persistence>
    In NetWeaver Development Studio this result in the following error:
    "2 persistence units are found. Only exactly one persistence unti is supported."
    What's the solution here? Of course I could define two session beans. But this would result in two development components (DC) as well, because there is only 1 persistence.xml per DC (is this correct?). I don't think this is a good idea. Any other suggestions?
    Kind regards,
    Christoph

    Hi Christoph,
    From a Java EE server perspective there are no issues with multiple PUs in a persistence.xml. This is a limitation of NWDS, or WTP (Dali), to be precise. So, you could try to ignore this error and deploy on the server.
    HTH!
    \-- Vladimir

  • Multiple LabView versions and file associations

    I know this is a Windows problem more than a LabView problem but...
    I have LV 8.21, 8.6, and 2009 installed and seemingly Lv 8.6 is the only version that is associated with .vi .lvprog, and the other LV files.
    Really makes it a P.I.A. when doubble clicking on a LV 2009 project file and LV 8.6 starts.
    I have tried changing the associations to the labview.exe in the Lv 2009 directory but it does not change the Windows file associations.
    Has anyone else delt with this and come up with a soultion?

    Here is my solution. (And, incidentally, the one point I DRIVE home to my co-wirers at work!)
    Never ever ever open a LabVIEW object from Windows explorer!  Always open them from the IDE. 
    Sea-Story time
    Once upon a time I migrated from LabVIEW 5.1 to 6.i followed almost immidiatly by 7.0 (finally a stable VISA API) and in 3 months we jumped to 7.1.  4 versions in 6-9 months with projects in each.  With 8 developers and 15 test stations all "synchronized" to a single SCC database.  We learned some painful lessons about version control.  After a few weeks of Windows choosing randomly what version of LabVIEW to launch each vi in we had pretty thoroughly corrupted the libraries on every machine.  Reuse Vic's from 5.1 recompiled to 7.0, vi's in 7.1 cross linked to sub vi's in the 6.i area etc.... NIGHTMARE!  We actually SHUT DOWN the lab for about 10 days while we reconstructed ALL of our code and re-assembled the SCC database from the ground up.
    At the risk of repeating myself- in a multiple version environment Never ever ever open a LabVIEW object from Windows explorer!  Always open them from the IDE. 
    In a single version environment - Never ever ever open a LabVIEW object from Windows explorer!  Always open them from the IDE. it will teach you bad habits the will hurt later.
    Jeff

  • Use ar_receipt_api_pub create_cash API across multiple oper units

    Hi,
    I have a requirement to create AR receipts across multiple operating units and I am using the AR_RECEIPT_API_PUB's create_cash() to do that. The APIs work fine and I can create receipt in oper unit A. But when I changed to a different operating unit B and call the API, it terminated with NO_DATA_FOUND error.
    If I run my same code with operating unit B and then oper unit A, it created receipts in oper unit B but returned NO_DATA_FOUND in oper unit A. That way I confirmed there is no set-up issues with both oper units.
    I tried following 4 different ways to switch to different operating unit but all resulted in NO_DATA_FOUND:
    1) mo_global.init('AR');
    2) mo_global.init('AR'); fnd_client_info.set_org_context(&org_id>);
    3) mo_global.init('AR'); mo_global.set_policy_context('M', &org_id) ;
    4) mo_global.init('AR'); mo_global.set_policy_context('S', &org_id) ; (My EBS set-up has multi oper units, but I tried 'S' flag because of lack of ideas)
    Please help. Thanks!
    Mike.

    @MikeLi,
    Did you find any solution for this problem? We are facing this problem on R12 while creating AR receipts across multiple operating units. We will be glad if you share the solution. We have tried all possible ways; but did not help. When we look at the mo_glob_org_access_tmp ; we have access to all organizations; but the api returns 'no data found'
    Thanks.

  • Check Payment Processing Across Multiple Operating Units

    Hi There
    We are currently implementing Oracle R12 at the company I work for. Our solution implementer has informed us that you cannot process one check (cheque) payment across multiple operating units and that this is an outstanding enhancement with Oracle. Therefore (if we accept) this we will have to process a seperate check per operating unit which will increase our payment processing significantly.
    Can anyone out there:
    A. Confirm this is indeed an issue
    B. Are you aware if Oracle are doing anything about it and
    C. Is there any workaround that we could consider to lessen the impact.
    Thanks

    Hi,
    Scenario 1
    If you are going to make Single check payment to the same supplier having different sites under various operating units, oracle has provided a workaround, i.e. to make a manual payment in payables module, however it would not generate any payment instruction.
    Scenario 2
    If you are going to make single check payment to various suppliers in different/same operating units, it is not allowed by Oracle, as there is no logic behind it. You cannot have 1 check generated for different suppliers ...
    I am assuming you are referring to Scenario 1, in which case, i would say there is an WORKAROUND suggested by Oracle to make use of MANUAL PAYMENT method, which you could discuss with your Solution Implementer.
    Regards,
    Ivruksha

  • Multiple persistence.xml files

    I've got a situation where I have one persistence.xml file with many persistence-unit's. My problem is that during deployment not all of the persistence-units are useable, so I get errors. My question is can I use multiple persistence.xml files in an application if each persistence.xml file defined only one persistence-unit?
    Mark

    While JPA supports multiple persistence units in a single persistence.xml most of the tooling options (Eclipse, JDeveloper) focus on supporting a single persistence unit. Using multiple persistence.xml files on different classpath roots should also work. I recall seeing a bug related to this in the EclipseLink queue. Is this the JPA implementation you are using?
    Doug

  • EJB Diagram doesn't prompt to Associate with Persistence Unit

    I'm new to EJB/Faces world.
    I did the tutorial Build a Web Application with JDeveloper 11g Using EJB, JPA, and JavaServer Faces.
    But when I add the EJB Diagram, am not prompted to pick a persistence unit and hence am not able to drop my JPA's.
    Any ideas why I might be seeing this?

    I don't remember specifically. I think it was caused at a point during the tutorial that I double clicked on one of the files it created to try to get a feel for what was going on. This may have corrupted that file. I restarted the tutorial and the second time around didn't open any of the extraneous files and the prompt appeared as expected.

  • Managing persistence units across different EJB modules

    Hi,
    I'm testing some things and I have the following situation :
    1 EJB module (.JAR) with basic EJBs and entities
    1 EJB module (.JAR) with EJBs and entities that extend some base entities
    Now, I've placed a persistence.xml in each both defining a persistence unit with the same name (I want both EJB modules, or more specifically the injected EntityManagers therein to know about both the basic as well as the extended entities).
    My question is, what is the correct way to set up a project so you can have some core functionality EJBs and entities, and some optional extension EJBs and entities in such a way that a single persistence unit is used for all entities.
    I hope anyone can help me out here. Thanks.

    Persistence unit will not share references to entity in terms of the inheritance you want to achieve.
    I think the only way you can do that is you the @MappedSuperClass on a class. THis is because the class so annotated is not entered in any of the persistence unit and thus can be shared. I have used it and it works.
    Regards,
    Michael

  • Persistence Unit / Entity class question

    Hi guys.
    I'm trying to get a list of all entity classes in an EJB project. What would be the easiest way of doing this? I think there should be a way to obtain the persistence unit and get a list of entity classes from that, but I can't find a way to do this. The only other way that I can think of is to manually go and read the persistence.xml file, but I'd like to avoid that. Any advice will be much appreciated. Thanks!
    I've discovered the PersistenceUnitInfo interface, which looks like it might be of some use. However, I can't find a way to inject it into a bean. Any ideas? Thanks!

    Are your Entities in a jar in the web-inf/lib of your web app? Do you have a single persistence unit? I looks like either a classloader or wrong persistence unit problem.
    Can you post the full stack?
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to Capture Multiple Cost centres and Business Unit information in a project?

    Dear Experts,
    With the help of UDA functionality in project super responsibility, I have captured Cost centre and Business unit information and this info will be used/reflected in CC and BU segments of all transactions gets recorded against that project.
    Now, our user wish to have multiple cost centres and business units to be tracked in the same one project. How is this feasible? Below example describes my requirement in a summary, please advise.
    An Indirect project is created when a defect on a machine reported from client's customer and all subsequent activities (purchases, travel to customer site to analyse and troubleshoot, purchases for any in-house analysis etc..involves costs spending internally) in resolving that defect/project involves 6 to 7 different departments (Sales, Tech Support, Quality team etc.,who actually work/travel and spend costs against project until defect resolution). And, each of the above departments will have 1 dedicated owner (project owners) to manage that project and each of these 6 or 7 owners owners will have their own cost centres (eg: 2345 - Sales team) against which they wish to see their transactions (travel, purchases during defect resolution) globally.
    So, all I want to know is how can I make one single project to accommodate multiple cost centresand business unit information to be assigned using UDA? Please let me know if I am not clear.
    Regards
    Venkat

    I think you should use the expenditure organization on the transaction itself to derive the CC/BU. Have AA lookups and define AA rules where you look at a Exp Org to BU or Cost Center to derive accounting.

  • Org. unit and associated material groups download from Org. structure

    Hi,
    I want to download the material groups and associated material groups(Defined in External attributes) from organisation structure.
    Please suggest how to do it.
    Best regards,
    Sambit

    Hi. There's a point. You said you wanted to download a list so I presumed you wanted all the org units and all the material groups assigned to them.
    If you only want to do it 1 org unit at a time the function will work perfectly.
    I f you do want to see all I have had another thought actually.
    You could run program RHOMATTRIBUTES_REPLACE.
    This allows you to replace 1 attribute with another, but if you do not press the "change" button it works as a good report on attributes.
    If you just put in attibute PRCAT and then Old Value = Logical System of backend and New Value = Logical system of backend and tick substring then execute, it will show you all the org units and all the material groups.
    Just be careful not to press the replace button on the output, that would actually change data.
    Regards,
    Dave.

Maybe you are looking for

  • Getting ORA-01001: invalid cursor when I try to parse my SQL statement with DBMS_SQL

    -- To modify this template, edit file PROC.TXT in TEMPLATE -- directory of SQL Navigator -- Purpose: Briefly explain the functionality of the procedure -- MODIFICATION HISTORY -- Person Date Comments TYPE column_find IS VARRAY(999) of VARCHAR2(4); v_

  • Printing quality Is not clearly after Acrobat 8.1.2 Pro updating (HP Deskjet 9800)

    *** The contents wrote with the auto compiler. (Korean -> English) *** Meaning of the writing could not be delivered smoothly. From Adobe Reader 8.1.2 Application Printing quality Is not clearly after Adobe Acrobat 8.1.2 Professional updating. To pre

  • Usability of applications

    I recently gave an iPad 2 to my mother.  She is 90.  We regularly use Facetime together, she uses email, the Kindle app, and surfs.  I'm proud of her.  She was an Apple 2 user and taught basic programming in the late 70s.  I'm glad she has made an ef

  • Lost Contacts afrer 5.1.1 upgrade

    Lost random contacts after os 5.1.1 upgrade on iphone, ipad adn icloud - any suggestions

  • Garageband tuner stops working

    On Mac, the Garageband tuner works only once: open it, tune your guitar, close it, re-open it, it's dead. It doesn't react at all. Anybody experiencing the same problem? Garageband 10.0.1, OS X Mavericks, Apogee Jam Thanks