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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

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

  • Association Table Mappings

    Is there any way to use one-to-many mappings via an association table?
    More thoroughly, I have a table of groups, a table of users and an association table matching groups and users. I have foreign keys mapping between the association table and each of the group and user tables.
    Beyond the fact that I'm not sure how to make toplink realize that a value in the association table is either a group or a user, I also have inheritance between a generic "authorized party" class and both the group and user classes.
    The setup is complex to allow for users to be in multiple groups and to simplify the mapping between groups, users and permissions that they might have (via a similar association table, but one solution ought to be good enough for both problems).

    You were right about the many-to-many relationship, or at least it appears to have worked. I haven't been able to test it yet because of some difficulties with inheritance. Is it possible to use an abstract class as the root of an inheritance tree? I am currently getting the following errors when I try to run at test case against my project.
    ==================
    Exception [TOPLINK-108] (Oracle9iAS TopLink - Release 2 (9.0.4.0) (Build 030612)): oracle.toplink.exceptions.DescriptorException
    Exception Description: Cannot find value in class indicator mapping in parent descriptor [null].
    Descriptor: Descriptor(edu.cornell.finsys.datamodel.appmgmt.AuthorizedParty --> [DatabaseTable(APPMGMT.APPMGMT_AUTH_PARTIES), DatabaseTable(APPMGMT.APPMGMT_GROUPS), DatabaseTable(APPMGMT.APPMGMT_USERS)])
    Exception [TOPLINK-41] (Oracle9iAS TopLink - Release 2 (9.0.4.0) (Build 030612)): oracle.toplink.exceptions.DescriptorException
    Exception Description: A non-read-only mapping must be defined for the sequence number field.
    Descriptor: Descriptor(edu.cornell.finsys.datamodel.appmgmt.Group --> [DatabaseTable(APPMGMT.APPMGMT_AUTH_PARTIES), DatabaseTable(APPMGMT.APPMGMT_GROUPS), DatabaseTable(APPMGMT.APPMGMT_USERS)])
    Exception [TOPLINK-41] (Oracle9iAS TopLink - Release 2 (9.0.4.0) (Build 030612)): oracle.toplink.exceptions.DescriptorException
    Exception Description: A non-read-only mapping must be defined for the sequence number field.
    Descriptor: Descriptor(edu.cornell.finsys.datamodel.appmgmt.AuthorizedParty --> [DatabaseTable(APPMGMT.APPMGMT_AUTH_PARTIES), DatabaseTable(APPMGMT.APPMGMT_GROUPS), DatabaseTable(APPMGMT.APPMGMT_USERS)])
    ==================
    The AuthorizedParty class is abstract and it is the root of the tree. The user and group classes are the only two leaves of the tree. What I'm guessing is that Toplink is complaining that I have not provided a type mapping to indicate the root class, but I don't want there to be a type for it as it is abstract and should never be instantiated anyway. The last two errors make no sense to me as there is a writeable field for authorized party's sequence number and I would think that the user class should use the authorized party's sequence number. The other point of confusion is that the other leaf (the group class) does not appear to be exhibiting the same problem as the user class.
    Any ideas? Thanks in advance.

  • Use of Association Tables in Place of FK's  --  O/R Mapping

    We are currently in the process of redesigning one of our systems following an OO model to be implemented in Java. Our current Oracle database is 8.1.7. We care coding sql in JDBC directly without the use of mapping tools. My role in the project is a jr. schema dba.
    The oo designer on our team objects to holding foreign key attributes in the Java classes when (form the object model's perspective) they aren't need (i.e. using collections will indicate parent-child relationships).
    To get around the "foreign key problem" the oo designer is pushing for the use of "association tables" in the database to replace foreign key relationships. The designer and other members of the team (the sr. schema dba) cite literature on O/R mapping which suggests that this technique is a valid and viable approach.
    So as a simple example...
    DEP EMP
    =======          =======     
    # dep_no     # emp_no
    dep_name     dep_no
              emp_name
    Becomes...
    DEP EMP          A_DEP_EMP
    =======          =======     =========
    # dep_no     # emp_no     # dep_no
    dep_name     emp_name     # emp_no
    Where A_DEP_EMP is the association table showing the relationship between department and employee.
    To me it seems like we are making poor and unnecessary database design decisions to support the object model. My objections to this association table approach is that we are failing to use the inherent strengths of the a relational database:
    1) Both the dep and emp must exist before the association is built (assuming the association has FK's to the DEP and EMP tables) -- and yes I'm aware delaying the enforcement of FKs until commit time is an option
    2) The model does not protect against inserting orphaned emps into the EMP table (assuming we'd want to protect against this)
    3) The association table indicates a N:M cardinality. Assuming the design calls for a 1:M cardinality a UK on the emp_no column in the association table would be required. When I brought this up, the sr. schema dba raised concerns about the overhead of the UK and suggested that the application would be responsible for enforcing the cardinality requirements.
    The alternative that seems more appealing is managing the FK details in a persistence layer of the Java classes (currently the notion of separate view and entity objects is absent in our design -- the database interface is directly in each low-level java class).
    If i am correct in my understanding of Oracle's implementation of BC4J the foreign keys are handled in the persistence layer (view object) with out the need for actively maintaining them in the entity Object. Other O/R mapping models also seem to suggest that this is the way to go (e.g. Martin Fowler's recommendations http://www.martinfowler.com/isa/).
    So my question for the community at large:
    - Which approach would you use?
    - Has anyone been working with association tables in place of foreign keys? If so what are your experiences?
    - am i off-base with my objections?
    any feedback / comments much appreciated

    Martin,
    I have seen these kind of discussions over and over again and now you happen to be right in the middle of one. Without going into technical details some statements that might help:
    1) object model designers and relational model designers will NEVER 'agree' since the techniques used are, by nature, too different (they solve different problems, which is fine, but when you start to talk about them they give problems)
    2) my experience is that they do not have to 'agree', as long as they can 'work alongside eachother'. You are not there to tell the object designers how to do their work the same way they are not there to tell you how to do your job.
    3) as a senior DBA, I regard it my primary task to enforce regulations that will make the data stored as meaningfull and correct as possible. If I'm following relational principles to do so, I will use all of them where I find them applicable regardless how that data is used later on. Any suggestion by any person that undermines this principle will not get implemented. Exceptions (<0.1%) not taken into account. Also, there is a 'political correct' way of telling this and a 'bold' way.
    4) choose the 'political correct' one since it will save you a lot of stress :)
    5) if you violate rule 3, and shit happens, you will be held accountable (and rightfully so).
    6) if you have a more senior person telling you what to do, do it, but state your concerns very clearly in an email and save that mail + reply somewhere safe for future discussions. Refer to this if shit happens and you are, unrightfully so, held accountable.
    7) as a DBA, never trust application logic to enforce data integrity. It is your job, not the application developer's and you have the facilities to do so much easier than the app dev. Application developers don't have a primary task of testing data integrity, if it looks ok on the screen they pass their tests. you on the other hand perform special tests they don't. This is your additional value to the project.
    8) in oracle 8i and above I found the use of views and 'in stead of'-triggers very usefull for mimicing objects. Object designers/developers think they get simple tables they can map objects to and underneatch you yourself check everything is ok. The disadvantage of this is that you need to do some extra work not easily accounted for and might run into some performance issues, but that is your challange as you want to become a senior DBA ;). The advantage is that the discussion is over :) and reporting and other, none object applications can interface more easily (which might be an actual design decisive argument, I've used it successfully multiple times).
    9) try to stay away from discussions of how things are done best between the two methods and why one method 'is better' than the other. Try to find a workable solution that will violate the least of the two designing principles and implement that.
    A lot is dependent on your project and it might be that in your case these senior people are quite right in their suggestions, but I've found that the above 'rules' work most of the time for me. I hope they at least give you something to think about. From what I read from your post, it sounds like you know the technical pros and cons but you have a tough time communicating to your peers. Perhaps these rules help a bit.
    Success,
    Lennert
    We are currently in the process of redesigning one of our systems following an OO model to be implemented in Java. Our current Oracle database is 8.1.7. We care coding sql in JDBC directly without the use of mapping tools. My role in the project is a jr. schema dba.
    The oo designer on our team objects to holding foreign key attributes in the Java classes when (form the object model's perspective) they aren't need (i.e. using collections will indicate parent-child relationships).
    To get around the "foreign key problem" the oo designer is pushing for the use of "association tables" in the database to replace foreign key relationships. The designer and other members of the team (the sr. schema dba) cite literature on O/R mapping which suggests that this technique is a valid and viable approach.
    So as a simple example...
    DEP EMP
    =======          =======     
    # dep_no     # emp_no
    dep_name     dep_no
              emp_name
    Becomes...
    DEP EMP          A_DEP_EMP
    =======          =======     =========
    # dep_no     # emp_no     # dep_no
    dep_name     emp_name     # emp_no
    Where A_DEP_EMP is the association table showing the relationship between department and employee.
    To me it seems like we are making poor and unnecessary database design decisions to support the object model. My objections to this association table approach is that we are failing to use the inherent strengths of the a relational database:
    1) Both the dep and emp must exist before the association is built (assuming the association has FK's to the DEP and EMP tables) -- and yes I'm aware delaying the enforcement of FKs until commit time is an option
    2) The model does not protect against inserting orphaned emps into the EMP table (assuming we'd want to protect against this)
    3) The association table indicates a N:M cardinality. Assuming the design calls for a 1:M cardinality a UK on the emp_no column in the association table would be required. When I brought this up, the sr. schema dba raised concerns about the overhead of the UK and suggested that the application would be responsible for enforcing the cardinality requirements.
    The alternative that seems more appealing is managing the FK details in a persistence layer of the Java classes (currently the notion of separate view and entity objects is absent in our design -- the database interface is directly in each low-level java class).
    If i am correct in my understanding of Oracle's implementation of BC4J the foreign keys are handled in the persistence layer (view object) with out the need for actively maintaining them in the entity Object. Other O/R mapping models also seem to suggest that this is the way to go (e.g. Martin Fowler's recommendations http://www.martinfowler.com/isa/).
    So my question for the community at large:
    - Which approach would you use?
    - Has anyone been working with association tables in place of foreign keys? If so what are your experiences?
    - am i off-base with my objections?
    any feedback / comments much appreciated

  • 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

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

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

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

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

  • Embedded mapping (one table - two classes)

    I any using ebedded fileds (one table but two related classes like company-adress example in Developer Guide):
    <class name="StyleCoreImpl" detachable="true">
                   <field name="createdBy">
                        <embedded null-indicator-column="CREATEDBY_USER">
    <field name="date" column="CREATEDBY_DATE"/>
                        </embedded>
                   </field>
         </class>
    <class name="MadeByStatusImpl" detachable="true">
         <field name="date"/>
         <field name="user"/>
    </class>
    but get at runtime an error "No table was given for persistent type":
    <4|true|4.0.0> kodo.util.MetaDataException: No table was given for persistent type "com.ottogroup.buying.b2b.assortmentprep.domain.object.style.impl.MadeByStatusImpl".
         at kodo.jdbc.meta.MappingInfo.createTable(MappingInfo.java:479)
         at kodo.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.java:215)
         at kodo.jdbc.meta.strats.FullClassStrategy.map(FullClassStrategy.java:52)
         at kodo.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:349)
    Question:
    How should we map an embedded class which does not have any table in DB ?
    thanks
    Andre Teshler

    Hi Abe, we have following problem with proposed solution:
    Two embedded instances of the same type pointing to the sametarget
    · Problem
    We have an entity that holds date and user of creation and date and user of last change. The
    information is encapsulated in a state object which is mapped as an embedded object. The table
    holds both dates and the ids of the user. The user information is held in a separate user table. If
    we load the entity, the entity table is only joined once against the user table, even if the user ids for
    create and lastchange are different. In consequence, the user objects of the created and
    lastchange state are always the same.
    Question:
    Why is the fact that t0.createdby_user may differ from t0.lasteditedby_user ignored
    and t0 not joined twice against dbldapusermapping?
    Entities:
    public class MadeByStatusImpl {
    private UserImpl user = null;
    private Date date;
    /* getter and setter */
    public final class UserImpl {
    private long id;
    private String givenName = null;
    private String surname = null;
    /* getter and setter */
    public class StyleApprovalCheckImpl {
    private long id;
    private MadeByStatusImpl created = null;
    private MadeByStatusImpl lastChanged = null;
    private String comment = null;
    /* getter and setter */
    Mapping:
    <class name="MadeByStatusImpl" embedded-only="true">
    <field name="date"/>
    <field name="user"/>
    </class>
    <class name="UserImpl" table="DBLDAPUSERMAPPING" identitytype="
    application" detachable="true">
    <field name="id" primary-key="true" column="LDAPUSERMAPPINGID"/>
    <field name="givenName" column="GIVENNAME"/>
    <field name="surname" column="SURNAME"/>
    </class>
    <class name="StyleApprovalCheckImpl" table="DBSMAPPROVALCHECKENTRY"
    identity-type="application" detachable="true">
    <inheritance>
    <discriminator strategy="final"/>
    </inheritance>
    <field name="id" primary-key="true" sequence="Seq" column="ID"/>
    <field name="comment" column="APPROVALCOMMENT"/>
    <field name="created" default-fetch-group="true">
    <embedded>
    <field name="date" column="CREATEDBY_DATE"/>
    <field name="user" default-fetch-group="true"
    column="CREATEDBY_USER">
    <foreign-key/>
    </field>
    </embedded>
    </field>
    <field name="lastChanged" default-fetch-group="true">
    <embedded>
    <field name="date" column="LASTEDITEDBY_DATE"/>
    <field name="user" default-fetch-group="true"
    column="LASTEDITEDBY_USER">
    <foreign-key/>
    </field>
    </embedded>
    </field>
    </class>
    SQL:
    SELECT t0.smapprovalcheckentryid, t0.approvalcomment,
    t0.createdby_date, t1.ldapusermappingid, t1.givenname,
    t1.surname, t1.ldapuid, t0.lasteditedby_date
    FROM dbsmapprovalcheckentry t0,
    dbldapusermapping t1
    WHERE (t0.smstylesupplierid = 1)
    AND t0.createdby_user = t1.ldapusermappingid(+)
    thanks
    Andre Teshler

  • Mapping CMP EJBs to existing tables

    Did I miss something or is there really no way to map container managed EJBs to existing tables?
    As you seemingly only can map fields of an entity bean to tables done in a dictionary project I can't think of a way to do it unless there is a way to trick dictionary projects to resemble existing tables instead of tables managed by the dictionary.
    This really prevents porting many existing apps to NW04 the 'easy way'.

    Hi,
    it is possible to create the persistent.xml without existing dictionary project, i.e. to specify OR Mapping to existing DB schema without having dictionary project defined for it. The SAP Netweaver IDE will report a warning as its validations will fail, but this will not break the build.
    Of course it is possible to create a fake dictionary project and omit its deployment as you think this will save time.
    Detailed information about the perisstent.xml structure can be found in the IDE help (or at help.sap.com)
    Developing Enterprise Beans  -> Enterprise Bean Structure -> persistent.dtd
    Regards,
    Svetoslav
    Message was edited by: Svetoslav Manolov

  • One-to-Many implemented with a join Table

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

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

  • Many Portal users mapping one R/3 user and query their own data ?

    Hi everyone :
      I want to discuss a issue as follow with all :
      Precondition : The SSO had done between Portal and R/3.
      Issue : Many Portal user(vendor) mapping one R/3 user(pulic vendor user),when they logon Portal, they can query the report, but the data was for the vendor logon now !
      Any discuss is welcome!
      Best Regards,
      Jianguo Chen

    Hi everyone :
      I want to discuss a issue as follow with all :
      Precondition : The SSO had done between Portal and R/3.
      Issue : Many Portal user(vendor) mapping one R/3 user(pulic vendor user),when they logon Portal, they can query the report, but the data was for the vendor logon now !
      Any discuss is welcome!
      Best Regards,
      Jianguo Chen

  • Mapping XSD to a relational table

    Hi
    I jdeveloper how do i go about mapping a XSD file to a relational table ?
    I know some tools like xml spy ca do these can jdeveloper do this ?
    regards

    When using the DATAEXPORT command to export data for direct insertion into a relational database:
    ● The table to which the data is to be written must exist prior to data export
    ● Table and column names cannot contain spaces
    Check with the below syntax.
    SET DATAEXPORTOPTIONS
    DATAEXPORTDECIMAL 1;
    DataExportLevel "LEVEL0";
    DATAEXPORTCOLHEADER "Periods";
    FIX("FY2011","Budget","Version1",FixedAssets,"Amount","622185","3011","BU_None" ,@LEVMBRS(Periods,0) AND @DESCENDANTS(Annual,0),@LEVMBRS(Currencies,0));
    DATAEXPORT "DSN" "bfp" "ClaritydataCS.dbo.BEAM_Output_Budget" "bfpcssql" "pBaUsDsGwEoTrd123";
    ENDFIX;

  • Message mapping: one as many, function node

    hi
    how to use - one as many - function node in mapping. i want to mapping one value from source structure to many fields in target structure. but i dont know the exact functionality of - one as many -
    kindly solve my issue
    regards
    mano

    Hi,
    Check out this example from SAP, which demos the use of the function oneAsMany:
    [http://help.sap.com/saphelp_nw04/helpdata/en/38/85b142fa26c811e10000000a1550b0/frameset.htm]
    Hope this helps,
    Sumant.

  • Mapping one node to many nodes

    How do you map one node in a controller context to many other nodes in another controller context?
    Here's the situation I'd be using this.
    I have an Adaptive RFC model from which I created a Custom Controller. I then used the wizard to map to the model.
    The model corresponds to RFC functions and many of those functions accept the same parameters, LanID for instance. I simply want to have one "LanID" node in a controller that I would set. The change would then propagate to the other LanID context nodes in the Custom Controller mapped to the model.
    What's the best way to handle this?

    If I understand correctly.. B1, B2 and B3 are all in the SAME custom controller?  Even if they are, I don't see a problem of mapping them all to A1 which is in another controller. Let's say that A1 is the "original" node, and B1, B2 and B3 are the "mapped" nodes.
    If you require that B1, B2 and B3 are "original" nodes, and A1 is the "mapped" node, then this is scenario is impossible.
    If you can be more specific, I will try to answer your question better.
    Walter

Maybe you are looking for

  • In PS CS6 While I'm adjusting the shape style, the path outline always appears??

    It does trouble me especially during setting "drop shadow", "inner glow" and "stroke". In previous version, if this problem came up, I can solve it by  clicking another layer and then double-clicking the original layer to pop up the style setting. Bu

  • IMac 10.5.8 Crashes upon sleep

    Frequently, when my computer either goes to sleep as scheduled, or when I put it to sleep via the Apple pull-down menu, the screen goes black but the mouse light & fans stay on, and the computer will not respond.  The computer has to be shutdown and

  • Problema extraño con Mac mini 2011

    Hace 6 meses aproximadamente, compre mi mac mini, a los 2 dias de tenerla empeze a notar los defectos que aparecen en la imagen de muestra, cuadros de colores, las sobras de las ventanas con lineas negras, se ponia muy lenta al trabajar incluso al us

  • Output levels

    I've had a hub fitted in my car so I can connect my ipod as well as have the radio and CD. The ipod connects via the main socket at the bottom rather than the headphone jack. This works fine except that the output level of the ipod is so much lower t

  • Data Source for Oracle reports

    Hi, Can Oracle Reports support anyother data source. I am using Reports Server to invoke reports. The requirement is client passing the dat that have to come in the report. (The size of data can be high).So is there any method other than sending the