Relation: one - many / findAllEntries()

Hello,
we created a relation one:many (manufacturer:vehicles).
Everything works fine except our findAll() method for the vehicles (many - side).
The problem is that we allways get null as result - what we expect is a collection of our car-entities.
Do we have to pay attention to something special?
Thanks for help,
André

What version of Kodo are you using?

Similar Messages

  • FatalUserException / One-Many relation relinking

    Hello all,
    I have a problem with one-many relations and relinking... Let's have a
    relation one-many between class Task and itself (classic parent-children
    problem).
    Initial Context
    - T1 has 2 child (T2, T3)
    What i need to do : move T3 as child of T2 to have :
    - T1 has 1 child (T2)
    - T2 has one child (T3)
    How i do it (using a global transaction) :
    transaction.begin();
    // unlinking T3 from T1
    T1.parent = null;
    T3.getChildren().remove(T1)
    // relink T3 to T2
    T1.parent = T2;
    T2.getChildren().add(T1);
    transaction.commit();
    I get this exception :
    Attempt to set column "TASK.parent" to two different values: (class
    java.lang.String)"T2", (null)"null" This can occur when you fail to set
    both sides of a two-sided relation between objects, or when you map
    different fields to the same column, but you do not keep the values of
    these fields in synch.
    When i test without a global transaction like this :
    transaction.begin();
    // unlinking T3 from T1
    T1.parent = null;
    T3.getChildren().remove(T1)
    transaction.commit();
    transaction.begin();
    // relink T3 to T2
    T1.parent = T2;
    T2.getChildren().add(T1);
    transaction.commit();
    With atomic transaction, everything is always fine. My problem is that I
    need to use global transaction because I need a global rollback and only
    one commit per big process, so I can't use atomic transactions (atomic
    commits takes too much time comparing to a global one) as this :
    Here we're in a particular case where I need to relink a task from a
    parent to its brother. In cases where new parent and old one have no
    close links, global transactions work fine, so this exception is not
    always thrown, which seems pretty weird to me.
    Working case using global transaction :
    =====================
    a) initial context
    T1 have 1 child(T2)
    T3 have 0 child
    b) actions
    moving T2 to T3 with global transaction
    c) result
    T1 have 0 child
    T3 have 1 child(T2)
    =====================
    This is very problematic and strange to me, so any help is welcomed...
    Thomas

    Looks like you use parent/children relationsheep wrongly. Try this instead:
    transaction.begin();
    // unlinking T3 from T1
    //T1.parent = null;
    T1.getChildren().remove(T3)
    // relink T3 to T2
    //T1.parent = T2;
    T3.parent = T2;
    T2.getChildren().add(T3);
    transaction.commit();
    "Thomas cornet" <[email protected]> wrote in message
    news:[email protected]...
    Hello all,
    I have a problem with one-many relations and relinking... Let's have a
    relation one-many between class Task and itself (classic parent-children
    problem).
    Initial Context
    - T1 has 2 child (T2, T3)
    What i need to do : move T3 as child of T2 to have :
    - T1 has 1 child (T2)
    - T2 has one child (T3)
    How i do it (using a global transaction) :
    transaction.begin();
    // unlinking T3 from T1
    T1.parent = null;
    T3.getChildren().remove(T1)
    // relink T3 to T2
    T1.parent = T2;
    T2.getChildren().add(T1);
    transaction.commit();
    I get this exception :
    Attempt to set column "TASK.parent" to two different values: (class
    java.lang.String)"T2", (null)"null" This can occur when you fail to set
    both sides of a two-sided relation between objects, or when you map
    different fields to the same column, but you do not keep the values of
    these fields in synch.
    When i test without a global transaction like this :
    transaction.begin();
    // unlinking T3 from T1
    T1.parent = null;
    T3.getChildren().remove(T1)
    transaction.commit();
    transaction.begin();
    // relink T3 to T2
    T1.parent = T2;
    T2.getChildren().add(T1);
    transaction.commit();
    With atomic transaction, everything is always fine. My problem is that I
    need to use global transaction because I need a global rollback and only
    one commit per big process, so I can't use atomic transactions (atomic
    commits takes too much time comparing to a global one) as this :
    Here we're in a particular case where I need to relink a task from a
    parent to its brother. In cases where new parent and old one have no
    close links, global transactions work fine, so this exception is not
    always thrown, which seems pretty weird to me.
    Working case using global transaction :
    =====================
    a) initial context
    T1 have 1 child(T2)
    T3 have 0 child
    b) actions
    moving T2 to T3 with global transaction
    c) result
    T1 have 0 child
    T3 have 1 child(T2)
    =====================
    This is very problematic and strange to me, so any help is welcomed...
    Thomas

  • One-many relation - search

    i've 3 tables:
    employees:
    eid,name,dept
    depts:
    did,name,company
    companys:
    cid,name
    the relations are all one-many.
    how can i make a form where i can search all employees of a selected company? or all employees of a selected department.
    only searching by dept is no problem, but the combination of both.....

    you may create your own search dialog box containing the fields to be searched--just like the MS Access application. then you may do all the combination of search, e.g., you may input ename, to find how many depts he/she works, and how many dependents he/she has.

  • One-many relation

    I have two classes like this:
    class A
    private Collection classBs;
    class B
    If I want the relation for classBs field to be one-many how do I state
    that in my .JDO file?
    Best regards,
    /Jan

    What version of Kodo are you using?

  • MappingInfoNotFoundException with one-many mapping to horizontal PC subclass

    Hi,
    I have a nasty niggling problem with a one-many mapping where the many
    side is a horizontally-mapped persistent subclass:
    kodo.util.FatalUserException: kodo.jdbc.meta.MappingInfoNotFoundException:
    The reference mappings for one-to-many field "Invoice.openTrades" are not
    in the table of the field's related persistent element
    type.[Invoice.openTrades [kodo.jdbc.meta.OneToManyFieldMapping]]
         at
    kodo.runtime.PersistenceManagerImpl.attach(PersistenceManagerImpl.java:4363)...
    NestedThrowablesStackTrace:
    kodo.jdbc.meta.MappingInfoNotFoundException: The reference mappings for
    one-to-many field "Invoice.openTrades" are not in the table of the field's
    related persistent element type.[Invoice.openTrades
    [kodo.jdbc.meta.OneToManyFieldMapping]]
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:134)
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:120)
         at
    kodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:94)
         at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:198)
         at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:470)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:991)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:971)
         at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.java:934)
         at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:654)
         at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java:796)
         at kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:431)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:349)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:177)
         at
    kodo.jdbc.meta.MappingRepository.getMetaData(MappingRepository.java:165)
         at
    kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:2423)
         at
    kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:2375)
         at kodo.runtime.AttachManager.makePersistent(AttachManager.java:410)
         at kodo.runtime.AttachManager.attach(AttachManager.java:279)
         at kodo.runtime.AttachManager.attach(AttachManager.java:56)
         at
    kodo.runtime.PersistenceManagerImpl.attach(PersistenceManagerImpl.java:4349)
    I have another one-many mapping on the "one" class which is fine and is
    almost identical to the invalid mapping - it joins on the same
    columns/foreign key. The only real difference is that my invalid "many"
    side is a horizontally mapped subclass (parent class mapped to different
    table). When I took that class out of its hierarchy and mapped it as base,
    it works. I don't know why Kodo is saying the mapping for the join is not
    found, as the "many" side has an invoice field mapped as one-one. The
    superclass does not have a relation to invoice mapped. A slight
    complication is that Invoice itself has a persistent superclass persisted
    in the same table, but nothing refers to that so I don't think it is
    relevant.
    Class diagram is roughly like this:
    BaseTrade
    |
    Invoice 1-* Trade
    BaseReceipt
    |
    Invoice 1-* Receipt
    Invoice mapped to Invoice table; Trade mapped to Trade table but its
    superclass mapped to diff BaseTrade table; Receipt and its superclass
    BaseReceipt mapped to Receipt table.
    I saw an earlier posting on the same exception that mentioned "collection
    element-type" - mine is specified as "Trade", ie the subclass.
    Is there any reason why this should not work?
    I can provide you with .jdo and .mapping files if necessary.
    Many thanks,
    Alex

    Alex-
    Can you post your mapping? I just ran a test with a one-many relation to
    a subclass of a horizontally mapped class, and it worked fine.
    FYI, the example mapping I was using was:
    <?xml version="1.0" encoding="UTF-8"?>
    <mapping>
    <package name="horizmany">
    <class name="HorizManyOwner">
    <jdbc-class-map type="base" pk-column="JDOID"
    table="BUG1174OWNER"/>
    <jdbc-version-ind type="version-number"
    column="JDOVERSION"/>
    <jdbc-class-ind type="in-class-name" column="JDOCLASS"/>
    <field name="relation">
    <jdbc-field-map type="one-many"
    ref-column.JDOID="OWNER_JDOID" table="BUG1174RELATIONSUB"/>
    </field>
    </class>
    <class name="HorizManyRelationSub">
    <jdbc-class-map type="base" pk-column="JDOID"
    table="BUG1174RELATIONSUB"/>
    <jdbc-version-ind type="version-number"
    column="JDOVERSION"/>
    <jdbc-class-ind type="in-class-name" column="JDOCLASS"/>
    <field name="horizmany.HorizManyRelationSuper.superString">
    <jdbc-field-map type="value" column="SUPERSTRING"/>
    </field>
    <field name="owner">
    <jdbc-field-map type="one-one"
    column.JDOID="OWNER_JDOID"/>
    </field>
    <field name="subString">
    <jdbc-field-map type="value" column="SUBSTRING0"/>
    </field>
    </class>
    <class name="HorizManyRelationSuper">
    <jdbc-class-map type="horizontal"/>
    </class>
    </package>
    </mapping>
    In article <[email protected]>, Alex Robbins wrote:
    Hi,
    I have a nasty niggling problem with a one-many mapping where the many
    side is a horizontally-mapped persistent subclass:
    kodo.util.FatalUserException: kodo.jdbc.meta.MappingInfoNotFoundException:
    The reference mappings for one-to-many field "Invoice.openTrades" are not
    in the table of the field's related persistent element
    type.[Invoice.openTrades [kodo.jdbc.meta.OneToManyFieldMapping]]
         at
    kodo.runtime.PersistenceManagerImpl.attach(PersistenceManagerImpl.java:4363)...
    NestedThrowablesStackTrace:
    kodo.jdbc.meta.MappingInfoNotFoundException: The reference mappings for
    one-to-many field "Invoice.openTrades" are not in the table of the field's
    related persistent element type.[Invoice.openTrades
    [kodo.jdbc.meta.OneToManyFieldMapping]]
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:134)
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:120)
         at
    kodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:94)
         at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:198)
         at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:470)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:991)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:971)
         at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.java:934)
         at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:654)
         at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java:796)
         at kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:431)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:349)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:177)
         at
    kodo.jdbc.meta.MappingRepository.getMetaData(MappingRepository.java:165)
         at
    kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:2423)
         at
    kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:2375)
         at kodo.runtime.AttachManager.makePersistent(AttachManager.java:410)
         at kodo.runtime.AttachManager.attach(AttachManager.java:279)
         at kodo.runtime.AttachManager.attach(AttachManager.java:56)
         at
    kodo.runtime.PersistenceManagerImpl.attach(PersistenceManagerImpl.java:4349)
    I have another one-many mapping on the "one" class which is fine and is
    almost identical to the invalid mapping - it joins on the same
    columns/foreign key. The only real difference is that my invalid "many"
    side is a horizontally mapped subclass (parent class mapped to different
    table). When I took that class out of its hierarchy and mapped it as base,
    it works. I don't know why Kodo is saying the mapping for the join is not
    found, as the "many" side has an invoice field mapped as one-one. The
    superclass does not have a relation to invoice mapped. A slight
    complication is that Invoice itself has a persistent superclass persisted
    in the same table, but nothing refers to that so I don't think it is
    relevant.
    Class diagram is roughly like this:
    BaseTrade
    |
    Invoice 1-* Trade
    BaseReceipt
    |
    Invoice 1-* Receipt
    Invoice mapped to Invoice table; Trade mapped to Trade table but its
    superclass mapped to diff BaseTrade table; Receipt and its superclass
    BaseReceipt mapped to Receipt table.
    I saw an earlier posting on the same exception that mentioned "collection
    element-type" - mine is specified as "Trade", ie the subclass.
    Is there any reason why this should not work?
    I can provide you with .jdo and .mapping files if necessary.
    Many thanks,
    Alex
    Marc Prud'hommeaux
    SolarMetric Inc.

  • How to copy field comments from logical model to relational one?

    Dear gurus!
    I had a logical model without field comments. Then I made an engineering of logical model into relational one. Later I added field comments to logical model. How can I copy these values to relational model? Seems to me that when I use
    model.getTableSet().toArray()
    then I get list of relational model tables. How can I get a list of logical "tables" and to get a relations between those two lists?
    Thank you!
    Edited by: user12947051 on 12.01.2012 23:58
    Edited by: user12947051 on 12.01.2012 23:58

    You don't need to write and run script for that. Just use engineering to relational model. Use compare/copy options tab if you don't want something else to go into relational model
    Philip

  • EJB relation One to Many - ClassCastException

    Hi !
    I created two CMP EJB entity Client and Address. There is a One to Many relation between them.
    When I deploy them on JBoss, I have no errors, and the correponding tables are created in the database. The EJB seems to work fine, but when I use a 'relation' method : myAddress.setClient(myClient) for instance. I get a ServerException.
    In the log of JBoss there is :
    ClassCastException : org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.SetInstanceValue(...)
    I think I have a problem in my descriptors or JBoss configuration.
    If u have an idea ...
    Thx

    sorry to whack a load of code in but i can't see where the problem is here is my ejb-jar.xml file:
    <ejb-jar>
         <enterprise-beans>
              <entity>
                   <description>This bean represents a copy item.</description>
                   <ejb-name>CopyEJB</ejb-name>
                   <home>com.RemoteCopyHome</home>
                   <remote>com.RemoteCopy</remote>
                   <local-home>com.LocalCopyHome</local-home>
                   <local>com.LocalCopy</local>
                   <ejb-class>com.CopyBean</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>Copy</abstract-schema-name>
                   <cmp-field>
                        <field-name>copyid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>quality</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>buyinprice</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>selloutprice</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>bookid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>title</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>genre</field-name>
                   </cmp-field>
                   <primkey-field>copyid</primkey-field>
                   <security-identity>
                        <description></description>
                        <use-caller-identity></use-caller-identity>
                   </security-identity>
              </entity>
              <entity>
                   <description>This bean represents a supplier.</description>
                   <ejb-name>SupplierEJB</ejb-name>
                   <home>com.RemoteSupplierHome</home>
                   <remote>com.RemoteSupplier</remote>
                   <local-home>com.LocalSupplierHome</local-home>
                   <local>com.LocalSupplier</local>
                   <ejb-class>com.SupplierBean</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>Supplier</abstract-schema-name>
                   <cmp-field>
                        <field-name>supplierid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>name</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>address1</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>address2</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>address3</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>address4</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>postcode</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>email</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>telno</field-name>
                   </cmp-field>
                   <primkey-field>supplierid</primkey-field>
                   <security-identity>
                        <description></description>
                        <use-caller-identity></use-caller-identity>
                   </security-identity>
              </entity>
              <entity>
                   <description>This bean represents an edition.</description>
                   <ejb-name>EditionEJB</ejb-name>
                   <home>com.RemoteEditionHome</home>
                   <remote>com.RemoteEdition</remote>
                   <local-home>com.LocalEditionHome</local-home>
                   <local>com.LocalEdition</local>
                   <ejb-class>com.EditionBean</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>Edition</abstract-schema-name>
                   <cmp-field>
                        <field-name>editionid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>isbn</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>publisher</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>binding</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>other</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>edition</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>printdate</field-name>
                   </cmp-field>
                   <primkey-field>editionid</primkey-field>
                   <security-identity>
                        <description></description>
                        <use-caller-identity></use-caller-identity>
                   </security-identity>
              </entity>
              <entity>
                   <description>This bean represents an author.</description>
                   <ejb-name>AuthorEJB</ejb-name>
                   <home>com.RemoteAuthorHome</home>
                   <remote>com.RemoteAuthor</remote>
                   <local-home>com.LocalAuthorHome</local-home>
                   <local>com.LocalAuthor</local>
                   <ejb-class>com.AuthorBean</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>Author</abstract-schema-name>
                   <cmp-field>
                        <field-name>authorid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>name</field-name>
                   </cmp-field>
                   <primkey-field>authorid</primkey-field>
                   <security-identity>
                        <description></description>
                        <use-caller-identity></use-caller-identity>
                   </security-identity>
              </entity>
              <session>
                   <description>Supplier Function Session Bean</description>
                   <display-name>SupplierFunctionEJB</display-name>
                   <ejb-name>SupplierFunctionEJB</ejb-name>
                   <home>com.SupplierFunctionHome</home>
                   <remote>com.SupplierFunctionRemote</remote>
                   <ejb-class>com.SupplierFunctionSBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
              </session>
              <session>
                   <description>Copy Function Session Bean</description>
                   <display-name>CopyFunctionEJB</display-name>
                   <ejb-name>CopyFunctionEJB</ejb-name>
                   <home>com.CopyFunctionHome</home>
                   <remote>com.CopyFunctionRemote</remote>
                   <ejb-class>com.CopyFunctionSBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
              </session>
         </enterprise-beans>
         <relationships>
              <ejb-relation>
                   <ejb-relation-name>Supplier-Copy</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>copy-recievedfrom-supplier</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <cascade-delete></cascade-delete>
                        <relationship-role-source>
                             <ejb-name>CopyEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>supplier</cmr-field-name>
                        </cmr-field>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>supplier-has-items</ejb-relationship-role-name>
                        <multiplicity>One</multiplicity>
                        <relationship-role-source>
                             <ejb-name>SupplierEJB</ejb-name>
                        </relationship-role-source>
                   </ejb-relationship-role>
              </ejb-relation>
              <ejb-relation>
                   <ejb-relation-name>Edition-Copy</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>edition-has-items</ejb-relationship-role-name>
                        <multiplicity>One</multiplicity>
                        <relationship-role-source>
                             <ejb-name>EditionEJB</ejb-name>
                        </relationship-role-source>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>copy-is-a-edition</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <cascade-delete></cascade-delete>
                        <relationship-role-source>
                             <ejb-name>CopyEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>edition</cmr-field-name>
                        </cmr-field>
                   </ejb-relationship-role>
              </ejb-relation>
              <!--<ejb-relation>
                   <ejb-relation-name>Author-Copy</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>copy-has-items</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>                                     
        <relationship-role-source>
                             <ejb-name>AuthorEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>copies</cmr-field-name>
                             <cmr-field-type>java.util.Set</cmr-field-type>
                        </cmr-field>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>copy-has-authors</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <cascade-delete></cascade-delete>
                        <relationship-role-source>
                             <ejb-name>CopyEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>authors</cmr-field-name>
                     <cmr-field-type>java.util.Set</cmr-field-type>     
                        </cmr-field>
                   </ejb-relationship-role>
              </ejb-relation>-->
         </relationships>
         <assembly-descriptor>
              <security-role>
                   <description>This role represents everyone who is allowed full access
             to the beans.</description>
                   <role-name>Subscribers</role-name>
              </security-role>
              <method-permission>
                   <role-name>Subscribers</role-name>
                   <method>
                        <ejb-name>CopyEJB</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>SupplierEJB</ejb-name>
                        <method-name>*</method-name>
                   </method>
              </method-permission>
              <container-transaction>
                   <method>
                        <ejb-name>CopyEJB</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>SupplierEJB</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>my session bean code can be found at
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=11&t=006578

  • Understanding objects relations one-to-many and many-to-many with flex4

    Hello, I'm a newbie on Flex 4.
    I read several examples and also the "one week training". What I couldn't find is how to manage relations among objects.
    I understood that objects coming from the server must be translated to value objects.
    Because I'm working with Spring, Hibernate and BlazeDS, I've several beans and relations defined with the annotations @OneToMany and @ManyToMany. These relations are managed using List, Set and Map objects.
    More precisaly, I've to create a flex datagrid, each row is an "author" objects. Cliccking a row, I need to load some other related objects (let's call them "documents").
    Auhtor and Documents objects are in a one-to-many relation.
    My questions are:
    1) Which is the correct way to handle related objects in Flex? This questions arise from the fact that there are two ways in order to manage such objects. The first is to load the parent object and them call related method in order to get child. For example author.getDocuments(). I get all the related objects (author+ all his documents) with just one call, the one to load the "author" object. BlazeDS doesn't support lazy loading.
    The second way, is to provide the parent ID to a method that loads the related objects. For example getDocuments(authorID). I need to make a query for each ID
    Obviously, the value objects we have to create with AS are different. In the first case, the author VO will have a ArrayCollection in order to manage documents.In the second case I'll not create this property.
    2) In Flex, which is the best way? is it possible to manage objects (documents) of objects (authors) with MXML?
    3) More in general, Flex experts people, what are used to do? Where I can find an example?
    Thank you
    Paolo

    Thank you Pablo.
    Regarding my question n.2, it is confused.
    Here what I meant:
    Let's suppose I work with VO and ArrayCollection (the first "way" I wrote above). To get "Documents" objects, I need to call author.getDocuments().
    Now, I'm not sure that I'm able to do the same with MXML and that is is the easiest way. I think it should be easier working with "Documents" object instead of Auhors in order to work with Documents.
    For example, in order to get autors I can write a CallResponder and use a token. To fill a datagrid I define a method like
    protected function dataGrid_creationCompleteHandler(event:Flex:Event):void
         getAuthorsResult.token = auhtorService.getAuthors();}
    Now in order to fill the grid, I can use  for example <mx:DataGridColumn dataField="lastname">. Very easy and clear.
    But now, if I need to extract the Document objects and visualize them inside anothee DataGrid, I don't know how to do.
    For example, in <mx:DataGridColumn> tag what I've to write in order to visualize a Document property, using an Author object?
    Fixing an Auhtor, I need to loop over each Documents, but how can I loop inside the MXML? Something like <mx:DataGridColum dataField="author.documentloopvariable....>
    It should be better to get Documents via a method like getDocuments(authorID). Now I get a token related to a CallResponder, and I can work at the same manner as the Author. Isn't it? But this is the second "way" I wrote above.
    Well, I hope my question in a little clear.
    thank you
    Pbesi

  • Mapping one-many cmp relation without association table

    Hello:
    I want to know if I can map a relationship with this model:
    Table department
    -deptPK (PK)
    -deptNo (constraint unique)
    -deptoDescription
    Table employee
    -empPK (PK)
    -empName
    -deptNo (FK)
    My problem is that i can't establish the relation employee-department because the FK in employee is not the PK of department.
    Thanks
    Miguel

    The first thought that comes to mind is a problem with your primary key for class B. If two instances have the same primary key (or at least what you told TopLink constitutes the primary key) you may lose one of the objects or perhaps have the same object in the list twice.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Three tier one-many issue

    I'm having difficulty with a one to many relationship in a three tier model.
    I am reading an object at the service layer and following an indirection to pull back a list of owned objects through a one to many, then passign it back to my web tier.
    To save the object I pass it back to my service layer, instantiate a uow, do uow.readObject(rmiCopy), then uow.deepMerge(rmiCopy), and commit.
    This always works if I insert or delete or even edit the related objects. But if I update a one-to-one relationship within the child object I get the exception below.
    I've left in the SQL because I don't understand why it is generated and think it may be part of the problem. Note that it is selecting crystal_id and is using crystal_id in the where clause as well. I suppose this suggests an error in my mapping but for the life of me I can't find it.
    Thanks,
    Mike
    5492,5,main]--#executeQuery(ReadObjectQuery(com.sgx.domain.cti.CryoContents))
    2004.06.11 09:51:45.441--ServerSession(19512411)--Thread[HttpRequestHandler-2680
    5492,5,main]--Connection(24797434)--SELECT t1.CRYSTAL_ID, t1.AMOUNT, t1.UOM, t1.
    SUBSTANCE_ID, t0.PH, t0.SMILE_STRING, t0.COMMENTS, t0.SOLUBILITY, t0.GRAMS_PER_5
    0ML, t0.SUBSTANCE_ID, t0.LIQUID_CLASS, t0.SUBSTANCE_NAME, t0.CAS, t0.SUBSTANCE_T
    YPE, t0.IS_CRYO, t0.TUBE_NUMBER, t0.CONCENTRATION, t0.UOM, t0.MOLECULAR_WEIGHT,
    t0.VENDOR FROM SGX.SUBSTANCES t0, SGX.CRYO_CONTENTS t1 WHERE (((t1.CRYSTAL_ID =
    ?) AND (t1.SUBSTANCE_ID = ?)) AND (t0.SUBSTANCE_ID = t1.SUBSTANCE_ID))
    bind => [3878, 134]
    2004.06.11 09:51:45.441--ServerSession(19512411)--Thread[HttpRequestHandler-2680
    5492,5,main]--#reconnecting to external connection pool
    2004.06.11 09:51:45.441--UnitOfWork(25134304)--Thread[HttpRequestHandler-2680549
    2,5,main]--#executeQuery(DoesExistQuery())
    2004.06.11 09:51:45.441--ClientSession(15515681)--Thread[HttpRequestHandler-2680
    5492,5,main]--#executeQuery(DoesExistQuery())
    2004.06.11 09:51:45.441--ServerSession(19512411)--Thread[HttpRequestHandler-2680
    5492,5,main]--Connection(25154336)--SELECT CRYSTAL_ID FROM SGX.CRYO_CONTENTS WHE
    RE ((CRYSTAL_ID = ?) AND (SUBSTANCE_ID = ?))
    bind => [3878, 134]
    2004.06.11 09:51:45.441--ServerSession(19512411)--Thread[HttpRequestHandler-2680
    5492,5,main]--#reconnecting to external connection pool
    2004.06.11 09:51:45.504--UnitOfWork(25134304)--Thread[HttpRequestHandler-2680549
    2,5,main]--#register(com.sgx.domain.cti.Substance@5a77b6)
    2004.06.11 09:51:45.519--UnitOfWork(25134304)--Thread[HttpRequestHandler-2680549
    2,5,main]--java.lang.NullPointerExceptionjava.lang.NullPointerException
    at oracle.toplink.internal.indirection.QueryBasedValueHolder.instantiate
    (Unknown Source)
    at oracle.toplink.internal.indirection.DatabaseValueHolder.getValue(Unkn
    own Source)
    at oracle.toplink.internal.indirection.BasicIndirectionPolicy.cloneAttri
    bute(Unknown Source)
    at oracle.toplink.mappings.ForeignReferenceMapping.buildClone(Unknown So
    urce)
    at oracle.toplink.internal.descriptors.ObjectBuilder.populateAttributesF
    orClone(Unknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.cloneAndRegisterNewObject(U
    nknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.internalRegisterObject(Unkn
    own Source)
    at oracle.toplink.internal.sessions.MergeManager.registerObjectForMergeC
    loneIntoWorkingCopy(Unknown Source)
    at oracle.toplink.internal.sessions.MergeManager.mergeChangesOfCloneInto
    WorkingCopy(Unknown Source)
    at oracle.toplink.internal.sessions.MergeManager.mergeChanges(Unknown So
    urce)
    at oracle.toplink.mappings.CollectionMapping.mergeIntoObject(Unknown Sou
    rce)
    at oracle.toplink.internal.descriptors.ObjectBuilder.mergeIntoObject(Unk
    nown Source)
    at oracle.toplink.internal.sessions.MergeManager.mergeChangesOfCloneInto
    WorkingCopy(Unknown Source)
    at oracle.toplink.internal.sessions.MergeManager.mergeChanges(Unknown So
    urce)
    at oracle.toplink.publicinterface.UnitOfWork.mergeClone(Unknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.deepMergeClone(Unknown Sour
    ce)
    at com.sgx.serviceLayer.cti.impl.CrystalsBean.saveCrystal(CrystalsBean.j
    ava:146)

    Okay, I wonder if someone could just explain the limitations of working with objects in a three-tier application.
    How extensively can I safely modify an object in the web tier and still have it merge successfully when I return a copy to the serviceLayer?
    Is it just that I have to be careful not to follow indirections or is there more to watch out for?
    Mike

  • Wake up, wait, and kill one / many threads

    Hello all.
    I am trying to do something that I originally wanted to do with multicasting, but in the end could not.
    Essentially I want to create a bunch of threads, one for each machine I want to 'ping' (not the actual ping, just some kind of 'are you alive?'). These threads will just sit there and wait upon creation.
    Then when a request comes in I want to:
    1. wake them all up so they all send a 'ping' to their respective server.
    2. retrieve the ip address (or name) of the first thread that replies
    3. kill the rest of the threads (if they haven't already died)
    4. go back to waiting
    I've been surfing Google, Java tutorial and these forums and can't seem to put it all together.
    Many thanks for any help!
    Bob

    Hello again, thanks for all of the responses.
    I feel like a bit of a schmuck, I had no idea J2SE 5.0 had all of this new concurrency stuff. All of these things -- Semaphores, CountDownLatch, etc. -- are new to me. I've been trapped in the web / MVC world too long. I've used threads in the past but only for simple stuff, always trying to avoid all the messy stuff like synchronized blocks, wait(), notify(), etc.
    So I am boning up on all this new stuff now, thanks.
    As for you comment, 'I don't see the point in terminating them if you are going to repeat the exercise.', you're right, I didn't mean kill the threads that didn't reply first, I meant ignore them.
    Basically I have a situation where I'll have something like 60 requests per minute on average. For each request I want to wake up all the threads, send out a ping and send the request to the ip address of the first thread that replies.
    The problem of course is that during that one request I may have another, and another, since a ping could take anywhere from less than a second to 5 seconds to timeout. So, for example, If another request comes in while 3 out of the total of 5 threads are still pinging, only 2 will be woken up to send out another ping, and so on.
    It's complicated and it would be a lot easier with a simple multicast message using JGroups or a simple Java multicasting. But alas since these servers that I'll be pinging aren't ours, I can neither install a small multicast listener program on them or even be sure multicasting (port 124.0.0.1) is enabled.
    So that's the deal. I'm going to keep reading. Thanks for all of your help!
    Bob

  • Duplication of Amounts in report based on One-many joins

    Sorry for the long description but I think it's better to be explicit. This is a very generic problem though with the design of BO. We have BO /Webi 6.5. I support a reporting system delivered by a third party, and need to fix issues with the reports. I am free to customise the views, the Universe and the reports. The most frequent problem I am faced with, is that of duplication of figures in report columns derived from 'measure' objects.    For eg:
    A report needs to display Fixed Asset Capital Cost and Depreciation over period from-to. In a simplified form, the views and universe design are as following:
    Two tables(views):
    1. Fixed Asset:
    Asset Number,
    Asset Description,
    Acquisition Date,
    Retire Date,
    Capital Cost ($)
    The capital cost (acqusition cost) does not change
    2. Fixed Asset Depreciation:
    Asset Number,
    Period Number,
    Period Depreciation ($)
    The Period Depreciation is a value that is deducted from the asset's capital value, month after month, until the asset is fully depreciated.
    The two tables join on Asset Number. There is a 1 to N cardinality from table 1 to table 2, as well as outer join because not all Fixed Assets will have depreciation recorded.
    As assets come and go, when the report is run for period from/to, not all assets have depreciation records for each period in range.
    Report prompts are: Period Number From  & Period Number To.
    The report needs to display Grand Totals for:
    Total Capital Costs from all assets that were on books in period from/to
    Total depreciation period from/to
    Simplified Report Format:
    Reporting period From/To
    Asset Number | Description               | Capital Cost  | Depreciation
    nnnnnnnnnn  |   xxxxxxx                  |   99999999   |  99999999
    ========================================================
    Grand Totals: Count Asset: 99999    |   99999999   |  99999999
    Universe Objects for Capital Cost and Period Depreciation are defined as Measures.
    I have defined a second object in the Universe for Capital Cost as a Dimension, [Capital Cost dim],  which allows to report correct Capital Cost value against the fixed asset item in the detail row of the deport. 
    In the report Grand Total I need to display sum([Capital Cost dim]). The problem I have is that this Grand Total includes duplication of amounts for Capital Cost, when reported for Perid From <> Period To, and where more than one period depreciation is recorded for the asset.
    I realise the reason for the problem is in the joining of the two tables as a 1-N and so the Capital Cost is duplicated. I was not able to find a work around. In other reporting tools I could solve the problem in the report design, by naming the break variable used to report Capital Cost against the asset, and then summing up from that variable to obtain the Grand Total. In BO & Webi this does not seem to be available, the variable definitions for sum([object]) are global and appear to work the same on all breaking levels up to grand total.
    Your help is much appreciated.
    Edited by: Calator on Jun 2, 2010 8:18 AM

    Two ways to over come this situation,
    1. Create two data providers. One for the Depreciation and the second on for Fixed cost.
    In the report merge asset Number and have the measure objects do the magic for you.
    2. Kind of complex, but worth trying. This works in the table column, Try and see if it works in the footer of the table
    Create a varible for the table column.
    Asset# count=Count([(Merged)Asset Number])
    Actual value=Sum(If([Asset# count]>1; ([Fixed Cost]/[Asset# count]);[Fixed Cost]))-Sum([Depreciation])

  • Comman separated output for a one-many relationship

    I have 2 tables with one2many relation, viz product, subproduct, I wnat to output in the following way
    i.e product and list of subproducts separated by commas
    product1- sp1,sp2
    product2- sp11,sp12
    What would be the best way to handle this ?
    The productis is the common key for the 2 tables.
    Thanks In Advance.

    This should do it.
    SELECT PROD,
              MAX(SUBSTR (SYS_CONNECT_BY_PATH (SUB_PROD, '->'), 3)) AS SUBS
    FROM (SELECT PROD,
         SUB_PROD,
         ROW_NUMBER() OVER
                        (PARTITION BY PROD ORDER BY LEG) CURR,
                        ROW_NUMBER() OVER
                        (PARTITION BY PROD ORDER BY LEG) - 1 AS PREV
         FROM (SELECT P.PROD,
                        S.SUB_PROD,
                                  ROW_NUMBER() OVER
                                  (PARTITION BY P.PROD ORDER BY P.PROD ASC) LEG
                             FROM PRODUCT P,
                             SUB_PRODUCT S
                        WHERE P.PROD = S.PROD
    START WITH CURR = 1
    CONNECT BY PRIOR CURR = PREV
    AND PRIOR PROD = PROD
    GROUP BY PROD

  • Create one-Many orders in a single forms?

    Hi all,
    I would like to create a form which is a master and details by using struts.
    Customer ID:
    ID Qty Price
    xxx 12 12
    bbb 11 10
    The user would like to enter the customer id, then s/he input the details
    How can I do on the jsp and actionForm? What is the actionForm includes?
    Would you mind give some sample code for me?
    Many Many Thanks.

    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)
    /

  • One-many-many relationship

    hi
    i am create [b]master-details-details(1-M-M relationship) forms in D2K
    block are
    department -master block
    dept_id primary key
    dept_name
    sec(section)-details block
    sec_id primary key
    sec_name
    dept_id foreign key
    emp_det -details block
    emp_id primary key
    emp_name
    sec_id foreign key
    dept_id foreign key
    now i want to create 1-M-M relationship between those block
    so please help me
    thanks

    in the block property of section block set the where clause
    as dept_id=:department.dept_id
    and in emp_det block
    set the where clause as
    dept_id=:department.dept_id
    and sec_id=:section.sec_id

Maybe you are looking for

  • Sequence ID search in archived messages

    Hi All, I was looking to see if the sequence ID search will work on archived messages? I don't see any technical attributes section for extended search in archived messages tab in message monitoring of PO 7.4 SP6. Any idea? thx mike

  • How to create read only properties in a component?

    I want to set a property in a nucleus component of global scope as read only, so that it cannot be set via dyn admin. I want this property to be set only via properties file at server startup. I tried removing the setter method as suggessted in the g

  • How to show module and SFP information include hardware serial number on Nexus switch?

       How to show module and SFP information include hardware serial number on Nexus switch?                 Thanks.

  • Portal upgrade

    Guys, We have a windows NW04 Portal landscape and are planning to upgrade it. In order to build a sandbox landscape which we shall be used to run a test upgrade, we took a image of the development portal backend, frontend, ITS server and R/3. Once th

  • After Effects CS4 | How to set multiple out destinations at once

    I know that if you have multiple items in the render queue you can control-click on the Output Module and set all of the selected items to the same Output Module.  I am wondering if there is a way to set the render destination (Output To) of multiple