Many-to-Many relation sample in ADF

I have a requirement to implement a screen
Three tables 1) Users 2) Access 3) Documents
The Access table contains both the references DocId and UserId and acts as the intersection table.
Users table is related to Documents through the Access table which acts as the intersection table and vice versa. I need to create a screen gui which will show all the documents a user has. Secondly also show all the users who has permission to a particular document. Is there any sample adf application which implements a simple many-to-many relation.
I am planning to create three entity objects - UsersEO, AccessEO, DocumentsEO
two view objects - UsersVO and DocumentsVO
one view link -UsersDocumentVL
Also which GUI components is best suited to address this. How many Entity Objects, View Objects and View Link should I create. Any simple sampe will help.
Regards
Thomas

Thomas,
There are of course many ways to implement your requirement. Try this exercise... forget about ADF for a moment; put your computer away (well, finish reading this first ;) ). Grab a pencil and paper.. assuming you could do anything, how would you like the screen to work? Draw it out on a piece of paper and describe how it works. You've just created a rudimentary specification. Now, come back to this thread and describe your specification - perhaps then we can help you implement your spec using ADF (or at least tell you "not possible" and describe why).
Best,
John

Similar Messages

  • SQLIntegrityConstraintViolationException in a "many to many" related tables

    Hi, in an 11g adf application I have a “many to many” relationship between two tables A and B and an intermediate table C that relates them.
    The database has constraints that check for id existence in master tables before saving rows in C.
    When I’m trying to create a new entry in B’s UI form with relations to A I’m getting a:
    java.sql.SQLIntegrityConstraintViolationException: ORA-02291:
    the framework seems that tries to save the row in C before B. So there doesn’t exist the id in B.
    The same operation in A table’s UI form is executed properly. The framework first creates a row in A
    and then related it with B creating rows in C and no constraint violation is thrown.
    Why is this happening?
    Any comment will be helpful.
    Thanks

    Using BC Tester the save operation is executed properly without errors.
    The constraint you are asking is a classic referential constraint in intermediate table C that requires when creating new rows in C the foreign key refer to B to pre-exist in B table.
    So the sequence of save operation is important when creating new rows in B and C table.
    If I create a new row in B, save it and then create relations as new rows in C everything is fine.
    But if I concurrently create a new row in B with rows in C, the framework seems that tries to save firstly the rows in C and then in master table B so the referential integrity is violated.
    Is it possible in ADF to influence to order of saves in master detail tables and how is this specified?
    For example the same operation with same integrity constraints in UI form of A table is executed properly.

  • ADF-Newbie.How can I create a many-to-many row from an action method?

    Hi all,
    First of all, this is my scenario:
    - JDeveloper 10.1.3.0.4
    - My application is running ADF + Faces + Toplink + EJB Facade
    - My database model includes some many-to-many relationships and some one-to-may relationships.
    I have developed several ADF pages displaying some CRUD operations over my master tables and my master-detail tables without any problem.
    I am now trying to implement some CRUDs over my many-to-many relationship tables.
    Lets call the tables involved as master1, master2, and relationship (the many-to-many table)
    Because usability reasons, my user wants me to implement an interface where he can:
    -Select a row from the master1 table
    -Select a row from the master2 table
    -Click a button called "Create relationship"
    I need to implement the code inside the action button to add my new record on the relationship table, and honestly, I have not found any clue.
    Please, give me some directions to solve my problem.
    Thank you in advance for your help...

    The key here is to work with the intersection table for your MtM relationship.
    The way I do it, is to have the user view Master Table I, and click on the add Relationship button, this button is a link to a add form for the Intersection Table. On the Add form, the MasterTable 1 Id is already filled in and I hide it. I then setup MasterTable 2 as an LOV on the page. The used selects the item from the LOV and clicks on the commit button. I refresh my many-to-many view and all is grand.
    Using ADF/JSF, I have made it even nicer by turning the add relationship page into a dialog page, that way the user can see the previous page while adding the new relationship.
    Kelly

  • [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.

  • Problem in mapping a many to many relation to a list

    Hi,
    I have a problem with mapping a many to many relation to a list.
    I have a Many to Many relation in my database between tables baskets and products. This relation is implemented with a join table basket_products, which has two fields which correspond to the foreign keys to tables baskets and products. The join table need to have another one column "order", which defines the order of the products for the specific basket.
    In my mapping I have:
    @Entity
    @Table(name = "baskets", uniqueConstraints = {})
    public class Components implements java.io.Serializable {
    @ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
         @JoinTable( name="baskets_products",
                             joinColumns=@JoinColumn(name="b_id", referencedColumnName="pr_id"),
                             inverseJoinColumns=@JoinColumn(name="pr_id", referencedColumnName="pr_id"))
            //This of course doesn't work!!
           //@OrderBy(value="order")
         public List<Products> getProductses() {
              return this.productses;
         public void setProductses(
                   List<Products> productses) {
              this.productses = productses;
    @Entity
    @Table(name = "products", uniqueConstraints = { })
    public class Products implements java.io.Serializable {
    @ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "productses")
         public Set<Baskets> getBasketses() {
              return this.basketses;
         public void setBasketses(Set<Basket> basketses) {
              this.basketses = basketses;
         }In the EJB spec I read that :
    "The property or field name must correspond to that of a persistent property or field of the associated
    class."
    What to do if I want to use a field from the join table to do the ordering of the list??
    My problem is that the field "order", is not defined to the EJB container as a persistent field, so it cannot be used. But for my needs it is necessary that this field is included in the join table.
    I thought that I could use the secondary table annotation to map the join table to the Baskets class, as well, so that I can define the order field, but this solution seems to me as a really wrong one.
    Can anyone help me??
    Thanks,
    Elenh.

    Hi Martin-
    Can you please help me. Here are the details:
    We have created an AQ in Oracle DB which will have the following message Structure:
    CREATE OR REPLACE TYPE enqueue_payload AS OBJECT
    ( field1 VARCHAR2(100),
    field2 VARCHAR2(100),
    field3 DATE,
    field4 VARCHAR2(100),
    field5 NUMBER,
    payload CLOB,
    In the Payload field we are enqueing an XML message.
    We have to use a OSB proxy service to dequeue the message from the AQ, transform it to another format and send to a SOA Composite.
    We created a AQ Adapter in Jdeveloper 11g and imported the WSDL, XSD and .jca jca binding file into the OSB project. And configured the OSB proxy service using the WSDL imported.
    However in OSB proxy service message flow when I try to create an XQUERY transformation, I see that the Payload field does not expose the structure of the XML message that is being enqueued. I even changed the message structure definition to have the payload field as XMLType. But it didn't help.
    On analyzing the XSD created by AQ Adapter, I see that the payload is being defined as "string" in the XSD.
    Inputs Needed
    =========
    1. How can we parse the payload field defined as CLOB/XMLType in OSB so that I can see the structure of the XML message it holds ?
    2. Is there any in-built function in OSB to convert it to XML ?
    3. Any other inputs in order to transform the XML message coming in the payload field as CLOB/XMLType
    Please provide your inputs and I hope that I have clearly explained my use case.
    Thanks in advance for your time and help!!
    Regards,
    Dibya

  • Master detail relation in the ADF Jdev10g sample application

    Hi,
    I have to develop Master detail relation in the ADF Jdev10g. Need sample application...Can anybody help me..

    Lots and lots of tutorials [url http://www.oracle.com/technetwork/developer-tools/jdev/overview/index-100269.html]here
    Note: 11g has been out for some time now, and if you are doing new development, it really makes sense to be using the latest software. If, by chance, you happen to be talking about doing development for the E-Business Suite, you want to be asking on the OA Framework forum.
    John

  • Additional properties on Many-to-Many relation

    Hi,
    I've trawled through the archive and can't see if this is answered (nor can I find it in the documentation) so apologies if I've missed something obvious.
    I have a logical model with several many-to-many relationships. Clearly I can (and probably should) resolve them, but for a number of reasons I'd prefer, for now, to leave them as m:n.
    On at least one of the m:n I want to add additional (non-FK attributes) to the relationship. There is even a section of the Relation Properties dialog that looks like it should allow me to do so (Attributes) but this is only populated in a 1:m relationship.
    Is there any way of directly adding the non-FK attributes to the relationship? Or do I have to resolve the m:n and add the attributes to the new entity? Or is there some way in the transformation of adding the attributes?
    Thanks
    Ian

    Hi Ian,
    I want to add additional (non-FK attributes) to the relationshipIt's not possible in current release.
    It's better to resolve the relationship to entity and to add attributes there.
    Philip

  • Many-to-many relation

    Hi,
    There is a many-to-many relation defined for the following tables:
    Table T_PRICEAFFECTOR
    Name Type
    NAME VARCHAR2(100)
    ISACCUMULATIVE NUMBER(1)
    RATE NUMBER(10,10)
    PRICEAFFECTOR_ID NOT NULL NUMBER(10)
    CATALOG_ID NOT NULL NUMBER(10)
    UNITTYPE NOT NULL NUMBER(1)
    and
    Table T_PRICEAFFECTINGCHAIN
    Name Type
    PRICEAFFECTINGCHAIN_ID NOT NULL NUMBER(10)
    NAME VARCHAR2(100)
    ISDEFAULTFORSTORE NUMBER(1)
    CATALOG_ID NOT NULL NUMBER(10)
    There is also a third table defining the many-to-many relation:
    TABLE T_PRICEAFFECTORTOCHAIN
    Name Type
    PRICEAFFECTOR_ID NOT NULL NUMBER(10)
    PRICEAFFECTINGCHAIN_ID NOT NULL NUMBER(10).
    The classes defined are as follows:
    public class PriceAffectorsChain
         private Catalog catalog;
         private long priceAffectorsChainId;
         private String name;
         private boolean isDefaultForStore;
         private Collection priceAffectors = new HashSet ();
         private Collection products = new HashSet ();
    public class PriceAffector
         private long priceAffectorId;
         private long isAccumulative;
         private String name;
         private double rate;
         private Catalog catalog;
         private int unitType;
         private Collection priceAffectorsChains = new HashSet ();
    and these are defined in the jdo descriptor in the following way:
    <class name="PriceAffector" identity-type="application"
    objectid-class="jp.telewave.platpark.eis.dao.pk.PriceAffectorPK">
         <extension vendor-name="kodo" key="lock-column" value="none"/>
         <extension vendor-name="kodo" key="class-column" value="none"/>
         <extension vendor-name="kodo" key="table" value="T_PRICEAFFECTOR"/>
         <field name="priceAffectorId" primary-key="true">
              <extension vendor-name="kodo" key="data-column"
    value="PRICEAFFECTOR_ID"/>
         </field>
         <field name="isAccumulative">
              <extension vendor-name="kodo" key="data-column" value="ISACCUMULATIVE"/>
         </field>
         <field name="name">
              <extension vendor-name="kodo" key="data-column" value="NAME"/>
         </field>
         <field name="rate">
              <extension vendor-name="kodo" key="data-column" value="RATE"/>
         </field>
         <field name="unitType">
              <extension vendor-name="kodo" key="data-column" value="UNITTYPE"/>
         </field>
         <field name="catalog">
              <extension vendor-name="kodo" key="catalogId-data-column"
    value="CATALOG_ID"/>
         </field>
         <field name="priceAffectorsChains">
              <collection element-type="PriceAffectorsChain"/>
              <extension vendor-name="kodo" key="read-only" value="true"/>
              <extension vendor-name="kodo" key="inverse" value="priceAffectors"/>
              <extension vendor-name="kodo" key="table"
    value="T_PRICEAFFECTORTOCHAIN"/>
              <extension vendor-name="kodo" key="priceAffectorId-ref-column"
    value="PRICEAFFECTOR_ID"/>
              <extension vendor-name="kodo" key="priceAffectorsChainId-data-column"
    value="PRICEAFFECTINGCHAIN_ID"/>
         </field>
    </class>
    <class name="PriceAffectorsChain" identity-type="application"
    objectid-class="jp.telewave.platpark.eis.dao.pk.PriceAffectorsChainPK">
         <extension vendor-name="kodo" key="lock-column" value="none"/>
         <extension vendor-name="kodo" key="class-column" value="none"/>
         <extension vendor-name="kodo" key="table" value="T_PRICEAFFECTINGCHAIN"/>
         <field name="priceAffectorsChainId" primary-key="true">
              <extension vendor-name="kodo" key="data-column"
    value="PRICEAFFECTINGCHAIN_ID"/>
         </field>
    <field name="catalog">
              <extension vendor-name="kodo" key="catalogId-data-column"
    value="CATALOG_ID"/>
         </field>
         <field name="name">
              <extension vendor-name="kodo" key="data-column" value="NAME"/>
         </field>
         <field name="isDefaultForStore">
         <extension vendor-name="kodo" key="data-column"
    value="ISDEFAULTFORSTORE"/>
         </field>
         <field name="priceAffectors">
              <collection element-type="PriceAffector"/>
              <extension vendor-name="kodo" key="read-only" value="false"/>
              <extension vendor-name="kodo" key="inverse"
    value="priceAffectorsChains"/>
              <extension vendor-name="kodo" key="table"
    value="T_PRICEAFFECTORTOCHAIN"/>
              <extension vendor-name="kodo" key="priceAffectorsChainId-ref-column"
    value="PRICEAFFECTINGCHAIN_ID"/>
              <extension vendor-name="kodo" key="priceAffectorId-data-column"
    value="PRICEAFFECTOR_ID"/>
         </field>
         <field name="products">
         <collection element-type="Product"/>
         <extension vendor-name="kodo" key="inverse" value="priceAffectorsChain"/>
         </field>
    </class>
    =============================================================
    Ok. The problem with the mapping is that it works only one way. What I
    mean is that when I try to add new PriceAffectorsChain with many
    PriceAffector objects only the PriceAffectorsChain object is being
    persisted, and none of the PriceAffectors are persisted in the
    many-to-many table (T_PRICEAFFECTORTOCHAIN), even when the read-only
    extensions are set.
    That was not the case when I tried to add new PriceAffector with many
    PriceAfffectorsChain - everything worked.
    Any Ideas?
    -Ivan

    Abe White wrote:
    When you have a two-sided relation, you need to be maintaining both sides
    of the relation at all times. Whenever an A is added to a B, the B must
    be added to the A as well. Keep your in-memory Java objects consistent
    (just as if they were not persistent), and JDO will take care of the rest.Abe White wrote:
    When you have a two-sided relation, you need to be maintaining both sides
    of the relation at all times.
    Whenever an A is added to a B, the B must
    be added to the A as well. Keep your in-memory Java objects consistent
    (just as if they were not persistent), and JDO will take care of the rest.Ok. I agree.
    I think that I'm doing this or maybe I'm wrong. Below is the code that
    adds new price affectors chain with collection of price affectors (all of
    them already persistent). Each of the price affectors is being looked up
    and is consistent (this is what getObjectById is doing, isn't it?) and
    then the price affector chain is being persisted.
    =================================================================
    PersistenceManager pm = null;
    PriceAffectingChain newPriceAffectorsChain = null;
    HashSet priceAffectors = null;
    try {
    pm = persistenceManagerFactory.getPersistenceManager();
    // getting the catalog object
    long catalogId = priceAffectorsChain.getCatalog().getCatalogId();
    CatalogPK catalogPK = new CatalogPK(catalogId);
    Catalog newPriceAffectorsChainCatalog =
    (Catalog)pm.getObjectById(catalogPK, true);
    // making new price affecting chain
    newPriceAffectorsChain = new PriceAffectingChain(
    BeanHelper.getNextSequence(DBObjects.SEQ_PRICEAFFECTINGCHAIN),
    priceAffectorsChain.getName(),
         priceAffectorsChain.getIsDefaultForStore(),
         newPriceAffectorsChainCatalog);
    // retrieval of price affector objects for this chain
    System.out.println("the size of the price affectors is: " +
    priceAffectorPKs.length);
    if (priceAffectorPKs != null && priceAffectorPKs.length > 0) {
         priceAffectors = new HashSet(priceAffectorPKs.length);
    for (int i = 0; i < priceAffectorPKs.length; i++) {
              PriceAffectorPK currentPAPK = priceAffectorPKs;
              PriceAffector currentPA = (PriceAffector)pm.getObjectById(currentPAPK,
    true);
              priceAffectors.add(currentPA);
              System.out.println("The " + currentPA.getName() + " price affector was
    added");
    if (priceAffectors == null) {
         priceAffectors = new HashSet();
    System.out.println("size of priceAffectors: " +
    priceAffectors.size());
    newPriceAffectorsChain.setPriceAffectors(priceAffectors);
    pm.makePersistent(newPriceAffectorsChain);
    } catch {
    ===========================================================
    The problem is that the presistence works only for the table of
    PriceAffectingChain obejct and not for the relation table. I tried on
    purpose to add new price affectors with collection of price affecting
    chains and it worked for both tables (the one for PriceAffector object and
    the relation table.
    I have no idea what I can try next. Any advice or help are welcomed.
    Thanks.
    -Ivan

  • Many-to-Many in ADF

    Hello:
    Thanks for looking this post. I have a rookie question, but I'm not finding alot of info regarding this.
    Say I have two tables: Teachers and Students and there is a many-to-many between Teachers and Students. So we create a third table called Classes and create two one-to-many relationships.
    The Question is how do we do this in ADF? On the screen, I'd like to show Teachers, Students and Classes and have their navigation all coordinated. I would also like to create the association if I insert a new teacher or student. (The association would be an insert into the intersection table Classes for the primary key of teachers and primary key of students) What is the best way to accomplish all of this in the GUI? Got any ideas? Also can you point me to the correct location in the technical docs?
    Thanks for the Help.
    Don

    this will help http://mjabr.wordpress.com/2011/05/21/how-to-implement-many-to-many-association/

  • Many to Many relation problem

    Hi,
    JDeveloper 11.1.1.6
    3 tables, let's name them A, B and RelAB
    By default, there is a [1 to *] from A to RelAB and a [1 to *] from B to RelAB.
    Since I wanted to use a master-detail view on my web page, I didn't have the choice to modify these Associations and Links to a [* to *] from A to B, and as well from B to A.
    Now you test the whole thing by running the AppModule. Everything works like a charm.
    The problem is if I go into my A view object and then I change the SQL Mode from Normal to Expert inside the Query tab, the minute I run my AppModule, one of my many to many relationship breaks. Notice that I did not change anything else, just switch from Normal to Expert. Let's say that the A to B relation is working but not the B to A.
    If I put it back to Normal, it works again. You might want to ask, why bother with Expert Mode? It is just that I want to modify this query, I was just trying to identify the source of the problem.
    Anybody experience a similar problem with many-to-many relationships?

    I assume your question is on JAXB, correct?
    I think you need to make on side of the relationship transient, or remove it.
    James : http://www.eclipselink.org

  • ADF BC: Many-to-Many Insert

    Hi :)
    I have a many-to-many relationship ( person has many cars and cars can have many persons)
    Now i wanted to insert a new car for a given person.
    So i dragged my personview->carView form and readonly table.
    It inserts the new car. But the middle table is not changed.
    Why?

    At row creation time, a view link handles the job of filling in the current value of the respsective foreign key attributes from the current row of the master view. If you have multiple master view objects using multiple view links, then each of them will populate their respective foreign key values. If this is not what you want, then the alternative I suggested that does not use mutlple-master view objects instances would be the way to go.
    I think the simplest thing for you to do is the following:
    (1) Person entity associated to PersonCar entity (1-*)
    (2) Car entity associated to PersonCar entity (1-*)
    (3) Create a PersonView based on Person entity
    (4) Create a PersonCarView based on PersonCar intersection entity, using a secondary Car entity as a reference to display the name of the car
    (5) Create a CarLookupView based on the Car entity (this will be used to present a list of valid cars to pick when adding a new car for a person
    If your PersonEditPage needs to display the current list of cars assigned to that person, then it would show the details from the CarView.
    To add a new car for a person, you create a new row in the CarView that is the detail of the current row in the PersonView.
    The "add a new car for a person" page, would have a dropdown list based on the results of the "CarLookupView" as its valid choices (and it's personId would be filled in automatically from the view link.
    I think this would be the simplest way to address your use case. In practice, rather than using a many-to-many view link, its using just a single view link from PersonView to PersonCarView, and the PersonCarView references the related information about the car using a reference entity usage (which translates to a join in the automatically created SQL for your view object with reference information).

  • What is the best way to implement writable many-to-many relations

    As everyone knows, the many-to-many associations provided by BC4J are quite good to read many-to-many associations, but they are not able to write such associations.
    There are other solutions using composite associations or cascading-delete foreign keys, but as I was tought now, they are also quite problematic. See thread Internal error: Entity.afterRollback.status_dead   -- What does this mean? for more details.
    So I ask you: What is the best way to implement writable many to many associations? Do you really have to manage them "by hand"?
    Thanks for your ideas
    Frank

    I'd appreciate any hint
    Thanks

  • A many-to-many relational problem (SQL and CFM)

    My question:
    How to get CFM to return a many-to-many relationship in one
    row using cfloop
    My table structure:
    Table A - Books
    BookID | BookName
    1 | Book One
    Table B -
    RelatingTable
    BookID | AuthorID
    1 | 60
    1 | 61
    Table C - Authors
    AuthorID | AuthorName
    60 | Bob
    61 | Joe
    My query:
    SELECT * FROM Books, RelatingTable, Authors AS a
    INNER JOIN Books AS b ON b.BookID = r.BookID
    INNER JOIN RelatedTable AS r ON r.AuthorID = a.AuthorID
    Output I am getting:
    b.BookID | b.BookName | r.BookID | r.AuthorID | a.AuthorID |
    a.AuthorName
    ---------|------------|----------|------------|------------|-------------
    1 | Book One | 1 | 60 | 60 | Bob
    1 | Book One | 1 | 61 | 61 | Joe
    I am using a UDF that turns my relationship into a comma list
    (authorlist), but the duplicates still return in CFM because the
    JOIN relationship
    The code I am using in CFM:
    <cfloop query="rsBooksQuery">
    #b.BookName#, written by #authorlist#
    </cfloop>
    How Coldfusion is displaying my output:
    Book One, written by Bob, Joe
    Book One, written by Bob, Joe
    How I want my output displayed:
    Book One, written by Bob, Joe
    I need this to work in cfloop and not cfoutput! I know that
    you can use group in CF output, but for the conditions I am using
    this query, it must be in a loop
    the reason why i keep the JOINs even though i have a UDF to
    create a comma list is that some of my CFM pages use variables
    passed to the qry to limit which books are displayed, for example
    &author=60 (which would display a list of Bob's books that
    include the comma list)
    If you can suggest anything to help me I will be very
    thankful

    I need this to work in cfloop and not cfoutput! I know that
    you can use
    group in CF output, but for the conditions I am using this
    query, it
    must be in a loop
    If you can suggest anything to help me I will be very
    thankful
    If you can not use <cfoutput...> with its group
    feature, you need to
    recreate the functionality with <cfloop...>. You can
    create nested
    <cfloop...> tags that keep track of the changing group
    value. It takes
    more code, but that's what happens when one sets outside the
    bounds of
    the built in functionality.

  • Many to Many Relations Problem

    I have following two classes with many-to-many case:
    public class Protocol {
    private long protocolId;
    private final Collection keyPersons = new ArrayList();
    public void addKeyPerson(Person person) {
    person.addKeyProtocol(this);
    public void removeKeyPerson(Person person) {
    person.removeKeyProtocol(this);
    public class Person {
    private long personId;
    private final Collection keyProtocols = new ArrayList();
    public void addKeyProtocol(Protocol protocol) {
    protocol.getKeyPersonsCollection().add(this);
    keyProtocols.add(protocol);
    public void removeKeyProtocol(Protocol protocol) {
    protocol.getKeyPersonsCollection().remove(this);
    keyProtocols.remove(protocol);
    The meta data is:
    <?xml version="1.0"?>
    <jdo>
    <package name="peacetech.nih.nhlbi.iasp.dao">
    <class name="Protocol" identity-type="application"
    objectid-class="peacetech.nih.nhlbi.iasp.dao.oid.ProtocolOid">
    <extension vendor-name="tt" key="table" value="protocol"/>
    <extension vendor-name="tt" key="pk-column" value="int_protocol"/>
    <extension vendor-name="tt" key="lock-column" value="none"/>
    <extension vendor-name="tt" key="class-column" value="none"/>
    <field name="protocolId" primary-key="true">
    <extension vendor-name="tt" key="data-column" value="int_protocol"/>
    </field>
    <field name="keyPersons">
    <collection element-type="Person"/>
    <extension vendor-name="tt" key="inverse" value="keyProtocols"/>
    <extension vendor-name="tt" key="table" value="KeyPersonnel"/>
    <extension vendor-name="tt" key="personId-data-column" value="PID"/>
    <extension vendor-name="tt" key="protocolId-ref-column"
    value="int_protocol"/>
    </field>
    </class>
    <class name="Person" identity-type="application"
    objectid-class="peacetech.nih.nhlbi.iasp.dao.oid.PersonOid">
    <extension vendor-name="tt" key="table" value="Personnel"/>
    <extension vendor-name="tt" key="pk-column" value="PID"/>
    <extension vendor-name="tt" key="lock-column" value="none"/>
    <extension vendor-name="tt" key="class-column" value="none"/>
    <field name="personId" primary-key="true">
    <extension vendor-name="tt" key="data-column" value="PID"/>
    </field>-
    <field name="keyProtocols">
    <collection element-type="Protocol"/>
    <extension vendor-name="tt" key="inverse" value="keyPersons"/>
    <extension vendor-name="tt" key="table" value="KeyPersonnel"/>
    <extension vendor-name="tt" key="protocolId-data-column"
    value="int_protocol"/>
    <extension vendor-name="tt" key="personId-ref-column" value="PID"/>
    </field>
    </class>
    The assignment works fine beetwen New Persistent Protocol and Persons, but
    when ever I try to add new assignment between existing protocol and person:
    void updateProtocol(PersistenceManager pm){
    Extent e = pm.getExtent (Person.class, true);
    Query query = pm.newQuery (Person.class, e, "fname == \"Alex\"");
    Collection collection = (Collection) query.execute();
    Iterator i = collection.iterator ();
    Person alex = (Person)i.next();
    System.out.println("Person to assign" + alex);
    e = pm.getExtent (Protocol.class, true);
    query = pm.newQuery (Protocol.class, e, "projectTitle == \"This is
    JDO test N1\"");
    collection = (Collection) query.execute();
    i = collection.iterator ();
    Protocol firstProtocol = (Protocol)i.next();
    try {
    pm.currentTransaction().begin();
    e = pm.getExtent (Person.class, true);
    query = pm.newQuery (Person.class, e, "fname == \"Brian\"");
    collection = (Collection) query.execute();
    i = collection.iterator ();
    while (i.hasNext ())
    firstProtocol.addKeyPerson((Person)(i.next()));/*Exception
    here!*/
    pm.currentTransaction().commit();
    } catch (Exception ex) {
    pm.currentTransaction().rollback();
    ex.printStackTrace(System.out);
    I have following exception:
    javax.jdo.JDOUserException: The given element "
    =======Person=======
    First Name: Brian
    Last Name: Agricola
    Phone: null
    Email: null
    ====================" does not meet the requirements for the container.
    at
    com.solarmetric.kodo.util.SecondClassObjects.checkValue(SecondClassObjects.j
    ava:224)
    at com.solarmetric.kodo.util.ProxyLinkedList.add(ProxyLinkedList.java:71)
    at peacetech.nih.nhlbi.iasp.dao.Person.addKeyProtocol(Person.java:176)
    at peacetech.nih.nhlbi.iasp.dao.Protocol.addKeyPerson(Protocol.java:147)
    at peacetech.nih.nhlbi.iasp.IASPTest.updateProtocol(IASPTest.java:142)
    at peacetech.nih.nhlbi.iasp.IASPTest.updateProtocol(IASPTest.java:110)
    at peacetech.nih.nhlbi.iasp.IASPTest.runTest(IASPTest.java:28)
    at peacetech.nih.nhlbi.iasp.IASPTest.main(IASPTest.java:22)
    I have the same problem also for one to many.
    Can you help me with it?
    Thanks,
    Kirill.

    I have following two classes with many-to-many case:
    public class Protocol {
    private long protocolId;
    private final Collection keyPersons = new ArrayList();
    public void addKeyPerson(Person person) {
    person.addKeyProtocol(this);
    public void removeKeyPerson(Person person) {
    person.removeKeyProtocol(this);
    public class Person {
    private long personId;
    private final Collection keyProtocols = new ArrayList();
    public void addKeyProtocol(Protocol protocol) {
    protocol.getKeyPersonsCollection().add(this);
    keyProtocols.add(protocol);
    public void removeKeyProtocol(Protocol protocol) {
    protocol.getKeyPersonsCollection().remove(this);
    keyProtocols.remove(protocol);
    The meta data is:
    <?xml version="1.0"?>
    <jdo>
    <package name="peacetech.nih.nhlbi.iasp.dao">
    <class name="Protocol" identity-type="application"
    objectid-class="peacetech.nih.nhlbi.iasp.dao.oid.ProtocolOid">
    <extension vendor-name="tt" key="table" value="protocol"/>
    <extension vendor-name="tt" key="pk-column" value="int_protocol"/>
    <extension vendor-name="tt" key="lock-column" value="none"/>
    <extension vendor-name="tt" key="class-column" value="none"/>
    <field name="protocolId" primary-key="true">
    <extension vendor-name="tt" key="data-column" value="int_protocol"/>
    </field>
    <field name="keyPersons">
    <collection element-type="Person"/>
    <extension vendor-name="tt" key="inverse" value="keyProtocols"/>
    <extension vendor-name="tt" key="table" value="KeyPersonnel"/>
    <extension vendor-name="tt" key="personId-data-column" value="PID"/>
    <extension vendor-name="tt" key="protocolId-ref-column"
    value="int_protocol"/>
    </field>
    </class>
    <class name="Person" identity-type="application"
    objectid-class="peacetech.nih.nhlbi.iasp.dao.oid.PersonOid">
    <extension vendor-name="tt" key="table" value="Personnel"/>
    <extension vendor-name="tt" key="pk-column" value="PID"/>
    <extension vendor-name="tt" key="lock-column" value="none"/>
    <extension vendor-name="tt" key="class-column" value="none"/>
    <field name="personId" primary-key="true">
    <extension vendor-name="tt" key="data-column" value="PID"/>
    </field>-
    <field name="keyProtocols">
    <collection element-type="Protocol"/>
    <extension vendor-name="tt" key="inverse" value="keyPersons"/>
    <extension vendor-name="tt" key="table" value="KeyPersonnel"/>
    <extension vendor-name="tt" key="protocolId-data-column"
    value="int_protocol"/>
    <extension vendor-name="tt" key="personId-ref-column" value="PID"/>
    </field>
    </class>
    The assignment works fine beetwen New Persistent Protocol and Persons, but
    when ever I try to add new assignment between existing protocol and person:
    void updateProtocol(PersistenceManager pm){
    Extent e = pm.getExtent (Person.class, true);
    Query query = pm.newQuery (Person.class, e, "fname == \"Alex\"");
    Collection collection = (Collection) query.execute();
    Iterator i = collection.iterator ();
    Person alex = (Person)i.next();
    System.out.println("Person to assign" + alex);
    e = pm.getExtent (Protocol.class, true);
    query = pm.newQuery (Protocol.class, e, "projectTitle == \"This is
    JDO test N1\"");
    collection = (Collection) query.execute();
    i = collection.iterator ();
    Protocol firstProtocol = (Protocol)i.next();
    try {
    pm.currentTransaction().begin();
    e = pm.getExtent (Person.class, true);
    query = pm.newQuery (Person.class, e, "fname == \"Brian\"");
    collection = (Collection) query.execute();
    i = collection.iterator ();
    while (i.hasNext ())
    firstProtocol.addKeyPerson((Person)(i.next()));/*Exception
    here!*/
    pm.currentTransaction().commit();
    } catch (Exception ex) {
    pm.currentTransaction().rollback();
    ex.printStackTrace(System.out);
    I have following exception:
    javax.jdo.JDOUserException: The given element "
    =======Person=======
    First Name: Brian
    Last Name: Agricola
    Phone: null
    Email: null
    ====================" does not meet the requirements for the container.
    at
    com.solarmetric.kodo.util.SecondClassObjects.checkValue(SecondClassObjects.j
    ava:224)
    at com.solarmetric.kodo.util.ProxyLinkedList.add(ProxyLinkedList.java:71)
    at peacetech.nih.nhlbi.iasp.dao.Person.addKeyProtocol(Person.java:176)
    at peacetech.nih.nhlbi.iasp.dao.Protocol.addKeyPerson(Protocol.java:147)
    at peacetech.nih.nhlbi.iasp.IASPTest.updateProtocol(IASPTest.java:142)
    at peacetech.nih.nhlbi.iasp.IASPTest.updateProtocol(IASPTest.java:110)
    at peacetech.nih.nhlbi.iasp.IASPTest.runTest(IASPTest.java:28)
    at peacetech.nih.nhlbi.iasp.IASPTest.main(IASPTest.java:22)
    I have the same problem also for one to many.
    Can you help me with it?
    Thanks,
    Kirill.

  • Many to many relationships (Again)

    Hello,
    There was a posting on above subject.
    Re: Many to many relationships between Fact and Dimension
    They asked to look chapter 3 in the user's guide... <http://download.oracle.com/docs/pdf/B10996_01.pdf>. chapter 3 talks about defining Oracle Data Objects. I could find above subject in chapter 3 .
    Here is our situation We are using OWB 9.2.0.2.8. We are in a situation to build ETL from denormalized (relational tables) source to normalized target (relational tables). It is not a data warehouse situation. It could be a reverse of data warehouse. As given below
    Supplier >--------------------<Item
    becomes Supplier ------<supp_item.>--------------Item after many to many resolution, Where supp_item is interface table.
    We were able build Supplier and Item through seprate mapping. I could build supp_item through post mapping process. I look for alternate thought as well.
    We are using separate sequence number for Supplier , Item and supp_item. The sequences will be surrogate keys such as Supplier ( Suppseq(PK)), Item (Itemseq (PK)) and supp_item(suppitemseq (PK)) Here is the sample
    Supplier
    001|S001
    002|S002
    003|S003
    004|S004
    Item
    001|I001
    002|I002
    003|I003
    Supp_item (Suppseq|ItemSeq)
    001|002 --- S001 I002
    001003 -----S001 I003
    001|004 ----- S001 I 004
    002|002 ---- S 002 I002
    002|003 ---- S 002 I003
    003|001 --- S 003 I 003
    003|003 --- S 003 I 003
    Did any body face such situation? What is the best way to create a mapping (single map or multiple map with processflow sequence) for this situation?
    Let me know the steps exercised in OWB for this situation.
    I appreciate your help.
    Regards
    Ram

    Hi Ram,
    The easiest way to do this, would be to:
    - Load supplier in one mapping and generate the surrogate key.
    - Load item another (or the same) mapping and generate the surrogate key.
    - Load supplier_item in its own separate mapping, using a key lookup (or join) to (with) the supplier and item tables.
    Needless to say, you should create unique keys on the natural key of the supplier and item tables, to enable quick index-based lookups and make sure you get one unique value for every value of the natural key.
    Hope this helps,
    Mark.

Maybe you are looking for

  • ITunes can't see my songs. Drive Letter Change.

    I have over 10,000 songs in my iTunes library.  They all have a path that originates from my drive L.  This is my external hard drive.  The drive was shut off, as it has been many times in the past, and when it was turned back on, it was all of a sud

  • Premiere Pro CC2014 suddenly slow and unusable

    Last week I started a new project with PProCC2014 and thought nothing of the program's reliability because I've used it to this point without a problem. This new project is a big one with tight deadlines, and I've run into a major issue with what I b

  • Selecting JList item with the spacebar

    i have a class that extends JList, and my JList is a list of checkboxes. I would like to move to a checkbox with the arrow keys, check a checkbox with the spacebar, or uncheck it if the spacebar is pressed again. it should only select/deselect the ce

  • Search Engine Optimization (SEO) and Lightroom

    I have a client using Lightroom to post photo galleries and he is concerned about Search Engine Optimization. I'm not a Lightroom user but need to know if there is a way to set page titles and photo alt tags from Lightroom rather than after the fact.

  • Best practice for upgrading from ADS 9.1 to ADS 11

    So we will need start upgrading installs from Advantage Database Server (ADS) version 9 to ADS version 11. Is there a set of best practices? Certain procedures? How do we gracefully fall back if it doesn't work? Does anyone have experience with the d