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.

Similar Messages

  • 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

  • Associated table type of the Table parameters in function module

    Hi,
    If I want to select all the associated table types of the Table parameters used in a given function module in a report, how can that be done ?
    Thanks.
    Regards,
    Rajesh

    Try this.
    report zrich_0001 .
    data: import type table of rsimp with header line,
          change type table of rscha with header line,
          export type table of rsexp with header line,
          tables type table of rstbl with header line,
          except type table of rsexc with header line,
          docume type table of rsfdo with header line,
          source type table of rssource with header line.
    parameters: p_func type rs38l-name.
    call function 'RPY_FUNCTIONMODULE_READ'
      exporting
        functionname             = p_func
      tables
        import_parameter         = import
        changing_parameter       = change
        export_parameter         = export
        tables_parameter         = tables
        exception_list           = except
        documentation            = docume
        source                   = source
    exceptions
       error_message            = 1
       function_not_found       = 2
       invalid_name             = 3
       others                   = 4.
    loop at tables.
      write:/ tables-parameter,
              tables-dbstruct,
              tables-types,
              tables-optional,
              tables-typ,
              tables-class,
              tables-ref_class,
              tables-line_of,
              tables-table_of.
    endloop.
    Regards,
    Rich Heilman

  • 802.1x partial authentication and Association Table Overflows

    We're rolling out 5508's/3600's/ISE's/MSE's, using existing NCS's. using dot1x (machine certs EAP/TLS MS laptops) on one SSID, 2 x other SSID's have open auth.
    MSE is flagging Association Table Overflows on loads of WAPS, reseller TAC case tells me its .1x and misconfigured clients
    half authing causing this (not uncommon problem apparently), however my desktop support colleagues ideally need at least a mac
    address to identify a misconfigured device (if not more)
    Been debugging dot1x on the 5508's and looking at MSE/WAP forensic wireshark files created on the Association Table overflow rule, but nothing leaps out immediately for the offending devices
    What would be the quickest way to individually identify these devices that are filling the WAP association tables ??
    (Can specific WAP Association tables be viewed with controller based WAPS's ???? )
    Anyone solved similar ??
    thanks
    Martyn

    Solution
    After some too-ing- and fro-ing with TAC eventually got an answer of
    "As it can be false positive in our case."
    rgds

  • M:N Relation and plural name for associative Table

    Hi,
    I'm using DM 3.1.4
    In my logical model, 2 entities and an M:N relation. I define a name for this relation
    Entity Student
    Entity Stage
    Relation Registration
    I create a glossary with plural form for these three names (entities name and relation name) :
    Student --> STUDENTS
    Stage --> STAGES
    Registration --> REGISTRATIONS
    When I generate relationnal model with "apply name translation" option, my two tables are named correctly with the plural name, but the associative table is named with the relation name (registration), not with the plural form (REGISTRATIONS)
    Is this a bug ? Is there another way to automatically define plural name for an associative table ?
    Thanks
    Fabrice.
    Edited by: FabriceC on 22 mars 2013 14:03

    Hi Fabrice,
    thanks for reporting the problem. I logged a bug for that.
    There is no another way for setting a plural name for intersection table. If you switch to 3.3 then you can set the name manually and lock it so it cannot be changed further.
    Philip

  • Dot11 associations table, client associated with 0.0.0.0

    I'm having an issue where wireless client association seam to fail to get IP address, but acctually don't...
    MAC Address    IP address      Device        Name            Parent         State    
    0016.eaae.c896 0.0.0.0         unknown       -               self           EAP-Assoc
    001f.e178.c6d8 192.168.27.192  unknown       -               self           EAP-Assoc
    This happens only "sometimes", especially when the clients (laptops) wake up from sleep mode.
    Although the association shows IP 0.0.0.0, the state is "EAP-Assoc" and I can confirm that the client passed RADIUS authentication, received IP from DHCP and can ping the gateway.
    The wireless network is made up by autonomous/standalone access-points (Cisco aironet 1100, 1130, 1200, 1040).
    Network access is PEAP, WPA/AES, dot1x, multiple Vlans...
    All access-points have an access-list at the radio IN that is dropping all IP broadcasts.
    When I remove the ACL, everything appear to be fine (at least all the times that I checked), but when the ACL is active the issue doesn't always come up.
    I must understand what is going on because this ACL (although it's not very common) has proven it's value by saving 30-40% CPU usage on access-points...
    Does anyone know how the "dot11 associations" table is built??
    Maybe some tips on how to troubleshoot the issue.
    thanks in advance

    As an answer to your early quetsions (that I don't know why we did not answer it yet):
    Assoc table is mainly built from information in association frames.
    Assoc frames have no idea about IP addresses so how the APs know the IP? Not from assoc frames of course.
    Each vendor may have different way to know the IP (they can look into the header of the IP traffic of that special client or they an look into dhcp communication).
    summarizing the issue so far:
    - The issue happens ONLY with the ACL in place.
    - It does not happen with all clients.
    - It happens ONLY when the clients in power save mode.
    - It happens with same clients if they use static ip address even if they are not in power save mode (please confirm or amend this sentence to be more accurate).
    Why power save mode do not show the IP? - > answering this quetion almost solves the problem.
    what is common among the problematic clients? - > need to know this in order to isolate further.
    Is it AP hardware/software related? -> helps to isolate further.
    I said that it could possibly be related to information elements but not necessarily.
    There are information element that transfer Power Save capability between clietns and the AP. I have no idea though how those can be related.
    More information about information elements can be found in the IEEE standard downloadable from here:
    http://standards.ieee.org/getieee802/download/802.11-2007.pdf
    go to section :
    7.3.2 Information elements
    in page 99.
    I tried to read about power save and tried to link that with our issue with no hope.
    It could possibly a bug or so that when PS is used the AP behaves differently.
    HTH
    Amjad

  • Best index for big association table

    Hi,
    I have an association table:
    SURROGATE_ID, CONTENT_TYPE, OWNER_ID, REF_COUNT
    The SURROGATE_ID is an auto generated primary key.
    There are about 5 different content type integers.
    There are a huge number of OWNER_ID long integers, including a value of NOBODY_ID.
    The refcount reflects the number of contents for that type with that owner.
    I need a fast COUNT(*) query that for a given CONTENT_TYPE value, and a given OWNER_ID value, counts the number of rows (either zero or one) with REF_COUNT > 0.
    My naive ploy would be orthogonal indices on CONTENT_TYPE, OWNER_ID, and REF_COUNT.
    And then construct a reasonable query not worrying about the order of the conditions:
    where CONTENT_TYPE = :mytype and OWNER_ID = :myowner and REF_COUNT > 0
    Can someone tell me the wisest index to use?
    Andy

    user9990110 wrote:
    Hi,
    I have an association table:
    SURROGATE_ID, CONTENT_TYPE, OWNER_ID, REF_COUNT
    The SURROGATE_ID is an auto generated primary key.
    There are about 5 different content type integers.
    There are a huge number of OWNER_ID long integers, including a value of NOBODY_ID.
    The refcount reflects the number of contents for that type with that owner.
    I need a fast COUNT(*) query that for a given CONTENT_TYPE value, and a given OWNER_ID value, counts the number of rows (either zero or one) with REF_COUNT > 0.Define fast please.
    user9990110 wrote:
    My naive ploy would be orthogonal indices on CONTENT_TYPE, OWNER_ID, and REF_COUNT.I'm not sure i understand your use of the word orthogonal in this context, can you elaborate please?
    user9990110 wrote:
    And then construct a reasonable query not worrying about the order of the conditions:
    where CONTENT_TYPE = :mytype and OWNER_ID = :myowner and REF_COUNT > 0
    Can someone tell me the wisest index to use?
    AndyDon't worry about the order of the conditions in your SQL, the cost based optimizer will handle that for you based on a plethora of factors.
    Are you always going to query by content_type, owner_id and ref_count? How many other columns does this table have? You say 'big', but are you talking row wise, column wise, both?
    My first instinct would be to index (in this order, and assuming this table has many other columns):
    CONTENT_TYPE
    OWNER_ID
    REF_COUNT

  • CRM Tables , Tables Mappings , T-codes , Function modules

    Hi All,
    I am new to CRM , I want to know the tables , table mappings transaction
    codes , functional modules used . Can any one mention the link / list down all which i have mentioned above .
    I will be very helpful if i get this information.
    cheers,
    Chandra.

    hi,
       CRM tables:
        https://forums.sdn.sap.com/click.jspa?searchID=2400935&messageID=3134573
        https://forums.sdn.sap.com/click.jspa?searchID=2400935&messageID=3128631
        https://forums.sdn.sap.com/click.jspa?searchID=2400935&messageID=3269744
    CRM FM:
       https://forums.sdn.sap.com/click.jspa?searchID=2400963&messageID=3239545
    Reward points if useful..
    Regards
    Nilesh

  • Associative Table Key Value Problem...Plz Help...

    Good Morning guys,
    I would like to ask something about creating associative tables. I want to create an associative table with 3 key values, something like this:
    TYPE datatab IS TABLE OF mis_adeia_employee %ROWTYPE
    INDEX BY NUMBER, VARCHAR2(3), DATE;
    but it displays me error. Is there an alternative way? The basic reason i want to do this, is that my application which is written in PowerBuilder 7 uses datawindows, and now i try to transfer my application from PB to Oracle Forms Builder. So i try to find a structure similar to datawindows. I selected associative tables and i stacked in this example?
    Any help , idea?
    Thanx a lot in advance,
    Regards ,
    Bill ...

    Duplicated post:
    Problem Indexing a Table ! ! !
    Rgds.

  • Migrating the 6.5 Universe table mappings to XIR3?

    I am trying to find in XIR3 where the universe table mappings exist.  This was a feature in supervisor 6.5, on universe properties.
    Any suggestions where i can find this?
    And how do you about migrating this?

    It's in Designer now, Tools>Manage security

  • Fact vs. Dimension table mappings

    What is the difference between how Dimensions and Facts behave in the Mapping Editor?
    I have no problems loading my data into a Dimension, but with the fact table the mapping gets really complex (I have about 5 dimensions and the fact table only contains one measure in addition to the foreign keys).
    I'm guessing there is an easy way to map data to a fact table when the dimensions are defined (otherwise I can't see the need to separate dimensions and facts in the mapping editor), anyone who can help me out on this?
    thanks,
    Ulf

    Ulf,
    Quite often the mapping of the fact is indeed most complex. Common models use lookups to the dimension keys and an aggregation across the keys. In OWB you can use the key lookup operator as well as the aggregator to build the dataflow you need.
    Mark.

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Shipping point field and associated table...

    Hi,
    Can someone tell me the field and table asscoiated with shipping point ?
    Also which transaction code we use for printing smartform for Bill of Lading ?
    Thanks.
    Regards,
    Tushar.

    Hi Tushar,
    some of the related tables which i found for Shipping point are <b>VTTK & VTTP</b> tables
    For the required tables and fields download this document from
    http://www.sap-img.com/sap-download/sap-tables.zip
    and look at the SD tables tables to know the shipping details..
    Reward if it helps
    Regards,
    Santosh

  • Hibernate Table Mappings

    Hi, does one have to map all tables appearing in a query ... Consider the following SQL query ...
    SELECT m.force, m.surname, m.init, a.id, NVL(a.qualification_name_not_found, b.qualification_name) qual_name, q.qualcode, m.app_cde, r.description AS rank FROM locnavy.MEMBERS m, nlrd.QUALIFICATION_ENROLMENT a, nlrd.MASTER_QUALIFICATION b, JOB_QUAL_LNK c, RANKS r, JOB_QUALIFICATION q WHERE a.id = m.force AND r.rank_id = m.rank_cde AND a.qualification_id = b.qualification_id (+) AND a.qualification_id = c.qualification_id AND a.learner_achievement_status_id IN (2,32) AND c.job_qualification_id = q.job_qualification_id" AND q.qualcode != 'XXX' AND (m.mustering_cde = '" + mustCode + "' OR '"+ mustCode +"' IS NULL) AND (m.rank_cde = '" + rankCode+ "' OR '" + rankCode+ "' IS NULL) AND NVL(m.STATUS,'A') = 'A' AND m.app_cde IN ('MC','MG','MP','PE','PF','PV')
    Note that joins are not used as this was written under Oracle 8i ... For the purpose of this query only MEMBERS object/POJO is used to contain the results, other tables appearing here i used to help retrieve the results.
    QUALIFICATION_ENROLMENT MASTER_QUALIFICATION JOB_QUAL_LNK RANKS JOB_QUALIFICATION
    In hibernate SQL/HQL query, would i need to have each table appearing here mapped? Is there a rule that all table joins must be mapped and appearing in hibernate.cfg.xml?
    Edited by: jsunsnx on Jul 10, 2009 11:21 AM

    dcminter wrote:
    I have two queries because Hibernate does not support UNIONs so had to join two queries in a hast table to avoid duplicates Huh? You're doing SQL not HQL. SQL supports unions so there's no reason to avoid them. I think you're confused.
    You might want to take this to the Hibernate forums: [http://forum.hibernate.org/|http://forum.hibernate.org/]
    Oops thanks, no need to go there, was a silly thinking ..
    @SuppressWarnings("unchecked")
    public List findAllBySQL(String mustCode, String rankCode) {
         log.debug("finding all Member instances using native SQL");
         try {
              String queryString
                   = "SELECT m.force, m.surname, m.init, a.id,"
                        + " NVL(a.qualification_name_not_found, b.qualification_name) qual_name,"
                        + " q.qualcode, m.app_cde,"
                        + " r.description AS rank"
                   + " FROM locnavy.MEMBERS m,"
                        + " nlrd.QUALIFICATION_ENROLMENT a,"
                        + " nlrd.MASTER_QUALIFICATION b,"
                        + " JOB_QUAL_LNK c,"
                        + " RANKS r,"
                        + " JOB_QUALIFICATION q"
                   + " WHERE a.id = m.force"
                        + " AND r.rank_id = m.rank_cde"
                        + " AND a.qualification_id = b.qualification_id (+)"
                        + " AND a.qualification_id = c.qualification_id"
                        + " AND a.learner_achievement_status_id IN (2,32)"
                        + " AND c.job_qualification_id = q.job_qualification_id"
                        + " AND q.qualcode != 'XXX'"
                        + " AND (m.mustering_cde = '" + ":mustcde" + "' OR '"+ ":mustcde" +"' IS NULL)"
                        + " AND (m.rank_cde = '" + ":rankcde"+ "' OR '" + ":mustcde"+ "' IS NULL)"
                        + " AND NVL(m.STATUS,'A') = 'A' AND m.app_cde IN ('MC','MG','MP','PE','PF','PV')"
                   + "UNION"
                   + " SELECT m.force, m.surname, m.init, a.id,"
                        + " NVL(a.qualification_name_not_found, b.milqual_qualification_name) qual_name,"
                        + " q.qualcode, m.app_cde,"
                        + " r.description AS rank"
                   + " FROM locnavy.MEMBERS m,"
                        + " nlrd.MILQUAL_ENROLMENT a,"
                        + " nlrd.MASTER_MILQUAL_QUALIFICATION b,"
                        + " JOB_QUAL_LNK c,"
                        + " RANKS r,"
                        + " JOB_QUALIFICATION q"
                   + " WHERE a.id = m.force"
                        + " AND r.rank_id = m.rank_cde"
                        + " AND a.qualification_id = b.qualification_id (+)"
                        + " AND a.qualification_id = c.qualification_id"
                        + " AND a.learner_achievement_status_id IN (2,32)"
                        + " AND c.job_qualification_id = q.job_qualification_id"
                        + " AND q.qualcode != 'XXX'"
                        + " AND (m.mustering_cde = '" + ":mustcde" + "' OR '"+ ":mustcde" +"' IS NULL)"
                        + " AND (m.rank_cde = '" + ":rankcde"+ "' OR '" + ":mustcde"+ "' IS NULL)"
                        + " AND NVL(m.STATUS,'A') = 'A' AND m.app_cde IN ('MC','MG','MP','PE','PF','PV')";     
              Query queryObject = getSession().createSQLQuery(queryString);               
              queryObject.setParameter("mustcde", mustCode);
              queryObject.setParameter("rankcde", rankCode);                               
              return queryObject.list();
         } catch (RuntimeException re) {
              log.error("find all by SQL failed", re);
              throw re;
    }thanks guys ...

  • Exception when using the Multiple Tables

    When I tried to follow through the most recent TopLink tutorial project, I got the following exception if I tried to create a new employee record, although I can view or/and update the salary value from an employee object without any problem.
    Exception [TOPLINK-68] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DescriptorException
    Exception Description: The value of an aggregate in object [Employee: John Smith] is null. Null values not allowed for Aggregate mappings unless "Allow Null" is specified.
    Mapping: oracle.toplink.mappings.AggregateObjectMapping[period]
    Descriptor: RelationalDescriptor(examples.servletjsp.model.Employee --> [DatabaseTable(EMPLOYEE), DatabaseTable(SALARY)])
         at oracle.toplink.exceptions.DescriptorException.nullForNonNullAggregate(DescriptorException.java:1180)
         at oracle.toplink.mappings.AggregateObjectMapping.buildRowFromAggregate(AggregateObjectMapping.java:280)
         at oracle.toplink.mappings.AggregateObjectMapping.buildRowFromAggregate(AggregateObjectMapping.java:267)
         at oracle.toplink.mappings.AggregateObjectMapping.writeFromObjectIntoRow(AggregateObjectMapping.java:925)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildRow(ObjectBuilder.java:753)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildRow(ObjectBuilder.java:742)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:401)
         at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:60)
    I did select the SALARY table as the associated table from the Employee descriptor’s Multitable Info tab and also the “Primary Keys Have the Same Name” option. I also mapped the Employee’s attribute “salary” to the field of SALARY.salary (direct to field mapping). What else did I miss to cause such an exception?
    Many thanks for any help.

    We are always eager to improve the product. Do you have any suggestions as to how the exception could be clarified. This may be a case where those of us on the inside have been looking at the issue the same way for a long time and cannot see the problem.
    the exception thrown is:
    Exception Description: The value of an aggregate in object [Employee: John Smith] is null. Null values not allowed for Aggregate mappings unless "Allow Null" is specified.
    Mapping: oracle.toplink.mappings.AggregateObjectMapping[period]
    Descriptor: RelationalDescriptor(examples.servletjsp.model.Employee --> [DatabaseTable(EMPLOYEE), DatabaseTable(SALARY)])This can be generalized to be:
    Exception Description: The value of an aggregate in object Object.toString() is null. Null values not allowed for Aggregate mappings unless "Allow Null" is specified.
    Mapping: oracle.toplink.mappings.AggregateObjectMapping[attribute-name]
    Descriptor: RelationalDescriptor(Source Descriptor Class --> TABLES)
    Let me know what you think would help diagnose the problem more easily or what additional information provided confuses the diagnosis.
    Thanks in advance for any feedback,
    Doug

Maybe you are looking for