Seek good method for deleting many to many relationship

My question is as follows:
The relationship of Employee and Project is many to many. I set privately owned for employee-project relationship at toplink builder.
Employee class has a vector of valueholder attribute of Project list.
I write a function to remove a project relationship from Employee when his is no longer responsible for it.
public void removeProjectFromEmployee(String employeeId, String projectId)
throws Exception
DataSource src = this.getSource();
Employee emp = getEmployeeById(employeeId);
if (emp == null) {
throw new Exception("employee with id " + employeeId + " does not exist.");
else {
Vector projectVector = emp.getProjects();
for (int i=0; i<projectVector.size(); i++){
Project p=(Project)projectVector.elementAt(i);
if ((p.getProjId()).equals(projectId)) {
projectVector.removeElementAt(i);
emp.setProjects(projectVector);
src.registerObject(emp);
src.commit();
In here, i select the object of the employee and then remove one particular project from the vector. It is working but seemed to be quite stupid. Moreover, i worry about its performance when there are thousands of projects owned by an employee.
I think it is a very common operation but i am not very familiar with TOPLink at this moment. Could anyone please advise the correct and better way to deal with this situation?
Thanks

Hello,
Try registering your employee in the UnitOfWork before you re-set the collection onto it. This should resolve your problem.
Note: When you set the collection on the unregistered Employee object, you were modifying a shared, read-only instance of the object, and hence were making transactional changes visible to other threads non-atomically. There are a lot of good reasons why this is a bad thing.
I hope this helps,
Christian

Similar Messages

  • Good method for detecting walls in a map

    Good morning,
    I'm spending a lot of time trying to convert a simple map into a set of segments in order to perform a Scan Matching with diferent robot poses for localization. I see there's a huge number of tools in Labview regarding Computer Vision and Pattern Matching but, until now, I can't find anything that satisfies my needs.
    I tryed Edge Detection.vi but it returns not only the segment of wall but a complete line from side to side of the ROI as you can try in the example I attached. In addition, Edge detection doesn't work well with diagonal walls. 
    I could use Contour Detection.vi but it turns out that is computationally expensive according to perfermance profile plus it detects contours as points but I need lines because my map is composed of simple straight lines.
    Finally I tried IMAQ Rake 3 but I don't know very well how it works and there's no examples of use in the examples folder.
    Labview is an amazing programa with a lot of already made complex nodes, There must be a way to simulate what a robot equipped with a Laser Range Finder or LIDAR would see if running in a very simple 2D room.
    Thanks in advance.
    Attachments:
    EdgeDetection.vi ‏50 KB
    room.png ‏4 KB

    hi 
    it's very popular and useful function which i am working on .
    have you find any solution yet?

  • Correct method for deleting iTunes library?

    I have a new Mac and have successfully transferred my iTunes library from my old Mac to my new Mac.
    I have made a copy of the library on a portable hard drive, just in case there is a problem with the library in the future.
    How do I now delete the library from the old Mac so that I can save the space on the hard drive?
    Vast majority of my library is downloaded CDs (which I want to delete) and there are just a few purchased downloads via iTunes (which ideally I would keep but not essential).  I'm presuming the latter can still be accessed via my iTunes log-on, once the library has been cleared.

    Chris CA wrote:
    Jerry Dammers wrote:
    I have a new Mac and have successfully transferred my iTunes library from my old Mac to my new Mac.
    I have made a copy of the library on a portable hard drive, just in case there is a problem with the library in the future.
    You did copy the entire /Music/iTunes/ folder, correct?
    I copied everything that was within the Music folder in Finder. The copied folder size was exactly the same as the original folder in Finder so I'm assuming it's copied fine.
    How do I now delete the library from the old Mac so that I can save the space on the hard drive?
    Delet the entire /Music/iTunes/ folder.
    Do you mean delete everything within iTunes?
    The folders within iTunes other than "iTunes Music" (by far the largest) are Album Artwork (quite big); Automatically Add to iTunes; iPod Games and a few others.  I'm presuming they can all be deleted but will iTunes still be in tact (but empty)?

  • Is it possible to delete one of many attachments from an email

    Hi everyone.
    I'm wondering if it's possible to delete a specific attachment from an email message I receive. The mail help topics say:
    +To delete an attachment:+
    +To delete all the attachments in a message, choose Message > Remove Attachments.+
    +The message remains in the mailbox, with a notation that the attachments were manually removed.+
    +To delete a specific attachment, select it in the message and choose Edit > Delete or press the Delete key.+
    +Mail will not delete an attachment that you have edited or saved.+
    I tried the suggested method for deleting a specific attachment but it deletes the entire message, not the specified attachment. Am I missing something, is this a bug, or is the documentation wrong?
    Thanks,
    Bill Bonetti

    V.K.
    I had no doubt it worked the same way insofar as deleting the message rather than a single attachment -- my objective was more that Mail Help would not say it worked. When the feature to remove attachments was added, it was only added to allow removal of all attachments, and was not selective. I had verified that Mail Help in Tiger did no claim otherwise, and now I have verified that neither does Mail Help in Leopard.
    It is my contention that only the Mail Help in Mail 4.x is incorrect, and that there has not been an intent of a change of feature to match the way the documentation is written. I may agree that nothing should be deleted with this attempt to remove a single attachment, but not with the expectation that it should work as documented. This is because when removal of all attachments takes place, via the command in Message/Remove Attachments, the process is to create a new message copy without the attachments, and the new message is given a new xxxx.emlx filename, and the original is deleted. In other words a reindexing takes place. I would not expect that same process to be triggered merely by use of the Delete key. If that were the case, then that would be the main path to removing attachments, in my opinion.
    Ernie

  • ODI KM for Deleting members in Hyperion Finance

    I am trying to write Knowledge Module in ODI for deleting members in Hyperion Finance. But not finding any API method for delete and no documentation on that. Please share if someone have sample about delete on hyperion finance.
    Thanks

    It is possible using the standard IKM SQL to Hyperion Planning.
    I did it using an Update to the Planning Metadata Dimension and passing a value to the Operation column.
    I got the following information regarding the Operation column from the HAL documentation.
    Operation&mdash;takes any of the following values:
    <ul><li>Update - adds, updates, or moves the member being loaded
    </li>
    <li>Delete Level 0 - deletes the member being loaded if it has no children
    </li>
    <li>Delete Idescendants - deletes the member being loaded and all of its descendants
    </li>
    <li>Delete Descendants - deletes the descendants of the member being loaded, but does not delete the member itself</li>
    </ul>
    The default is Update.
    Note: If you delete a member, that member, its data, and any associated planning units are permanently removed and cannot be restored.
    Good Luck, hope this is helpful
    Wayne Van Sluys
    TopDown Consulting

  • Recomend a software or method for making a help file

    Do you have software or a good method for creating HELP files?

    Hey aml1138,
    Although National Instruments doesn't make any software that compiles Windows Help files (.chm or .hhp), there are a variety of help building programs available that are free as well as not. As far as free programs go, I have worked with Microsoft's HTML Help Workshop with success:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc&Displa...
    However, if you're willing to shell out a few bucks for a program with a few more developers behind it and thus an increased ease of use, I have used FAR which was amazingly easy to use:  http://www.helpware.net/FAR/
    I hope this helps!
    Lars L
    National Instruments
    Applications Engineer

  • [ADF] Adding/deleting entries in a many-to-many relationship

    I am using JDeveloper 10.1.3 and the ADF BC / ADF Model / ADF Faces / JSF technology stack.
    For this question, I am using the SRDemo application as an example, specifically the many-to-many relationship between USERS and PRODUCTS (the Staff Expertise relationship), outlined in red in this schema diagram: Image Link
    Users may have any number of product expertise areas and many users may have the same product expertise area. For the purposes of this example I have added two reference fields from the PRODUCT table into the ExpertiseAreas VO (Name and Description), outlined in red in this data control palette section: Image Link
    I have created a page which shows the details of a user (1), along with a table showing the expertise areas the user has (3), and a table of all the products available (2), numbered on this design page: Image Link and corresponding to the numbered data controls on this data control palette section: Image Link, where 1 is rendered as an ADF Read-only Form, 2 is an ADF Read-only Table with a tableSelectMany element in the selection facet, and 3 is also an ADF Read-only Table.
    What I am trying to do is have the tableSelectMany element reflect which of the products are linked to the current user in the expertise areas relationship (by having the checkbox for currently linked products checked), and when you check or uncheck a product's checkbox, it should add or remove the row in the EXPERTISE_AREAS intersection table, respectively (asume for this example that there are default values for Expertise Level and Notes).
    So far I have been following the process used in section 19.8 of the ADF Developer's Guide for Forms/4GL Developers, which describes how to set up a selectManyShuttle which implements the adding and deleting functionality. So I have a Client Interface method in the Application Module, updateSkillsForCurrentStaff (described in section 10.6.7.2), and I have a selection listener for the assignment table in the backing bean for the page, which calls the updateSkillsForCurrentStaff method:
    public void selectionChanged(SelectionEvent event)
      BindingContainer bc = getBindings();
      DCIteratorBinding productsIB = (DCIteratorBinding)bc.get("ProductListIterator");
      Set keys = getTable1().getSelectionState().getKeySet();
      Iterator iter = keys.iterator();
      List productIds = new Vector();
      while (iter.hasNext())
        String product = ((Key)iter.next()).toStringFormat(true);
        productsIB.setCurrentRowWithKey(product);
        ViewRowImpl productRow = (ViewRowImpl)productsIB.getCurrentRow();
        Number productId = (Number)productRow.getAttribute("Id");
        productIds.add(productId);
      OperationBinding ob = bc.getOperationBinding("updateSkillsForCurrentStaff");
      Map pm = ob.getParamsMap();
      pm.put("productIds", productIds);
      ob.execute();
    All of this works, but I can't work out how to link the selection state of the assignment table to the expertise areas that are linked to the user. Also I think the method listing above must be a bit of a hack, but I don't know enough about this to know if there's an easier way of doing it.
    Any help is appreciated.

    Have a look at this example I cooked up for you.
    http://radio.weblogs.com/0118231/2006/10/03.html#a739
    It might not be the first way one thinks to implement something, but it illustrates a very interesting, model-centric approach to the problem you propose.
    My feelings won't be hurt if you prefer a more view-centric approach, but I wanted to illustrate what was a maximally-model-centric solution (in fact, which doesn't even require a backing bean!) If you like a more view-centric approach, I can help you figure out what's wrong with your key-handling above. For one, I would probably start by passing the Set of Key's directly to the middle tier application module method to eliminate client-side code.
    Check it out and let me know what you think. Try it directly in the Business Components Tester to appreciate one of the benefits a model-centric solution can bring.

  • Delete entity that participate in many to many association

    Hi all,
    I have two tables related by a many to many relationship (for ex department and employee).
    So I have three tables:
    Department: table of departments
    Employee: table employees
    deptEmp: the association table relating the employees to the departments.
    When a department is deleted, all the corresponding rows in deptEmp table should also be deleted (and same for employee).
    On the entity level, I have created the many to many association (between department and employee) and a one to many association for each of department and employee entities to deptEmp entity (deptEmptAssoc from department to deptEmp and empDeptAssoc employee  to deptEmp).
    I configured the deptEmptAssoc association to be a composition and implement the cascading delete, and it is working fine. When I delete a department, the corresponding rows in deptEmp are deleted.
    The problem is that when I try to do the same for empDeptAssoc, JDev gives me a warning and doesn’t apply the composition neither the cascading delete.
    I tried to override the remove method of employee entity to also remove the corresponding deptEmp but it also didn’t work.
    So any hint or pointer how to achieve this? How to have a many to many association and be able to delete both sides of the association?
    Thank you.

    Hi,
    This behavior can be done by overriding the postChanges method as follow:
      public void postChanges(TransactionEvent transactionEvent) {
            if(getPostState() == STATUS_DELETED){
                RowIterator mmIterator = getMM();
                while (mmIterator.hasNext()){
                    EntityImpl row = (EntityImpl)mmIterator.next();
                    row.remove();
    row.postChanges(transactionEvent);
            super.postChanges(transactionEvent);
    N.B.1  In the xml file of the viewLink, the composition association (and implement cascade delete) should not be checked.
    N.B.2  with these flags unchecked, ADF will not control the posting of entities in case the department and the deptEmp entities were both newly created. To fix the issue, the deptEmp entity should also override the postChanges method as follow:
                        public void postChanges(TransactionEvent transactionEvent) {
            if (getPostState() == STATUS_NEW ||
                  getPostState() == STATUS_MODIFIED) {
                EntityImpl dept = getDept();
                if (dept != null) {
                  if (dept.getPostState() == STATUS_NEW) {
    dept.postChanges(transactionEvent);
                                                    // do the same for the Employee entity if needed
            super.postChanges(transactionEvent);
    Regards.

  • WCF RIA entity Update from Lightswitch for Many to many relationship

    I have two entities which have many to many relationship. I need to create a screen to update data from both the tables simultaneously using a screen. So I used First as a sql database entity in Lightswitch second is RIA service Entity(Which is junction table).
    both tables are editable in a same screen but when I click on Save button,
    System call to
    [Query(IsDefault = true)]public IEnumerable<EquipmentJob> SelectFakeJobs()  
    method instead of calling
    [Query]public IEnumerable<EquipmentJob> SelectJobs(long? ID).
    I am using the Ria table as a query in my screen and setting the parameter as a table1.SelectedItem.ID.  But after click on save it does not call to parameterized
    method to get data. I have already implemented the 'Saving' method.  It gives following exception.
    Only changes to a single data service can be saved.  To save changes to multiple data services, implement the "Saving" method.
    Data conflict. another user has deleted the record.
    I followed following link to setup the Many to Many relationship update in LightSwitch
    http://powerbala.com/many-to-many-control-for-microsoft-lightswitch/

    Only changes to a single data service can be saved.  To save changes to multiple data services, implement the "Saving" method.
     This issue is discussed before, generally you need implement the <ScreenName>_InitializeDataWorkspace method and add the data services that you'd like to save to the saveChangesTo list.
    https://social.msdn.microsoft.com/Forums/en-US/238e5e91-8598-42f9-817d-12b6f5b980a1/having-a-problem-saving-getting-error?forum=lightswitch

  • My Paper Strip Method for Cleaning BlackBerry Tour 9630 Trackball, Make Good as New!

    I just completed a quick little tutorial demonstrating my paper strip method for cleaning the trackball of the BlackBerry Tour 9630. As many of you know, cleaning the trackball on the Tour can be difficult since you can't remove it from the device like on previous BlackBerrys. Well, I've come up with a pretty successful solution that can get your trackball working good as new again.
    You can check out some testimonies on the CrackBerry.com forums if you like.
    Please consider leaving a comment below or on YouTube if this method helped you.
    Thanks!
    YouTube - Paper Strip Method for Cleaning BlackBerry Tour 9630 Trackball, Make it Good as New!

    DO NOT DO THIS!
    Paper strip didn't fix anything on my trackball, and on the thrid attemt, ripped off under the trackball rendering my phone all but useless. This is a good way to really screw your phone up. Can't beleive the RIM site is linked to it.........

  • I would like to connect my Apple TV 3rd gen to a projector and not an HD TV (so I can watch movies on the big screen). Are there any decent price compatible projectors? Good quality but not professional! Many thanks

    I would like to connect my Apple TV 3rd gen to a projector and not an HD TV (so I can watch movies on the big screen). Are there any decent price compatible projectors? Good quality but not professional! Many thanks

    Thank you for the answer, I suppose the main thrust of my enquiry is to find out if 65 MBits is my ATV theoretical limit of reception.  If that is the case then I am happy as a Pig in Mud
    I may have allowed myself to become a victim by listening to Fanbois posting elsewhere who always seem to go one better than everyone else. Now I have learnt two things Today; 65Mbit/s = Good enough and only read the apple forums.
    Many Thanks
    Nick

  • Defining a many-to-many relationship with CMP EJBs  : does it work for you

    Curious to know whether someone has been able to set up a many to many relationship between two entity beans.
    I have been struggling with this for days now and I can't get it to work.
    In my test project I have two entity beans, resp. Consultant and Solution.
    Consultant has a cmr field called 'solutions', which is a collection object from the opposite side (Solution).
    This is the source of the ejb-jar.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
         <description>EJB JAR description</description>
         <display-name>EJB JAR</display-name>
         <enterprise-beans>
              <session>
                   <ejb-name>ProfilerBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbses.profiling.Profiler</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
                   <ejb-local-ref>
                        <ejb-ref-name>EJBTesting/Solution</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocalHome</local-home>
                        <local>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocal</local>
                        <ejb-link>SolutionBean</ejb-link>
                   </ejb-local-ref>
                   <ejb-local-ref>
                        <ejb-ref-name>EJBTesting/Consultant</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocalHome</local-home>
                        <local>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocal</local>
                        <ejb-link>ConsultantBean</ejb-link>
                   </ejb-local-ref>
              </session>
              <entity>
                   <ejb-name>ConsultantBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbcmp.profiling.Consultant</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>Consultant</abstract-schema-name>
                   <cmp-field>
                        <field-name>firstname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>lastname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>country</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>id</field-name>
                   </cmp-field>
                   <primkey-field>id</primkey-field>
                   <query>
                        <query-method>
                             <method-name>findBySolution</method-name>
                             <method-params>
                                  <method-param>java.lang.String</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT Object(c) FROM Consultant AS c,
                        IN(c.solutions) s WHERE s.id = ?1 </ejb-ql>
                   </query>
              </entity>
              <entity>
                   <ejb-name>SolutionBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbcmp.profiling.Solution</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>Solution</abstract-schema-name>
                   <cmp-field>
                        <field-name>description</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>name</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>parent</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>id</field-name>
                   </cmp-field>
                   <primkey-field>id</primkey-field>
                   <query>
                        <query-method>
                             <method-name>findChildSolutions</method-name>
                             <method-params>
                                  <method-param>java.lang.String</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT Object(s) FROM Solution AS s WHERE
                        s.parent = ?1</ejb-ql>
                   </query>
                   <query>
                        <query-method>
                             <method-name>findTopLevelSolutions</method-name>
                             <method-params/>
                        </query-method>
                        <ejb-ql>Select Object(s) FROM Solution AS s WHERE
                        (s.parent = &apos;none&apos;)</ejb-ql>
                   </query>
              </entity>
         </enterprise-beans>
         <relationships>
              <ejb-relation>
                   <description>A consultant may have one or more areas of expertise</description>
                   <ejb-relation-name>Consultant_Solutions</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantBean</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <relationship-role-source>
                             <ejb-name>ConsultantBean</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>solutions</cmr-field-name>
                             <cmr-field-type>java.util.Collection</cmr-field-type>
                        </cmr-field>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionBean</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <relationship-role-source>
                             <ejb-name>SolutionBean</ejb-name>
                        </relationship-role-source>
                   </ejb-relationship-role>
              </ejb-relation>
         </relationships>
         <assembly-descriptor>
              <container-transaction>
                   <description>container-transaction</description>
                   <method>
                        <ejb-name>SolutionBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>ProfilerBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>ConsultantBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    I created a stateless session bean as a business facade for the two entity beans. I then created a webservice to test the beans.
    What works :
    - create a consultant
    - get a consultant
    - create a solution
    - get a solution
    (basically everything that doesn't involve the relationship field.
    However, what doesn't work is the method call assignSolution:
    - assign solution : this is implemented as follows
    Business Method.
         public void assignSolution(String consultantID, String solutionID)
              throws ProfilingException {
              // TODO : Implement
              ConsultantLocal cons = null;
              SolutionLocal sol = null;
              try {
                   cons = consHome.findByPrimaryKey(consultantID);
                   sol = solHome.findByPrimaryKey(solutionID);
                   Collection solutions = cons.getSolutions();
                   solutions.add(sol);
                   //sol.getConsultants().add(cons);
              } catch (FinderException ex) {
                   ex.printStackTrace();
                   throw new ProfilingException("failed to retrieve data from DB", ex);
    As you can see I am trying to use the CM Relationship in this methhod. Adding the solution to a consultant should be as simple as adding a solution object to the collection retrieved with the getSolutions accessor. The Container is expected to persist the information in my MAXDB database.
    However this doesn't happen.
    The ORM details as defined in the persistent.xml follows :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE persistent-ejb-map SYSTEM "persistent.dtd">
    <persistent-ejb-map>
         <locking
              type="Table"/>
         <db-properties>
              <data-source-name>TCC_PORTAL_PROFILER</data-source-name>
              <database-vendor
                   name="SAPDB"/>
         </db-properties>
         <entity-beans>
              <entity-bean>
                   <ejb-name>ConsultantBean</ejb-name>
                   <table-name>PFL_CONSULTANTS</table-name>
                   <field-map
                        key-type="NoKey">
                        <field-name>firstname</field-name>
                        <column>
                             <column-name>FIRSTNAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>lastname</field-name>
                        <column>
                             <column-name>LASTNAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>country</field-name>
                        <column>
                             <column-name>COUNTRY</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="PrimaryKey">
                        <field-name>id</field-name>
                        <column>
                             <column-name>ID</column-name>
                        </column>
                   </field-map>
                   <finder-descriptor>
                        <method-name>findBySolution</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
              </entity-bean>
              <entity-bean>
                   <ejb-name>SolutionBean</ejb-name>
                   <table-name>PFL_SAPSOLUTIONS</table-name>
                   <field-map
                        key-type="NoKey">
                        <field-name>description</field-name>
                        <column>
                             <column-name>DESCRIPTION</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>name</field-name>
                        <column>
                             <column-name>NAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>parent</field-name>
                        <column>
                             <column-name>PARENTID</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="PrimaryKey">
                        <field-name>id</field-name>
                        <column>
                             <column-name>ID</column-name>
                        </column>
                   </field-map>
                   <finder-descriptor>
                        <method-name>findChildSolutions</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
                   <finder-descriptor>
                        <method-name>findTopLevelSolutions</method-name>
                        <method-params/>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
              </entity-bean>
         </entity-beans>
         <relationships>
              <table-relation>
                   <help-table>PFL_CONS_SOL_MAP</help-table>
                   <table-relationship-role
                        key-type="PrimaryKey">
                        <ejb-name>ConsultantBean</ejb-name>
                        <cmr-field>solutions</cmr-field>
                        <fk-column>
                             <column-name>CONSULTANTID</column-name>
                             <pk-field-name>id</pk-field-name>
                        </fk-column>
                   </table-relationship-role>
                   <table-relationship-role
                        key-type="PrimaryKey">
                        <ejb-name>SolutionBean</ejb-name>
                        <fk-column>
                             <column-name>SOLUTIONID</column-name>
                             <pk-field-name>id</pk-field-name>
                        </fk-column>
                   </table-relationship-role>
              </table-relation>
         </relationships>
    </persistent-ejb-map>
    The error in the default trace file when calling the method states, there is an "inconsistency in the number of primary keys". Details follow.
    #1.5#000F1F188E5C004400000000000010480003E76C80EFD57A#1098880364327#com.sap.engine.services.ejb#com.atosorigin.tcc/EJBCMPProfilingTest#com.sap.engine.services.ejb#Guest#2####4d2b2370281411d9a40d000f1f188e5c#SAPEngine_Application_Thread[impl:3]_31##0#0#Error##Java###
    [EXCEPTION]
    #1#com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method assignSolution.
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerObjectImpl0.assignSolution(ProfilerObjectImpl0.java:822)
         at com.atosorigin.tcc.testing.ejbses.profiling.Profiler_Stub.assignSolution(Profiler_Stub.java:533)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
         at $Proxy73.assignSolution(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)
         at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)
         at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)
         at SoapServlet.doPost(SoapServlet.java:51)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:339)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:317)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:810)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:238)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    Caused by: com.sap.engine.services.applocking.exception.SAPAppLockingIllegalArgumentException: Inconsistency in number of primary keys
         at com.sap.engine.services.applocking.TableLockingImpl.getArgument(TableLockingImpl.java:385)
         at com.sap.engine.services.applocking.TableLockingImpl.lock(TableLockingImpl.java:128)
         at com.sap.engine.services.applocking.TableLockingImpl.lock(TableLockingImpl.java:138)
         at com.sap.engine.services.ejb.entity.pm.lock.TableLockingSystem.write(TableLockingSystem.java:82)
         at com.sap.engine.services.ejb.entity.pm.PersistentM2M.create(PersistentM2M.java:172)
         at com.sap.engine.services.ejb.entity.pm.PersistentCacheM2M.add(PersistentCacheM2M.java:197)
         at com.sap.engine.services.ejb.entity.pm.multiple.CollectionM2M.add(CollectionM2M.java:57)
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerBean.assignSolution(ProfilerBean.java:201)
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerObjectImpl0.assignSolution(ProfilerObjectImpl0.java:771)
         ... 32 more
    I can't figure out what the problem is with the ORM mapping defined.
    On the database level I have three tables. Consultant maps to PFL_CONSULTANT, Solution to PFL_SAPSOLUTIONS. The third table PFL_CONS_SOL_MAP is the help table used for the relationship (having two fields, which are in fact foreign keys from the other two tables to express the assignment of solutions to consultants (where a consultant can have one or more solutions).
    ps. : I am running Netweaver Developer Workplace (Netweaver 2004, at stack level 5)
    Message was edited by: Theo Paesen

    Hm, after disabling 'automatic locking' it works.

  • Best Method To Organize (move) Messages (many Mailboxes to one)

    I'm working on reorganizing my Mail messages from unique Mailboxes for certain topics (or senders) to having my messages in Mailboxes by year. Then use Smart Mailboxes to view what I need.
    Before I start moving around a lot of messages, I want to make sure what I'm doing will work and not cause any unforeseen side effects.
    Right now, I have many (20 or more) Mailboxes that I use to organize all the mail I get. What I want to do is move all my messages from last year (2013) into one new Mailbox.
    Here's the method I thought I'd use:
    Create a Smart Mailbox > Date Range > 1/1/2013 to 12/31/2013
    That should effectively show me all mail messages received last year.
    Create a new Mailbox called Mail 2013
    Drag all the messages in the above Smart Mailbox into Mail 2013.
    My understanding is that this will move all the messages I received in 2013 (which are currently sitting in many different Mailboxes on my Mac) into the newly created Mail 2013 Mailbox. The Smart Mailbox (with the 2013 date range) will still show all the same messages, since it doesn't matter where the messages are located.
    Am I correct?
    Is this the best method for doing this? Moving messages from many Mailboxes into a few Mailboxes that contain any and all messages within a specific date range.

    Hi;
    My first question is your ASM cant be mount to your new box? If answer yes than Just create same path,same hostname&Ip for new server(Unplog your existing server cable) than just open your new server and open db.
    You may also go wiht RMAN(Even you go wiht clone process you need to use RMAN due to do usage of ASM)
    I suggest also see:
    Master Note For Oracle Database Upgrades and Migrations [ID 1152016.1]
    Regard
    Helios

  • Cascade delete in many to many association

    Hi All,
        I have a usecase, there is an association with many to many cardinality  between 3 EO's. If i delete  any record in master, the corresponding childs all should delete.
        So appreciate if any alternatives on above usecase. Thanks in advance

    Hi,
    cascade delete is a function of the database. When you enable cascade delete for an entity operation then this only produces the proper SQL code for deleting a data object. If you have a many-to-many relation then this means you have multiple master and child records, which I think makes your "If i delete  any record in master, the corresponding childs all should delete" impossible.
    for what its worth, please read
    Creating a Business Domain Layer Using Entity Objects - 11g Release 2 (11.1.2.3.0)
    to learn how to parse and delete detail records  from an entity object
    http://docs.oracle.com/cd/E35521_01/web.111230/e16182/bcentities.htm#CEGJAFCF
    The last document is about posting orders (e.g. create a master record before you create detail records). However, with a few changes you can reverse this to perform a delete operation (just add this code to the entity impl classes of the entities so they delete their child objects
    Frank

  • Portal Form for a Many to Many relationship

    I have 3 tables (well there are actually more but i'm glad when i can do the trick with 3 at the moment):
    T_JOURNAL (JOURNAL_ID, JOURNAL_NAME)
    T_CONTENTBROKER (CONTENTBROKER_ID, CONTENTBROKER_NAME)
    HT_JOURNAL_CONTENTBROKER (JOURNAL_ID, CONTENTBROKER_ID)
    The HT stants for 'help table'. T_JOURNAL and T_CONTENTBROKER have a many to many relationship. So one Journal can have many Broker and one Broker has many Journals.
    When doing a Form in Oracle Portal for adding a new Journal, i'd like to have a LoV with the Brokers. But an new entry would at least require 3 tables to update (T_JOURNAL, T_CONTENTBROKER and the help table HT_JOURNAL_CONTENTBROKER). How can this be solved? i'm not very good with pl/sql... so if there is only a solution with pl/sql i would be glad for the code...
    I also tried to create a view wich would show me the journal with all its broker but i kind of failed...
    any suggestions appreciated ;)
    - renato

    Thanks for the info. I tried that and it still doesn't pull the value. I have opened a TAR via metalink, but I'm not getting any
    satisfactory answers. I ran across an note - 137172.1 that has this snippet of information in it.
    Unfortunately, at this time (portal 3.0.7.6.2) , a non-table item cannot be
    referenced in a plsql event handler, only in client side JavaScript code. This
    is a known limitation and will be fixed in a future release.
    I don't know how to get the value from the client side JavaScript code to a pl/sql variable. Do you?
    I've been trying to get them to tell me if the 'known issue' has been addressed in 3.0.9.
    I'll keep at it. Thanks so much for your suggestion I appreciate it.
    Deb

Maybe you are looking for