Setting foreign keys directly

I've discovered that Kodo (2.4.2) does not like it when I set foreign keys
directly in order to define a relationship. If I set the foreign key and
then call the relationship getter, even in a subsequent transaction, null
is returned. Is this something that is prohibited by the JDO spec, a bug
in Kodo, or something else?

Just use the execute SQL query VI (I believe it's in the advanced palette) and feed it the table creation SQL code you already have.
Try to take over the world!

Similar Messages

  • Setting Foreign Keys...

    I have a software application that displays all the software purchases by our agency. There is a license table that tells how many licenses there are for that piece of software and the person's name using that license. The relationship is 1 software: many licenses, therefore, the FK to the software table is in the license table. How do I update my FK in my license table, via the form? When a user pulls up the software record and then clicks on the license tab, I want the FK- :p6_software_id to equal :p2_software_id and update that FK is it's null. How do I do this via the form? Also, tell me where on the edit page does this code go?

    Doesn't quite answer my question, but let me give more details. I have a software/hardware app that tracks both which is purchased by our office. There is an intersect table between the Sftware table and Hrdwre table called Licenses. A piece of software can be installed on 1 or more pieces of hardware and a piece of hrdwre, of course, can have 1 or more pieces of software loaded on it. The license table only has keys, a PK, that's a seq# and the foreign keys from the sftwre and hrdwre tables. I've tried to use a global variable for each, but that doesn't seem to work correctly. I need the form to insert these FKs. The scenario: Visio is the sftwre and has 3 licenses. deebee is assigned a piece of hrdwre that has Visio. I need the License table to show: PK-1, FK(sftwre)-1, FK(hrdwre)-1. Therefore, when the user enters a piece of sftwre, the form needs to grab that PK from the sftwre table and create the FK in license from :p2_sftwre_id. When I enter the hrdwre record, I need the PK from hrdwre to create the FK in license from :p6_hrdwre_id. And each time I have a piece of hrdwre that has Visio, I populate License with the PK from the seq#, the FK for Visio and the new hrdwre_id, because I've entered another record that Stacy has a piece of hrdwre with Visio on it, making 2 of the Visio licenses given.
    Please help.

  • 1:M Relationship - No Foreign Key is set

    Hello,
    I got a problem with 1:M relationships. The data I send is inserted without problems but the foreign key column is never set (null). Its very strange cause the reading works fine.
    The Structur: got 2 tables ... Parent_tab and Child_tab.
    I got 3 classes ... Parent_class (this one holds an ArrayOfChild_class), Child_class and ArrayOfChild_class (That holds a Collection of Child_classes). (I know its weird but i dont made this stuff, just have to work with it (and live with it)).
    So i mapped the Parent_class to Parent_tab and Child_class to Class_tab (nothing unusale there) and made the ArrayOf Class to an aggregate and put it in the parent_class (where it belongs). In the ArrayOf Aggregate I mapped the Child_class 1:M. There I also set the Foreign Key (in this case 1:1 Child to Parent).
    So, anyone still there or all lost :-)
    Like I said... the reading works fine, but if i try to insert data it didnt set the foreign key. Tried alot but nothin worked.
    Hope someone has an idea ...
    btw. I am working with Toplink 9.0.3 Build 425.

    Hello,
    I got a problem with 1:M relationships. The data I
    send is inserted without problems but the foreign key
    column is never set (null). Its very strange cause
    the reading works fine.
    The Structur: got 2 tables ... Parent_tab and
    Child_tab.
    I got 3 classes ... Parent_class (this one holds an
    ArrayOfChild_class), Child_class and
    ArrayOfChild_class (That holds a Collection of
    Child_classes). (I know its weird but i dont made
    this stuff, just have to work with it (and live with
    it)).
    So i mapped the Parent_class to Parent_tab and
    Child_class to Class_tab (nothing unusale there) and
    made the ArrayOf Class to an aggregate and put it in
    the parent_class (where it belongs). In the ArrayOf
    Aggregate I mapped the Child_class 1:M. There I also
    set the Foreign Key (in this case 1:1 Child to
    Parent).
    So, anyone still there or all lost :-)
    Like I said... the reading works fine, but if i try
    to insert data it didnt set the foreign key. Tried
    alot but nothin worked.
    Hope someone has an idea ...
    btw. I am working with Toplink 9.0.3 Build 425.I think this post is relevant to your situation. Please confirm if you are getting the same error.
    Master-Detail Insertion problem

  • Foreign key not working in a table control set on a pop-up window

    Hi Experts,
    I have created a table control using EEWB on BUPA object. I have moved this table control using BUCO transaction to address view. As the address is displayed in BP transaction as a pop-up window, when the error message from the foreign key verification should raise the pop-up window is closed and nothing happens. What I want is the error doesn,t let the window to be closed and show an error message.  Any suggestion to achieve that?
    Thanks in advance.
    Rosa

    Hi,
    Please check demo program DEMO_DYNPRO_TABLE_CONTROL_2.
    Try to copy to custom program and make the following line changes.
    MODULE CHECK_ALL INPUT.
      CASE OK_SAVE.
        WHEN 'ALLM'.
          LOOP AT ITAB.
    *       IF itab-mark = 'X'.
    *         MESSAGE i888 WITH 'Zeile' sy-tabix 'markiert'.
    *       ENDIF.
            ITAB-MARK = 'X'.
            MODIFY ITAB.
          ENDLOOP.
    Hope this will help ...
    Regards,
    Ferry Lianto

  • Binding for table produces list for other tables using foreign key and crea

    Using
    software Jdev 11G, WLS 11G, Oracle DB 11G, Windows Vista platform
    technology EJB 3.0, jspx, backing beans, session bean
    I cannot create a namedquery on my secondary table. The method for the column uses the entity object rather than the name and value of the column.
    For instance,
    (Coketruck) table has inventory records(Products) table
    Coketruck has one to many to the Products table
    Products has a many to one to the Coketruck
    I need to return the products from the product table based on the CokeTruck but I cannot create a namedQuery because the method in the Product table is an entity object type instead of a long that I can use to look up all the products based off the column truck_id.
    This is what I was expecting…
    Private Long truckId;
    public Long getTruckId() {
    return truckId;
    public void setTruckId (Long truckId) {
    this. truckId = truckId;
    Instead this is what I have…
    @ManyToOne
    @JoinColumn(name = "TRUCK_ID")
    private Coketruck coketruck;
    this. coketruck = coketruck
    public Coketruck getCoketruck() {
    return coketruck;
    public void set Coketruck (Coketruck coketruck) {
    this. coketruck = coketruck;
    How do I do a query on the Product table to return all the products that are in the coketruck?
    If I do the following it expects for me to pass the Entity Object which I cannot use as search criteria for my find method.
    @NamedQuery(name = "Products.findById", query = "select o from Products o where o.truckId = :truckId")
    On a different note but the same song…
    I noticed that when I look at my Session Bean Data Contols that the coketruck already has a list of the products. I have created a jsp page with a backing bean and have been able to use the namedquery on the coketruck entity to retrieve the productList. Unfortunately I need to sort the products by type and was also not able to find where to perform the work to be able to iterate through the productList to get my desired display. Therefore I started looking at doing another namedquery that would only retrieve the product_type ordering by the truckId.
    Seems I have come full circle… I don’t care what method I have to use to get the info back.
    Any help is greatly appreciated!

    user9005175 wrote:
    Hi!
    I work on an application wich uses a shopping cart stored in a database. The shopping cart uses two tables:
    CART: Holds information common for one shopping cart: the user it is connected to etc.
    - Primary key: CART_ID
    CART_ROW: One row in the cart, e.g. one new product to buy.
    - Primary key: ROW_ID
    - Foreign key: CART_ROW.CART_ID references CART.CART_ID
    From the code the rows in the cart are collected per cart, as is modelled by the foreign key. There exists one more relationship, which we use in the code, but which is not modelled by a foreign key in the database. One row can be dependent on another row, which makes the other row a parent.
    CART_ROW has a column PARENT_ID which references CART_ROW.ROW_ID.
    Should we add a foreign key for PARENT_ID? Or are there any questions to consider when it is a foreign key to the same table?
    I suggest to add foreign key it wont harm the performance (except while on insert when there would be validation for the foreign key). But it would prevent users to insert wrong/corrupt data either through code or directly by loggin in the database.
    A while ago we added indexes, both on ROW_ID and on PARENT_ID. Could the index on PARENT_ID have been harmful, since there is no foreign key?
    Index on parent_id would only be harmful if you do not make use of index after creating it (i.e. there is no query which make use of this index).
    And if you decide to have a foreign key on parent_id then I suggest to have index too on parent_id as it would be helpful atleast when you delete any record in this table.
    Best regards!

  • Foreign Key Relationships to external associations - Is it really this dodgy or is there a better way?

    Hi All,
    Let's picture that I have a GW service called Search Helps and within that service I have a PersonalAreas Entity Set which acts as a search help for drop down fields effectively that need to select a Personal Area.  I have 3 properties, with Personal Area Id and Company Code being the keys, and the text for Personal Area being the 3rd and last property. You really need to filter PersonalAreas by Company Code otherwise it's a fairly useless result set.
    Now within a different GW service, I have an entity called Position which has a single key of PositionId.  There is also a a property of company code on this Position.
    Now rather than asking the UI developer to get the Company code value and filter PersonalAreas with it directly, I thought it would be nicer for the UI developer just to use the navigation from a specific Position to PossiblePersonalAreas.  e.g. Positions('123')/PossiblePersonalAreas returns the entity set of PersonalAreas filtered by the Position's Company Code.
    So with that in mind, I add the external model reference pointing at the search helps service; then create an external association via the sneaky External Associations Editor button (that doesn't appear on the Wizard just to confuse you), and set up my Dependent entity to point at the Search Helps PersonalAreas entity.
    At this point I really want to tie the Position's Company Code to the PersonalAreas Company Code, but all I can do is set up a referential constraint of PositionId to CompanyCode or have no referential constraint at all (note - in my example I added the referential constraint as there is an issue with navigation keys being provided to external associations from what I can tell - more about this below).
    So, without any other option, I go into my GetEntitySet method of PersonalAreas and write something like the following:
      CASE iv_source_name.
        WHEN 'Position'.
          READ TABLE it_filter_select_options ASSIGNING <filter> INDEX 1.
          CHECK sy-subrc = 0.
          READ TABLE <filter>-select_options assigning <select_option> INDEX 1.
          CHECK sy-subrc = 0.
          position_id = <select_option>-low.
    *     Get company code for position
          TRY.
              CREATE OBJECT o_position
                EXPORTING
                  i_position_id = position_id.
              o_position->get_cost_centre_information(
                IMPORTING
                  e_company_code = company_code
            CATCH zcx_hr_object.
          ENDTRY.
      endcase.
    * Continue with retrieving PersonalAreas for given Company Code
    <Remaining code not shown>
    e.g. I have to assume CompanyCode is actually "Position Id" when the source of this call is from Position (I could also look at the navigation to find this has come from Position but if you're wondering, unfortunately for external associations, the key is not included in this for some reason but the same followup logic of reloading the object would be required).
    So the question I'm hoping the answer to is Yes is: Am I missing something in my understanding here?
    Thanks,
    Matt
    Edit since posting and playing around a bit more: Thinking about this further - it's unfortunate, but the navigation property in odata really implies the dependent entity has knowledge of the principal entity and realistically must know how to instantiate it if it needs to get data based on one of the properties. 
    Now while I'm fine with that (sort of) I think it's wrong that the dependent entity needs to have the required key properties to hold the principal entities as it makes something like a generic search help impossible to do with navigation - Maybe I just need to be done with that and expect filters to be used by UI programmers to find foreign key'ed entities....

    Hi Matt,
    I'm not surprised that you have an issue with this. One bugbear I have with Gateway is that for some reason the designers don't think any context beyond the immediate preceding navigation node is important. They don't support this within the same service,so it's hardly likley to work in a service reference.
    I may be wrong but I don't think GW is OData compliant in this respect. If I have the navigation path /blindservice/FromHereSet(1)/ToAPoints(22)/ToBPoints, it's rather restrictive to say I cannot see the initial key of '1' in the path when I am trying to resolve 'ToBPoints'. If that value - where I started - is key to the context, I have to know it.
    Currently the only way to access this context is to embed the 'key history' in the intermediate entities, i.e. /blindservice/FromHereSet(1)/ToAPoints(1,22)/ToBPoints. In my view that is corrupting the URl to suit the limitations of the SAP OData implementation. What's even more confusing/frustrating is that the technical request context appears to be able to store the stacked navigation keys but doesn't make use of this design. 
    I feel your pain
    Ron.

  • How to insert a new record to table with foreign key

    I have 3 tables like this :
    CREATE TABLE PERSON (
    PK INTEGER NOT NULL,
    NAME VARCHAR(10),
    SSNUM INTEGER,
    MGR INTEGER);
    ALTER TABLE PERSON ADD CONSTRAINT PK_PERSON PRIMARY KEY (PK);
    ALTER TABLE PERSON ADD CONSTRAINT FK_PERSON FOREIGN KEY (MGR) REFERENCES
    PERSON (PK);
    /* Tables
    CREATE TABLE PROJECT (
    PK INTEGER NOT NULL,
    CODE_NAME INTEGER);
    ALTER TABLE PROJECT ADD CONSTRAINT PK_PROJECT PRIMARY KEY (PK);
    /* Tables
    CREATE TABLE XREF (
    PERSON INTEGER NOT NULL,
    PROJECT INTEGER NOT NULL);
    ALTER TABLE XREF ADD CONSTRAINT PK_XREF PRIMARY KEY (PERSON, PROJECT);
    ALTER TABLE XREF ADD CONSTRAINT FK_XREF1 FOREIGN KEY (PERSON) REFERENCES
    PERSON (PK);
    ALTER TABLE XREF ADD CONSTRAINT FK_XREF2 FOREIGN KEY (PROJECT) REFERENCES
    PROJECT (PK);
    I do like the way of "ReverseTutoral" and the file .jdo here :
    <?xml version="1.0" encoding="UTF-8"?>
    <jdo>
    <package name="reversetutorial">
    <class name="Person" objectid-class="PersonId">
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="table" value="PERSON"/>
    <field name="name">
    <extension vendor-name="kodo" key="data-column"
    value="NAME"/>
    </field>
    <field name="person">
    <extension vendor-name="kodo" key="pk-data-column"
    value="MGR"/>
    </field>
    <field name="persons">
    <collection element-type="Person"/>
    <extension vendor-name="kodo" key="inverse"
    value="person"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="person"/>
    </field>
    <field name="pk" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PK"/>
    </field>
    <field name="ssnum">
    <extension vendor-name="kodo" key="data-column"
    value="SSNUM"/>
    </field>
    <field name="xrefs">
    <collection element-type="Xref"/>
    <extension vendor-name="kodo" key="inverse"
    value="person"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="person"/>
    </field>
    </class>
    <class name="Project" objectid-class="ProjectId">
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="table" value="PROJECT"/>
    <field name="codeName">
    <extension vendor-name="kodo" key="data-column"
    value="CODE_NAME"/>
    </field>
    <field name="pk" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PK"/>
    </field>
    <field name="xrefs">
    <collection element-type="Xref"/>
    <extension vendor-name="kodo" key="inverse"
    value="project"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="project"/>
    </field>
    </class>
    <class name="Xref" objectid-class="XrefId">
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="table" value="XREF"/>
    <field name="person">
    <extension vendor-name="kodo" key="pk-data-column"
    value="PERSON"/>
    </field>
    <field name="person2" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PERSON"/>
    </field>
    <field name="project">
    <extension vendor-name="kodo" key="pk-data-column"
    value="PROJECT"/>
    </field>
    <field name="project2" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PROJECT"/>
    </field>
    </class>
    </package>
    </jdo>
    Data of those tables are :
    PERSON :
    | PK | NAME | SSNUM | MGR |
    | 1 | ABC | 1 | 1 |
    | 2 | DEF | 5 | 1 |
    PROJECT
    | PK | CODE_NAME |
    | 1 | 12 |
    | 2 | 13 |
    And now I want to add a new record into table XREF : insert into XREF
    values (1,1);
    public void createData() {
    Xref xref = new Xref();
    Person person = new Person(1);
    Project project = new Project(1);
    xref.setPerson(person);
    xref.setProject(project);
    person.getXrefs().add(xref);
    person.getXrefs().add(xref);
    pm.currentTransaction().begin();
    pm.makePersistent(xref);
    pm.currentTransaction().commit();
    I don't know why Kodo automatically insert new record to table PERSON ->
    confilct Primary Key. The errors are :
    0 [main] INFO kodo.Runtime - Starting Kodo JDO version 2.4.1
    (kodojdo-2.4.1-20030126-1556) with capabilities: [Enterprise Edition
    Features, Standard Edition Features, Lite Edition Features, Evaluation
    License, Query Extensions, Datacache Plug-in, Statement Batching, Global
    Transactions, Developer Tools, Custom Database Dictionaries, Enterprise
    Databases, Custom ClassMappings, Custom ResultObjectProviders]
    41 [main] WARN kodo.Runtime - WARNING: Kodo JDO Evaluation expires in 29
    days. Please contact [email protected] for information on extending
    your evaluation period or purchasing a license.
    1627 [main] INFO kodo.MetaData -
    com.solarmetric.kodo.meta.JDOMetaDataParser@e28b9: parsing source:
    file:/D:/AN/Test/classes/reversetutorial/reversetutorial.jdo
    3092 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] open:
    jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
    3325 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ]
    close:
    com.solarmetric.datasource.PoolConnection@164dbd5[[requests=0;size=0;max=70;hits=0;created=0;redundant=0;overflow=0;new=0;leaked=0;unavailable=0]]
    3335 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] close
    connection
    3648 [main] INFO jdbc.JDBC - Using dictionary class
    "com.solarmetric.kodo.impl.jdbc.schema.dict.InterbaseDictionary" to
    connect to "Firebird" (version "__WI-V6.2.972 Firebird 1.0.3)WI-V6.2.972
    Firebird 1.0.3/tcp (annm)/P10") with JDBC driver "firebirdsql jca/jdbc
    resource adapter" (version "0.1")
    4032 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] open:
    jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
    4143 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
    preparing statement <3098834>: INSERT INTO XREF(PERSON, PROJECT) VALUES
    4224 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
    executing statement <3098834>: [reused=1;params={(int)1,(int)1}]
    4244 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
    preparing statement <9090824>: INSERT INTO PERSON(MGR, NAME, PK, SSNUM)
    VALUES (?, ?, ?, ?)
    4315 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
    executing statement <9090824>: [reused=1;params={null,null,(int)1,(int)0}]
    4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
    resultSetType or resultSetConcurrency changed
    4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
    resultSetType or resultSetConcurrency changed
    4598 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] begin
    rollback
    4608 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] end
    rollback 10ms
    4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ]
    close:
    com.solarmetric.datasource.PoolConnection@1878144[[requests=2;size=2;max=70;hits=0;created=2;redundant=0;overflow=0;new=2;leaked=0;unavailable=0]]
    4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] close
    connection
    javax.jdo.JDOFatalDataStoreException:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
    [PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
    GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
    on table "PERSON" [code=335544665;state=null]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
    [PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
    GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
    on table "PERSON"
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLExceptions.java:17)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:416)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
    at reversetutorial.Finder.createData(Finder.java:74)
    at reversetutorial.Finder.main(Finder.java:141)
    NestedThrowablesStackTrace:
    org.firebirdsql.jdbc.FBSQLException: GDS Exception. violation of PRIMARY
    or UNIQUE KEY constraint "PK_PERSON" on table "PERSON"
    at
    org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:425)
    at
    org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
    at
    com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
    at reversetutorial.Finder.createData(Finder.java:74)
    at reversetutorial.Finder.main(Finder.java:141)
    at org.firebirdsql.gds.GDSException: violation of PRIMARY or UNIQUE KEY
    constraint "PK_PERSON" on table "PERSON
    at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1683)
    at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1636)
    at org.firebirdsql.jgds.GDS_Impl.isc_dsql_execute2(GDS_Impl.java:865)
    at
    org.firebirdsql.jca.FBManagedConnection.executeStatement(FBManagedConnection.java:782)
    at
    org.firebirdsql.jdbc.FBConnection.executeStatement(FBConnection.java:1072)
    at
    org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:420)
    at
    org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
    at
    com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
    at reversetutorial.Finder.createData(Finder.java:74)
    at reversetutorial.Finder.main(Finder.java:141)
    Exception in thread "main"

    First off, use the '-primaryKeyOnJoin true' flag when running the reverse
    mapping tool so that you can get rid of that useless Xref class and have
    a direct relation between Person and Project. See the documentation on
    reverse mapping tool options here:
    http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_pc_reverse.html
    But your real problem is that you are creating new objects, assigning
    primary key values, and expecting them to represent existing objects.
    That's not the way JDO works. If you want to set relations to existing
    objects in JDO, you use the PM to look up those objects. If you try to
    create new objects, JDO will assume you want to insert new records into
    the DB, and you'll get PK conflicts like you see here.
    There are several good books out on JDO; if you're just starting out with
    it, they might save you a lot of time and help you master JDO quickly.

  • FOREIGN KEY IS PRIMARY KEY

    Hi,
    Has anyone come across the following problem?
    I have two tables
    customer individual
    customer_id (PK) customer_id (PK)
    customer_id in individual is the primary key for that table. It is also a foreign key ( related back to customer).
    If I use JDeveloper to drag in the two tables ( into a class diagraqm), I have a problem.
    JDeveloper "sees" the Individual bean foreign key mapping and generates a getCustomer() method (which returns a handle to the appropriate customer bean).
    However as it "removes" the getCustomer_id() method(which returns the actual customer_id), the primary_key reference is dropped.
    When I try and compile, JDeveloper quite rightly complains with "where is the primary key".
    Can anyone help? Do I need to make it a rule that the foreign key is not also the primary key?
    thanks in advance,
    Kevin

    Hello,
    I am having the same problem attempting to use a foreign key as a primary key in an EJB 2.0 CMR running on WLS 6.1. If I do not set the foreign key portion of my composite key in the ejbCreate() method I get an error stating that the field cannot be null (and must be set), when I set the field in the ejbCreate I then get an Error in the ejbPostCreate stating that CMR fields cannot be set using the setXXX methods. The entity relations are as follows:
    SalesOrder <--------------------------------------->SalesOrderProduct
    SalesOrder = (orderid(PK)+orderstatus+salesrepid+contractdate+processdate)
    SalesOrderProduct = (orderid(PK/FK)+productid(PK)+qty+unitcost)
    The CMR relationship is bi-directional. The SalesOrder entity bean's ejbPostCreate() method
    invokes a helper method that attempts to create the salesOrder product entity as part of the salesorder create transaction and that's when I get the errors stated above.
    Have or anyone found out how to handle this kind of cmr using the Weblogic server (6.1) and ejb 2.0??
    Thanks,
    Darryl

  • Corrupt dump file, foreign keys not generated on import

    Hi,
    In our refresh job, we get the dump file from production and use it to refresh the schema in UAT.
    The dump file thus we got from production seems to be corrupt - as its giving error - "IMP-00008: unrecognized statement in the export file: "
    But the error we are getting is for few users, while other users are being imported fine. For the users which got imported fine, the foreign keys are missing !!!
    There is no "error" in the import log regarding the foreign keys.
    We tried to get the indexfile and it has all "Create Table" statements, along with indexes, primary key, check constraints etc .... only the FOREIGN KEYS are missing.
    How can this be explained ?
    With Regards,
    Shalini.

    Some suggestions:
    1. Check Note:111384.1 if you are trying to import from the tape directly.
    2. You can set a bigger buffer size and check whether the error reappears.
    3. If you are trying to perform a full import and the error always seemed to be happening when it tried to import the 56th user, you set init.ora parameter license_max_users (which is set to 55) to a bigger value.
    These are apart from the main reason for this error, i.e., corrupted export file or Import internal bug.

  • JDeveloper 9i, Foreign Keys and LOVs.

    Greetings all,
    I'm using Jdev 9i to try and create some maintenance applications quickly. These applications are pretty standard; insert, update, delete, some validation, including foreign keys.
    The problem is, I can't figure out how to get JDev to generate the JSPs with LOV pages on the foreign keys.
    I've tried setting the validation properties of the entity object to validate from a query, as well as, tried using View objects for the same validation. Neither get me results.
    I've also tried embedding the LOV directly using the LOVInputSelect (or whatever it is called). That works partially by displaying a field and a button, but when I click on it, I get an error with no explanation. Very helpful.
    I can use a InputSelect datatag, but it is not the best choice for foreign keys with hundreds of values.
    Also, since the Wizards are generating the DataEdit tag for the JSP I'm using, it appears that I cannot override them to display the LOV. They display a Calendar page for dates, automatically, but won't display an LOV for referential integrity. At least, I can't figure out how to make them.
    Thanks in advance.
    Ed Dana
    Software Developer.

    It's really beyond me why Oracle haven't provided a fairly complete set of Renderers (and a bit more BC4J oriented than the one's mentioned in the HOWTO).
    Basically, you have two choices:
    1/ develop your own Renderers (make your own conventions with Properties on Entities/ViewObjects) and use InputRender
    2/ generate the JSP's yourself using the usual jbo tags (probably again based on some meta data in the properties). You may have to fiddle around a bit with inputselectlov etc.
    Again, it's hard for me to understand why Oracle haven't substantially improved their default generated BC4J JSP pages, it looks to me that it is not so hard (compared to some of the other things they're trying to pull off) and gives maximum benefit for the customers.
    Alternatively, there is JHeadstart (do a search on otn, you'll find some pointers). It generates lots of screens nicely for you (a la Designer, if you're familiar with that). Some teething problems, but really very productive otherwise. The disadvantage here is that if you want to start to make a few little changes outside what it supports, you're up against a fairly steep learning curve to master UIX and MVC framework. Apparently there's some hope that they will generate to Struts (taglibs & controller, if I understand well) soon.

  • Dimension Attribute not related to the key directly or indirectly.

    I am running into an issue when trying to relate two fact tables to a dimension using two different attributes.  Due to the design of the tables I must join from my fact tables to intermediate tables in order to join to the dimension table.  The
    problem is the fact tables use different intermediate tables to join to the final dimension table.
    For example: FactTable1-->IT1-->DimensionTable<--IT2<--FactTable2
    The  intermediate value from the first table is a foreign key to the dimension table and the intermediate value from the second table is also it's own foreign key to the dimension table.
    Below is some test code to put my problem into SQL.  It's simple enough to join them together but I cannot for the life of me figure out how to properly set up the relationships between attributes in SSAS.
    CREATE TABLE dbo.FactTest1(
    FactTest1Id Int Identity,
    IT1Id INT)
    CREATE TABLE dbo.IT1(
    IT1Id INT IDENTITY,
    DimId1 INT)
    CREATE TABLE dbo.Dim(
    DimId INT IDENTITY,
    DimId1 INT,
    DimId2 INT,
    Description VARCHAR(50))
    CREATE TABLE dbo.IT2(
    It2Id INT IDENTITY,
    DimId2 INT)
    CREATE TABLE dbo.FactTest2(
    FactTest2Id Int Identity,
    IT2Id INT)
    INSERT dbo.FactTest1
    SELECT 1
    UNION
    SELECT 2
    UNION
    SELECT 3
    INSERT dbo.IT1
    SELECT 10
    UNION
    SELECT 20
    UNION
    SELECT 30
    INSERT dbo.FactTest2
    SELECT 1
    UNION
    SELECT 2
    UNION
    SELECT 3
    INSERT dbo.IT2
    SELECT 40
    UNION
    SELECT 50
    UNION
    SELECT 60
    INSERT dbo.Dim
    SELECT 10,40, 'Atrribute1'
    UNION
    SELECT 20,50, 'Attribute2'
    UNION
    SELECT 30,60, 'Atrribute3'
    SELECT *
    FROM dbo.FactTest1 ft
    JOIN dbo.IT1 it
    ON ft.IT1Id = it.IT1Id
    JOIN dbo.Dim dim
    ON it.DimId1 = dim.DimId1
    SELECT *
    FROM dbo.FactTest2 ft
    JOIN dbo.IT2 it
    ON ft.IT2Id = it.IT2Id
    JOIN dbo.Dim dim
    ON it.DimId2 = dim.DimId2

    It depends on the cardinality between the two Fact Tables and intermediate tables. If they are 1 to 1  relationships then you can simply create a view of the fact and intermediate table and then create a direct relationship to the dimension. A more
    efficient solution would be to alter your ETL to just insert the appropriate dimension key directly into the fact table instead of using the intermediate ID.
    You can join fact tables to dimensions at different levels of granularity. eg you could join one fact table to a date dimension at the day level and another at the month level. You just have to consider what you want to happen to the monthly data when viewed
    at a daily level, you can either repeat the monthly value or display a blank or look at overriding the value with some sort of calculation.
    If the relationship between the facts and intermediate tables is many to many then there is an excellent white paper called the "Many to Many Revolution" which shows all the different ways in which many to many relationships can be used in SSAS.
    http://darren.gosbell.com - please mark correct answers

  • BUG: foreign key not altered when on delete is changed

    JDeveloper 10.1.2.0.0
    Problem: create a master/detail relation in the database diagram. Set the foreign key to restrict references. Generate DDL directly in the database to create the tables and FK. Alter the FK to cascade on delete and regenerate the DDL in the database. The FK does not get the cascade delete value.

    Thank you for reporting the problem, I have filed the bug as bug number 4710066.
    Regards,
    Lisa Sherriff
    JDev QA

  • ECC6.0 - Foreign Key in BSEG for new custom field

    When I create a new custom field in NewGL, it is created in some tables like BSEG and others. In BSEG there is no flag in the field "Foreign Keys" (I inserted it when I set the field), while in the others tables I find the flag.
    How can I solve it? I think that I have to mark the field directly in BSEG. Is it true?
    Let me know
    Thanks

    Hi Srini,
    As per note 32662 it seems you have followed all the steps, but might be that you didn't do in proper sequence.
    The note states that:
    "If a new access sequence and condition table was created before the communication structure was modified, it must be deleted again. Items 1 to 5 must be carried out in the specified sequence."
    So I guess the key for you would be to delete the Condition table and access and create them again.
    Regards,
    Ganesh

  • EMIGALL : problem of foreign key

    Hi everybody
    I m working on a EMIGALL migration and i met one problem with foreign key…
    My field VKONT is defined (in specific table ZR006SAT) like a foreign key with check table FKKVK (Contract Account Header). It means that an entry can be inserted in ZR006SAT , only if VKONT value exists in FKKVK table.
    But, during the migration of my migration object ZR006SAT (same name as the table), I have no error when I put any value for my VKONT field in the input file. EMIGALL does not control the foreign key constraint and I don’t understand why (???).
    However,
    1.     when i try to insert manually (by SE11) an entry in ZR006SAT, SAP forces me to input correct value (existing in FKKVK table) for VKONT field.
    2.     for standards migration objects, there is no problem… foreign key check is working well
    3 days I ve been on this problem.
    Please help me

    Hai
    You can find detailed documentation of EMIGALL in SAP itself. Use Transaction EQ81 to display it. It provides all the concepts and procedures to work with EMIGALL. I will also prepare a document and send it to u later. Meanwhile just for ur info here are some points about EMIGALL :
    1. It Migrates data Business Object wise
    2. It uses Direct Input Technique
    3. It has more than 100 objects of IS-U
    and the steps for implementation goes like this:
    1)You have to create a user specially for migration which will have all the authorizations related to migration workbench, BASIS and IS-U
    2)You have to create your own company in EMIGALL. There is a default company called SAP.
    3)Company SAP contains all the Business Objects
    4)You have to figure out what business objects u need and then u have to copy those business objects to ur company from Standard Company SAP
    5)Each objects contains more than one structure and each structure can contain more than one fields. The relation goes like this
    Object ---> Structure ---> Field
    6)You have to define field rules for each required field of the object. You have to mark "Not required" for fields u don't need
    7)After field rules for a given object is set u have to generate load report i.e. actual Direct Input Program which will migrate data. This program is generated on basis of field rules set by u.
    8)After the load report is generated u have to prepare an input file (import File) for migration. The import file should be according to structure provided by SAP and must be in binary format. SAP Provides the structure of file according to your configurations. You have to write ur own Data conversion program(in any language) for this task.
    9)You take import file as input and migrate the data using generated load program
    10)Finally u can check the Migration Statistics and Error Log
    Regards
    Sreeni

  • Automatically update foreign key

    Hello,
    I am new into Application Express and currently developing an application to handle amongst other things databases with instances and users. The databases have an internal 10-digit number (ID) as primary key. This number can be found in the instances and user table as a foreign key. However, it is possible that the databases unique 10-digit ID changes and I wan't to know if it's possible to automatically update the foreign key in the instances and in the user table when the database ID is changed or if it is possible at all to change a primary key?
    I have created a report of existing databases with a link on the name of each database directing to another page where you can change every value for the selected database. This works properly and I wan't to enable for the database ID to be changed here as well (and to automatically update all tables where the ID is a foreign key) if it's possible.
    Thank you in advance
    Fabian

    Hi Fabian,
    you can also use a trigger to do the Foreign key update on your child tables.
    In my example the trigger will only fire if the primary key (JOB_ID) of the JOBS table gets updated. In that case it will update all records in the detail table EMPLOYEES to the new primary key value.
    CREATE OR REPLACE TRIGGER TRG_JOBS_PK_UPDATE
    AFTER UPDATE
    OF JOB_ID
    ON JOBS
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
        UPDATE EMPLOYEES
           SET JOB_ID = :NEW.JOB_ID
         WHERE JOB_ID = :OLD.JOB_ID
    END;Hope that helps
    Patrick
    Check out my APEX-blog: http://inside-apex.blogspot.com
    Check out the ApexLib Framework: http://apexlib.sourceforge.net

Maybe you are looking for

  • Packet loss when pinging from/to a cisco 3560e switch

    I see Packet loss when pinging from/to a cisco 3560e switch. CPU utilization is normal. Switches are running with IOS c3560e-universalk9-mz.122-35.SE5.bin. Packet loss is observed for all the devices irrespective of directly connected or remote devic

  • QuickTime Plug In Question

    10.6.8. Firefox is my default browser (up to date). I check Add-ons Manager and get a notidfication that Mozilla has determined tha the plug-in (7.6.6) is vunerable and should be updated. I go to the link and get this message: QuickTime Plugin 7.7.0

  • Attachment in Marketing Plan

    Dear all I was creating a marketing plan in CRM. I saved a excel file as attachment in the element of marketing plan. Now I want to get  the data in excel file . Please suggest. Edited by: Abhinav Saxena(CRM) on Dec 8, 2011 9:08 AM

  • Photoshop keeps showing 'strtable error' when opening PSD files?

    I'm on a near new late 2013 model MBP/OS 10.9.4 running CC2014. Anybody encounter this and figure out whether it's a Mac OS or an Adobe issue... or even better, what it is & how to fix it? A quick search hints that it might be related to the wrong fi

  • I'm a creative cloud member. Can I install it on both my iMac and ipad

    Can I use creative cloud on two devices?