One-to-Many implemented with a join Table

Hello,
Is it possible to implement a One-to-Many relationship with a join table, just like
the Reference Implementation does.
Regards,
Jeroen

"Jeroen Ferdinandus" <[email protected]> wrote in
news:[email protected]:
Is it possible to implement a One-to-Many relationship with a join
table, just like the Reference Implementation does.Not with our CMP, you will have to resort to BMP for that.
Cedric

Similar Messages

  • Unidirectional one-to-many relationship without a join table

    Hello,
    I have 2 classes, Invoice and InvoiceLine, and a one-to-many unidirectional relationship from Invoice to InvoiceLine. By default, with JPA, it would be mapped by a join table with foreign keys that refer to the 2 tables which represent Invoice and InvoiceLine.
    My problem: the database has already a foreign key in the table which represents InvoiceLine that refers to the table which represents Invoice.
    To solve my problem I could make the relationship bidirectional but I would like to know if it is possible to keep it unidirectional and to use the foreign key which already exists (in the table that represents InvoiceLine). How could I declare the mapping with JPA?
    Thanks in avance for your answers.

    JPA requires that any @OneToMany mapping not using a join table have an inverse @ManyToOne mapping. In general the foreign key in the target object needs to be mapped and a @ManyToOne mapping is normally the best way to map it, so making the relationship bi-directional is your best option.
    There are other ways in TopLink to map a unidirectional 1-m, but these are not directly supported by the JPA spec. You could define a TopLink OneToManyMapping for the relationship through a TopLink DescriptorCustomizer and the code API. You would still need to map the foreign key in the target object some way, but you could use a @Basic mapping for this as long as you keep it in synch.
    In TopLink you could also map the relationship using an AggregateCollectionMapping (basically a collection of embeddables), and then not require mapping the foreign key in the target, but this imposes limitations on the target object (must be treated like an embeddable instead of entity). You would also need to configure the target object to be an aggregateCollectionDescriptor if using this option.

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • 3 way one-to-many through a single link table

    I have 3 tables that are linked through one to many relationships in a single link table. Here's the real relationships:
    assay(id)
    multiplex(id, assays)
    markerset(id, assays, multiplexes)
    Here's the database schema:
    assay(id, name)
    markerset(id, name)
    multiplex(id, name)
    assay_marker_set(assay_id[not null], marker_set_id[not null], multiplex_id[nullable])
    I've mapped one-to-many relationships between markersets and assays, and multiplexes and assays, and BOTH of these one-to-manys need to be writable. In the record creation process, assays are associated with markersets, and then assays are associated with multiplexes, which in turn are associated with markersets.
    Here's our dilemma. When committing multiplexes through a unit of work, the one-to-many with assays can't see the one-to-many with markersets, so the commit fails because the markerset key is null.
    We've gotten around the problem by creating a postSave() method in markerset that writes multiplex changes once they are created. But again, in a unitofwork commit, saving a markerset fires the postSave() method, which writes assays and multiplexes that have not yet been written to the database.
    We've gotten around THAT by only turning on postSave() when creating multiplexes, not when associating assays with markersets.
    My question is, is there a more conventional approach to this problem? Clearly, the database needs to be reworked, but time constraints and the quantity of data to be curated makes changing the schema impossible. Or have we arrived at the most sensible solution to a ridiculous problem? Currently what we have works, it's just incredibly complicated, and nearly unmaintainable.
    Thanks for the time to even read this post, and mocking is permitted ;-)
    Paul Cooper
    GlaxoSmithKline US Bioinformatics

    Looks like your object model does not match your data model.
    From you object model you seem to have,
    Assay
    MarkerSet 1-m Assay, 1-m Multiplex
    Multiplex 1-m Assay
    From your data model you have,
    Assay 1-m AssayMarkerSetAssociation
    MarkerSet 1-m AssayMarkerSetAssociation
    Multiplex 1-m AssayMarkerSetAssociation
    AssayMarkerSetAssociation 1-1 Assay, 1-1 MarkerSet, 1-1 Multiplex
    (your object model seems to be also missing the name)
    I'm not exactly sure how you have your mapping working, but it would seem the best solution is to introduce an AssayMarkerSetAssociation object into your object model.
    If you do not wish to use this object in your model, you could just use it internally to store the relationship and still have get/set methods for the relationships that you want that initialize themselves from the associations.
    So your object model would be,
    Assay
    MarkerSet 1-m AssayMarkerSetAssociation (+ getAssays, getMultiplexes methods)
    Multiplex 1-m AssayMarkerSetAssociation (+ getAssays, method)
    AssayMarkerSetAssociation 1-1 Assay, 1-1 MarkerSet, 1-1 Multiplex
    In general you seem to be able to get your mapping working without changing your object model, but are probably better off for maintainability to change your model slightly.

  • One to Many Mapping with different SQL types

    We have an interesting one to many relationship in our system in which the source and target field SQL types do not match, but the values do. The relationship is actually between multiple entries in the same database table. So, imagine we have some table that looks sort of like this:
    KEY ObjectID OwnerNo
    100 1234     0
    101 ABCD     1234
    102 EFGH     1234ObjectID is defined as a varchar type, but Parent entries are guaranteed to have integer value ObjectIDs. Child entries point to the parent through the OwnerNo field, which defined in the database as a numeric.
    A simple one-to-many mapping will give you the following SQL error on execution: [SQL0401] Comparison operator = operands not compatible.
    I tried modifying my descriptor after load as follows:
       public static void modifyOneToMany(Descriptor descriptor)
           ExpressionBuilder builder = new ExpressionBuilder();
           Expression exp = builder.getField("OwnerNo").
              equal(builder.getField("ObjectID").toNumber());
           descriptor.getMappingForAttributeName("children")
              .setSelectionCriteria(exp);
       }But this introduces two problems in the generated SQL ( ... WHERE ((t0.OwnerNo = TO_NUMBER(t0.ObjectID) ... ). First, this generates a where clause using the function TO_NUMBER, which is not supported by DB2 on AS400, our database platform. Second, the table reference is off in the generated SQL--I couldn't find a way to specify that the right hand side of the = operator should be from the parent of the one to many mapping--both sides are referenced from the child context (t0).

    I found the getFunction() method on Expression, so I can solve half of this problem with the following code:
       public static void modifyOneToMany(Descriptor descriptor)
         if (descriptor.getMappingForAttributeName("children").isOneToManyMapping())
           OneToManyMapping map = (OneToManyMapping) descriptor.
                                  getMappingForAttributeName("children");
           DatabaseField objectID= (DatabaseField) map.getSourceKeyFields().get(0);
           DatabaseField ownerNo = (DatabaseField) map.getTargetForeignKeyFields().get(0);
           ExpressionBuilder builder = new ExpressionBuilder();
           Expression exp = builder.getField(ownerNo).getFunction("CHAR").
                            equal(builder.getField(objectID));
           map.setSelectionCriteria(exp);
       }This generates the following where clause:
    ... WHERE ((CHAR(t0.OwnerNo) = t0.ObjectID) ...
    But, I still have two questions:
    1. How do we get the right hand side of this comparison to reference the Parent part of the 1-M mapping?
    2. Since character and numeric conversions are pretty standard SQL functions, is there something wrong with the DB2 database platform I'm using?

  • Sorting on one-to-many relationship with JPA criteria API

    I'm having some trouble using JPA criteria API with collection references.
    I have an entity called Competence that has a one-to-many relation to CompetenceName that contains names for Competence for several languages.
    [Competence.java]
    @OneToMany(mappedBy="competence", cascade=CascadeType.ALL, orphanRemoval=true)
    private List<CompetenceName> competenceNames;
    [CompetenceName.java]
    @ManyToOne @JoinColumn(name = "competence_id", referencedColumnName = "id")
    private Competence competence;
    @ManyToOne @JoinColumn(name = "lang_id", referencedColumnName = "id")
    private Language language;
    @Basic @Column(name = "name", length = 50)
    private String name
    Now I want to load 200 Competence-entities and sort them by their name (depending on the language of the logged in user). How would this be done using the JPA Criteria API? With a normal query, I would accomplish this with
    "SELECT DISTINCT c FROM Competence AS c LEFT JOIN c.competenceNames AS cn ORDER BY cn.name"
    Obviously, CompetenceName could contain zero entries for a Competence, but it works anyway with a normal query. With criteria API, it would look something like:
    CriteriaQuery<Competence> cq = cb.createQuery(Competence.class);
    Root<Competence> competence = cq.from(Competence.class);
    competence.fetch(Competence_.competenceNames);
    cq.select(competence).orderBy(cb.asc(competence.get(Competence_.competenceNames).get(CompetenceName_.name)); // Doesn't work
    Is this even possible to do without creating a normal query?
    Edited by: 812655 on Nov 24, 2010 2:32 AM

    // Doesn't workWhat does not work? What error do you get?
    You need to use "join" to define a join.
    CriteriaQuery<Competence> cq = cb.createQuery(Competence.class);
    Root<Competence> competence = cq.from(Competence.class);
    Join<CompetenceName> name = competence.join(Competence_.competenceNames);
    cq.orderBy(cb.asc(name.get(CompetenceName_.name));
    The "fetch" will do a fetch join, if you also wish to load the data in the same query.
    James : http://www.eclipselink.org

  • Select distinct problem with muliple join tables, help needed

    Hi,
    I have two main tables. Each has its of sub joined tables.
    guest_id_for_reservation connects two major tables. This has
    to be that way
    because my guest may change the room status from single to
    double (and the
    similar exceptional requests).
    guests reservation
    guest_id_for_reservation
    countrytable hoteltable
    delegationtable roomtype
    I form a query. I want to select distinct those results. But
    it does not
    work.
    If I do not include any table related to reservation table
    and its sub
    joined tables (disregarding guest_id_for_reservation), it
    works.
    Is there a specific syntax for select distinct of this type
    or any
    workaround.?
    Thank you
    Hakan

    Hi I'm still battling with this - have connected the AX to my Imac via ethernet and it shows up fine in Airport Utility. Status light is green and it says its set up to connect to my existing wireless network using wireless connection. Security in Network Preferences is the same for both: WPA2 Personal.
    So I don't think there's a problem with the AX, and my current wireless network (BT Home Hub) is working fine.
    And when I restore factory settings Airport Utility can see the AX before updating settings so the wireless side of AX must work too.
    I'm figuring it must be something about the settings that mean AU can't see it anymore. But I can't work out what, since security is the same.
    Any ideas would be great!

  • Pass Value From One Form to Another and Populate Join Table

    I have a table “std_controls” and a table “actual_controls”.  The standard controls table is updated with the expected business control or process.  The actual controls table is updated with the control or business process the company actually
    has in place.  These two tables may be updated at different times by different individuals.  Later I need to be able to map the actual controls to the standard controls.  I have done this before using a join query which then matched the primary
    keys and populates a new table with the joined keys.  What I would like to be able to do is this:  Have a form open, “form1” (which is where the standard controls are entered).  The user could then click a button which would open another form,
    “form2”, that listed all actual controls at that time from which they could choose.  The user could then select the actual control on “form2” they wanted to map to the current standard control on “form1”.  The user could select the actual control
    on “form2” by selecting a check box.  The effect of this mapping would populate my join table.
    I have seen other posts that describe doing something similar, but I need more help on how to actually set it up.  Thanks for your help.

    Hi jdmcleod,
    According to your description, I don’t understand clearly about your requirement.
    But I think you could access “form1”/”form2”’s control in either of “form1” or “form2”, so you could have a button in “form1” or “form2”, then in the click event get these forms control’s value (e.g. checkbox) and update the database.
    For example to access other form’s checkbox value:
    Dim f As Form
    Set f = Forms!OtherFrom
    MsgBox f.Controls("Check11").Value
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Testing for IS NOT NULL with left join tables

    Dear Experts,
    The query is showing the NULL rows in the query below....
    Any ideas, advice please? tx, sandra
    This is the sql inspector:
    SELECT O100321.FULL_NAME_LFMI, O100321.ID, O100404.ID, O100321.ID_SOURCE
    , O100404.NAME, O100321.PERSON_UID, O100404.PERSON_UID, O100404.VISA_TYPE
    FROM ODSMGR.PERSON O100321
    , ODSMGR.VISA O100404
    WHERE ( ( O100321.PERSON_UID = O100404.PERSON_UID(+) ) ) AND ( O100404.VISA_TYPE(+) IS NOT NULL )

    Hi Everyone,
    I am understanding alot of what Michael and Rod wrote.... I am just puzzled over the following:
    the query below is left joining the STUDENT table to
    HOLD table.
    The HOLD table - contains rows for students who have holds on their record.
    a student can have more than one hold (health, HIPAA, basic life saving course)
    BUT, for this query: I'm only interested that a hold exists, so I'm choosing MAX on hold desc.
    Selecting a MAX, helps me, bec. it reduces my join to a 1 to 1 relationship, instead of
    1 to many relationship.
    Before I posted this thread at all, the LEFT JOIN below testing for IS NOT NULL worked w/o
    me having to code IS NOT NULL twice....
    Is that because, what's happening "behind the scenes" is that a temporary table containing all max rows is being
    created, for which Discoverer has no predefined join instructions, so it's letting me do a LEFT JOIN and have
    the IS NOT NULL condition.
    I would so appreciate clarification. I have a meeting on Tues, for which I have to explain LEFT JOINS to the user
    and how they should create a query. I need to come up with rules.
    If I feel "clear", I asked my boss to buy Camtasia videocast software to create a training clip for user to follow.
    Also, if any Banner user would like me to email the DIS query to run on their machine, I would be glad to do so.
    thx sooo much, Sandra
    SELECT O100384.ACADEMIC_PERIOD, O100255.ID, O100384.ID, O100255.NAME, O100384.NAME, O100255.PERSON_UID, O100384.PERSON_UID, MAX(O100255.HOLD_DESC)
    FROM ODSMGR.HOLD O100255, ODSMGR.STUDENT O100384
    WHERE ( ( O100384.PERSON_UID = O100255.PERSON_UID(+) ) ) AND ( O100384.ACADEMIC_PERIOD = '200820' )
    GROUP BY O100384.ACADEMIC_PERIOD, O100255.ID, O100384.ID, O100255.NAME, O100384.NAME, O100255.PERSON_UID, O100384.PERSON_UID
    HAVING ( ( MAX(O100255.HOLD_DESC(+)) ) IS NOT NULL )
    ORDER BY O100384.NAME ASC

  • One to one mapping and one to many mapping in a single table

    Hi All,
    I am asked to design a banking application, I have CUSTOMER table where the information regarding the customer is stored. I have have an ACCOUNT table where account information is stored.
    Now A customer can start all the 3 types of accounts. (Checking account, Saving account and FD(Fixed Deposits))
    One customer can have - >Only one checking account only one Saving account, but can have many FD account. How do we implement this using integrity constraints?
    CUSTOMER Table -> Cust_id(PK), Cust_name, Cust_phone, Cust_address
    ACCOUNT Table -> AccountNo, Acc_type,Cust_id
    Your answer is greatly appreciated.
    Thanks
    Sophy

    You may need to create a UNIQUE function based index. That would work for you.
    create table customer_1 (Cust_id integer primary key, Cust_name varchar2(100), Cust_phone number, Cust_address varchar2(100))
    create table account_1 (AccountNo integer primary key, Acc_type varchar2(100),Cust_id integer references customer_1(cust_id))
    create unique index account_idx on account_1 (cust_id, decode(acc_type,'CA',acc_type, 'SA', acc_type, 'FD', 'FD' || accountno))
    insert into customer_1 (cust_id, cust_name, cust_phone, cust_address) values (1, 'karthick', 0, 'x')
    insert into account_1 (accountno, acc_type, cust_id) values(1, 'CA', 1)
    insert into account_1 (accountno, acc_type, cust_id) values(2, 'SA', 1)
    insert into account_1 (accountno, acc_type, cust_id) values(3, 'FD', 1)
    insert into account_1 (accountno, acc_type, cust_id) values(4, 'FD', 1)
    insert into account_1 (accountno, acc_type, cust_id) values(5, 'FD', 1)
    /

  • TL11g & EJB3: One-to-Many problems with removing entity from list

    Hi,
    I posted this problem on JDev11g forum, but I hope I will get some information here as well.
    I have two entities based on tables in HR schema (Departments and Employees). Department has a list of employees. These are the annotations:
    @Entity
    public class Departments implements Serializable {
        @OneToMany(mappedBy = "departments", cascade = {CascadeType.ALL})
        private List<Employees> employeesList;
    @Entity
    public class Employees implements Serializable {
        @ManyToOne
        @JoinColumn(name = "DEPARTMENT_ID")
        private Departments departments;
    }On a test page, I have a master-detail tables that show all departments and employees in the selected department (drag&drop from data control), a button that removes selected employee from employeeList iterator, and a button that calls em.merge(department).
    The problem is that when I remove some employees from employeeList, on merge, the incoming entity, as well as the return result of the 'merge', are OK (the list doesn't contain the removed entities), but nothing is updated in the database, and no error is shown.
    Can anyone help me with this? I can send the test case if anyone is interested.
    Thanks,
    Pedja

    The transaction is Container Managed, but I did try with flushing the changes, but without success. Here is the log:
    [TopLink Finest]: 2008.08.06 04:31:25.431--ServerSession(27620915)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Execute query ReadAllQuery(model.Employees)
    [TopLink Finest]: 2008.08.06 04:31:25.431--ServerSession(27620915)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--reconnecting to external connection pool
    [TopLink Fine]: 2008.08.06 04:31:25.431--ServerSession(27620915)--Connection(21332891)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--SELECT EMPLOYEE_ID, LAST_NAME, COMMISSION_PCT, PHONE_NUMBER, SALARY, HIRE_DATE, FIRST_NAME, EMAIL, JOB_ID, MANAGER_ID, DEPARTMENT_ID FROM EMPLOYEES WHERE (DEPARTMENT_ID = ?)
         bind => [20]
    [TopLink Finest]: 2008.08.06 04:31:25.431--ServerSession(27620915)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Execute query ReadObjectQuery(model.Employees)
    [TopLink Finest]: 2008.08.06 04:31:25.431--ServerSession(27620915)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Execute query ReadObjectQuery(model.Departments)
    [TopLink Finest]: 2008.08.06 04:31:25.431--UnitOfWork(14721024)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@3001c6
    [TopLink Finest]: 2008.08.06 04:31:25.431--UnitOfWork(14721024)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@1f7d08a
    [TopLink Finest]: 2008.08.06 04:31:25.431--UnitOfWork(14721024)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@3001c6
    [TopLink Finest]: 2008.08.06 04:31:25.431--UnitOfWork(14721024)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Departments@1b21b91
    [TopLink Finer]: 2008.08.06 04:31:36.836--ServerSession(27620915)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--client acquired
    [TopLink Finer]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--TX binding to tx mgr, status=STATUS_ACTIVE
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Merge clone with references model.Departments@1c49e79
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@3001c6
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@aa10a9
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Departments@12c0836
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@aa10a9
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Departments@1b21b91
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@3001c6
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@1f7d08a
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Employees@3001c6
    [TopLink Finest]: 2008.08.06 04:31:36.836--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Register the existing object model.Departments@1b21b91
    [TopLink Finer]: 2008.08.06 04:31:38.711--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--TX beforeCompletion callback, status=STATUS_ACTIVE
    [TopLink Finer]: 2008.08.06 04:31:38.711--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--begin unit of work commit
    [TopLink Finer]: 2008.08.06 04:31:38.711--ClientSession(2685953)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--TX beginTransaction, status=STATUS_ACTIVE
    [TopLink Finest]: 2008.08.06 04:31:38.711--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--Execute query UpdateObjectQuery(model.Departments@776fc0)
    [TopLink Finer]: 2008.08.06 04:31:38.711--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--TX afterCompletion callback, status=COMMITTED
    [TopLink Finer]: 2008.08.06 04:31:38.805--UnitOfWork(631279)--Thread(Thread[HTTPThreadGroup-1,9,HTTPThreadGroup])--end unit of work commitThanks,
    Pedja

  • EJB3: One-to-Many problems with removing entity from list

    Hi,
    I have two entities based on tables in HR schema (Departments and Employees). Department has a list of employees. These are the annotations:
    @Entity
    public class Departments implements Serializable {
        @OneToMany(mappedBy = "departments", cascade = {CascadeType.ALL})
        private List<Employees> employeesList;
    @Entity
    public class Employees implements Serializable {
        @ManyToOne
        @JoinColumn(name = "DEPARTMENT_ID")
        private Departments departments;
    }On a test page, I have a master-detail tables that show all departments and employees in the selected department (drag&drop from data control), a button that removes selected employee from employeeList iterator, and a button that calls em.merge(department).
    The problem is that when I remove some employees from employeeList, on merge, the incoming entity, as well as the return result of the 'merge', are OK (the list doesn't contain the removed entities), but nothing is updated in the database, and no error is shown.
    Can anyone help me with this? I can send the test case if anyone is interested.
    Thanks,
    Pedja

    Hi,
    I have two entities based on tables in HR schema (Departments and Employees). Department has a list of employees. These are the annotations:
    @Entity
    public class Departments implements Serializable {
        @OneToMany(mappedBy = "departments", cascade = {CascadeType.ALL})
        private List<Employees> employeesList;
    @Entity
    public class Employees implements Serializable {
        @ManyToOne
        @JoinColumn(name = "DEPARTMENT_ID")
        private Departments departments;
    }On a test page, I have a master-detail tables that show all departments and employees in the selected department (drag&drop from data control), a button that removes selected employee from employeeList iterator, and a button that calls em.merge(department).
    The problem is that when I remove some employees from employeeList, on merge, the incoming entity, as well as the return result of the 'merge', are OK (the list doesn't contain the removed entities), but nothing is updated in the database, and no error is shown.
    Can anyone help me with this? I can send the test case if anyone is interested.
    Thanks,
    Pedja

  • 'One' To 'Many' relationship, (with the 'One' shared between persistance object graphs)

    Hi,
    I'm relatively new to JDO. So I need some verification on my program design.
    When creating a new Persistence Object I'm using a 'Builder' design pattern
    to check the database for an object that equals the new objects bean
    parameters(Via a JDOQL query). If it finds a matching one it loads it
    otherwise it creates a new instance.
    This way I have common objects between Persistence Object graphs. And there
    is not repeated common objects in the database.
    Is there a better way?
    regards
    Graham Cruickshanks

    // Doesn't workWhat does not work? What error do you get?
    You need to use "join" to define a join.
    CriteriaQuery<Competence> cq = cb.createQuery(Competence.class);
    Root<Competence> competence = cq.from(Competence.class);
    Join<CompetenceName> name = competence.join(Competence_.competenceNames);
    cq.orderBy(cb.asc(name.get(CompetenceName_.name));
    The "fetch" will do a fetch join, if you also wish to load the data in the same query.
    James : http://www.eclipselink.org

  • One-to-many relationship with php

    I want to use a list of items that give related items in a grid, for example a list of days with a grid displaying students who attend on each day. I hve trwled the internet, but don't see any examples of this relationship in Flash Builder (4.6).
    Can anyone point me in the right direction? I am writing an appplication that uses php services to a mysql db.

    // Doesn't workWhat does not work? What error do you get?
    You need to use "join" to define a join.
    CriteriaQuery<Competence> cq = cb.createQuery(Competence.class);
    Root<Competence> competence = cq.from(Competence.class);
    Join<CompetenceName> name = competence.join(Competence_.competenceNames);
    cq.orderBy(cb.asc(name.get(CompetenceName_.name));
    The "fetch" will do a fetch join, if you also wish to load the data in the same query.
    James : http://www.eclipselink.org

  • One to Many table join -- concat field per record grouped by id

    Post Author: wm5
    CA Forum: Formula
    Hello,
    I am using Crystal Reports XI and have two tables that have a one to many relationship and are joined by an JobID (number).
    Below is a sample with relative fields for each table.
    job_table: JobID (number), Manager (text), Status (text)
    jobaudit_table : JobAuditID (number), JobID (Number), FormID (Number)
    There is a one to many relationship with jobaudit_table having multiple records for each JobID in job_table.
    I have created a Group Header using the job_table.JobID and suppressed the detail section.
    In the group header for each JobID I display the JobID, Manager, Status. I also use the below formula to determine if any records in the jobaudit_table has a record where FormID = 90. If so, I display "Yes". If not, "No".
    So my report currently looks like.
    JobID     Manager     Status     Audit Performed
    1           Manager 1  Closed           N
    2          Manager 2   Closed           Y
    Here are the formula's I use to determine if any records in jobaudit_table contains a record where FormID = 90.
    @ja90exists
    if {jobaudit_table.FormID} = 90 then    1else    0;
    if sum({@ja90exists},{job_table.JobID}) = 0 then    "No"else    "Yes";
    Everything so far works fine. What I would like to do now is add a hyperlink to a script to view the job audit when in the above report the "Audit Performed" column is "Yes"
    So Report is now:
    JobID     Manager     Status     Audit Performed
    1           Manager 1  Closed           N
    2          Manager 2   Closed           Y (hyperlink to view audit)
    I cannot figure out how to gather the valid JobAuditIDs where FormID = 90 grouped by JobID to be used in the Group Heading section of the report.
    Also, it is unlikely, but possible that more than one job_audit record exists with FormID = 90 per JobID. So, my hyperlink could look like http://mysite.com/viewjobaudit.aspx?jobid=[jobaudit_table.JobAuditID],[jobaudit_table.JobAuditID] .
    Thanks for any help. And if this post is not clear let me know and I will clarify.
    wm5

    Post Author: bettername
    CA Forum: Formula
    Although I can't think of a way to get multiple hyperlinks, this should be a start.  It (should) hyperlink to the last job/audit in the group that formID of 90.  Oh, I assumed that the hyperlink should have been  xxxx...jobID,jobAuditID! 
    I think there may be a way of getting hyperlinks to every "90" record, but that will involve a subreport, so lets try this first...
    1 - everything from your group header to the group footer...
    2 -  add a formula into the group header that says:
    whileprintingrecords;
    stringvar jobauditID="";
    stringvar jobID:=";
    3 - Then add a formula to the details section:
    whileprintingrecords;
    stringvar jobauditID;
    stringvar jobID;
    if {jobaudit_table.FormID} = 90
    then (jobID:=totext({job_table.job_id},0,""); jobauditID:=totext({jobaudit_table.jobaudit_id},0,"")
    4 - Finally, on your "Audit Performed" formula, have a conditional hyperlink that says:
    whileprintingrecords;
    stringvar jobauditID;
    stringvar jobID;
    if {@audit performed} = "Y" then http://mysite.com/viewjobaudit.aspx?jobid=jobID","+jobauditID

Maybe you are looking for

  • Getting java.sql.SQLException: Missing IN or OUT at index::9

    Hi, I am getting the following error while executing a call to a pl/sql procedure from an updateRow method inside a rowimpl file for an OA View. FND_GENERIC_MESSAGE. Tokens: MESSAGE = java.sql.SQLException: Missing IN or OUT parameter at index:: 9; a

  • Adobe App Manager Issues

    I am trying to download Fireworks onto my PC at work and I get the following issue: Adobe Genuine Software Validation Failure. The product you are trying to install is not an Adobe Genuine Softwareand appears to be counterfeit. I have my home Mac on

  • Photoshop CS2 (Mac) bricht bereits beim Starten ab

    Hallo, arbeite mit CS2 (Mac). Photoshop bricht seit Kurzem bereits beim Starten ab. Auch Neuinstallation hat nichts gebracht. Adobe konnte mir "nur" mit einer englischsprachigen Anweisung zur Fehlerbehebung aushelfen mit der ich, sprachlich bedingt,

  • Table Relationship (REFERENCES/CONSTRAINTS)

    Hello, I am a novice user of SQL Plus and have the following question to be able to easier join Oracle tables: Which statement should I use to be able to view from table A all possible links to other tables (FK, PK)? I have been looking at following

  • Reference Date in CRM Service Transactions Ext_Ref_Date

    Hello Experts, I am trying to create a query in CRM tr - SQ01 for Service Transactions and Business Partners.  I have linked the proper tables for Header and Line Item information.  One piece of information I am missing is the "Reference Date" - Ext_