Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    primary keys warning

    [ERROR] [winter] - 21:06:52.412:MUP7:WARN:Log:findByKeys: dataSource 'rvi_today' does not have primary keys declared, can't find record

    I get the following error on my listgrid bound to this table rvi_today.

    My UI seems to work fine, regardless. But, do I need to do something different?

    Notice the MySQL does have a primary key defined. However my ds.xml does not have one defined ...

    I am using MySQL for the DB.
    GWT 2.5
    Smart GWT Pro 3.1

    Thanks
    Marc,

    Below is the table in question
    delimiter $$

    CREATE TABLE `rvi_today` (
    `ravikey` int(11) NOT NULL AUTO_INCREMENT,
    `drug` varchar(255) DEFAULT NULL,
    `ind` varchar(255) DEFAULT NULL,
    `rdate` date DEFAULT NULL,
    `ravi` float DEFAULT NULL,
    `all_facet_date` date DEFAULT NULL,
    `devdrindphase` varchar(255) DEFAULT NULL,
    `devdrindphasedetaildate` date DEFAULT NULL,
    `devdrindphasedetail` varchar(255) DEFAULT NULL,
    `devscore` float DEFAULT NULL,
    `mechscore` float DEFAULT NULL,
    `devphscore` float DEFAULT NULL,
    `devctscore` float DEFAULT NULL,
    `mechstscore` float DEFAULT NULL,
    `mechctscore` float DEFAULT NULL,
    `mechpbscore` float DEFAULT NULL,
    `mechgrscore` float DEFAULT NULL,
    `firsteventdate` date DEFAULT NULL,
    `firsteventevent` varchar(255) DEFAULT NULL,
    `lasteventdate` date DEFAULT NULL,
    `lasteventevent` varchar(255) DEFAULT NULL,
    `company` varchar(255) DEFAULT NULL,
    `country` varchar(255) DEFAULT NULL,
    `ticker` varchar(255) DEFAULT NULL,
    `entfieldskey` int(11) DEFAULT NULL,
    `target` varchar(255) DEFAULT NULL,
    `rank` int(11) DEFAULT NULL,
    `Q5` int(11) DEFAULT NULL,
    `phaserank` int(11) DEFAULT NULL,
    PRIMARY KEY (`ravikey`),
    KEY `idrug` (`drug`),
    KEY `iind` (`ind`),
    KEY `irdate` (`rdate`),
    KEY `iravi` (`ravi`),
    KEY `iall_facet_date` (`all_facet_date`),
    KEY `idevdrindphase` (`devdrindphase`),
    KEY `idevdrindphasedetaildate` (`devdrindphasedetaildate`),
    KEY `idevdrindphasedetail` (`devdrindphasedetail`),
    KEY `idevscore` (`devscore`),
    KEY `imechscore` (`mechscore`),
    KEY `idevphscore` (`devphscore`),
    KEY `idevctscore` (`devctscore`),
    KEY `imechstscore` (`mechstscore`),
    KEY `imechstore` (`mechctscore`),
    KEY `imechpbscore` (`mechpbscore`),
    KEY `imechgrscore` (`mechgrscore`),
    KEY `ifirsteventdate` (`firsteventdate`),
    KEY `ifirsteventevent` (`firsteventevent`),
    KEY `ilasteventdate` (`lasteventdate`),
    KEY `ilasteventevent` (`lasteventevent`),
    KEY `icompany` (`company`),
    KEY `icountry` (`country`),
    KEY `iticker` (`ticker`),
    KEY `ientfieldskey` (`entfieldskey`),
    KEY `itarget` (`target`),
    KEY `irank` (`rank`),
    KEY `iQ5` (`Q5`),
    KEY `iphaserank` (`phaserank`),
    KEY `idrugind` (`drug`,`ind`),
    KEY `iinddrug` (`ind`,`drug`)
    ) ENGINE=InnoDB AUTO_INCREMENT=127087 DEFAULT CHARSET=utf8$$



    and my ds.xml
    <DataSource
    schema="relayBDLive"
    dbName="Mysql"
    tableName="rvi_today"
    ID="rvi_today"
    dataSourceVersion="1"
    generatedBy="Evan 5/7/2012 by hand"
    serverType="sql">
    <fields>
    <field name="drug" title="Drug"></field>
    <field name="ind" title="Disease"></field>
    <field name="company" title="Company"></field>
    <field name="entfieldskey" title="Entity Code"></field>
    <field name="phaserank" type="int" title="Group Sort"> </field>
    <field name="q5" type="int" title="Quintile"></field>
    <field name="devdrindphase" title="Group"></field>
    </fields>
    <!--
    cases
    1. for drug and dz, no op id needed just do the query, so no operation binding needed (we hope)
    2. for target - we want join with drug_ind_target table
    3. for company - we wan to join with drug_ind_company table
    -->
    <!-- dashboard_info.ds.xml is a good example -->
    <operationBindings>
    <!-- http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/docs/CustomQuerying.html -->

    <operationBinding operationId="opIDTodayAndCompany" operationType="fetch">
    <customSQL>
    SELECT rvi_today.drug,
    rvi_today.ind,
    rvi_today.company,
    rvi_today.entfieldskey,
    rvi_today.phaserank,
    rvi_today.q5,
    rvi_today.devdrindphase
    FROM relaybdlive.rvi_today rvi_today
    INNER JOIN
    relaybdlive.drug_ind_company drug_ind_company
    ON (rvi_today.drug = drug_ind_company.drug)
    AND (rvi_today.ind = drug_ind_company.ind)
    WHERE (drug_ind_company.company = $criteria.company)
    </customSQL>
    </operationBinding>

    <operationBinding operationId="opIDTodayAndTarget" operationType="fetch">
    <customSQL>
    SELECT rvi_today.drug,
    rvi_today.ind,
    rvi_today.company,
    rvi_today.entfieldskey,
    rvi_today.phaserank,
    rvi_today.q5,
    rvi_today.devdrindphase
    FROM relaybdlive.rvi_today rvi_today
    INNER JOIN
    relaybdlive.drug_ind_target drug_ind_target
    ON (rvi_today.drug = drug_ind_target.drug)
    AND (rvi_today.ind = drug_ind_target.ind)
    WHERE (drug_ind_target.target = $criteria.target)
    </customSQL>
    </operationBinding>



    </operationBindings>


    </DataSource>

    #2
    primary key

    I think it is just that the data source I am defining .ds.xml is not using the primary key. And thus the warning/error.

    Seems to work, but would be smarter to define a better primary key I actually use.

    Ah for mysql

    Comment


      #3
      It'll come back to bite you if you don't define the primary key.

      The heuristics behind the data source operations need the primary key to work out which record you're updating, etc. If you don't tell it which is the primary key your updates will turn into adds.

      Comment


        #4
        key

        Well there clearly is a primary key (see schema above). However, just not the primary key smart gwt wanted I guess.

        Comment

        Working...
        X