Announcement Announcement Module
Collapse
No announcement yet.
Fields in composite primary key are not created in the entity itself Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fields in composite primary key are not created in the entity itself

    My postgres table is shown thus in dbre.xml

    Code:
        
    <table alias="public" name="costi_extra_appt">
            <column name="serial_link" primaryKey="true" required="true" scale="0" size="10" type="4,int4"/>
            <column name="stagione" primaryKey="true" required="true" scale="0" size="10" type="4,int4"/>
            <column name="appt_no" primaryKey="true" required="true" scale="0" size="10" type="4,int4"/>
            <column name="colonna_appt" primaryKey="true" required="true" scale="0" size="2147483647" type="12,text"/>
            <column name="lingua" primaryKey="true" required="true" scale="0" size="2" type="1,bpchar"/>
            <column name="testo" primaryKey="false" required="true" scale="0" size="2147483647" type="12,text"/>
            <unique name="costi_extra_testo_primary_key">
                <unique-column name="serial_link"/>
                <unique-column name="stagione"/>
                <unique-column name="appt_no"/>
                <unique-column name="colonna_appt"/>
                <unique-column name="lingua"/>
            </unique>
        </table>
    When roo has done his work, however, the only field in the entity class is "testo", which is the only one not in the primary key.

    So for all the other fields I get

    The method setSerialLink(int) is undefined for the type CostiExtraAppt
    The method setStagione(int) is undefined for the type CostiExtraAppt
    The method setLingua(String) is undefined for the type CostiExtraAppt
    The method setColonnaAppt(String) is undefined for the type CostiExtraAppt
    The method setApptNo(int) is undefined for the type CostiExtraAppt

    when I try to access them.

    I shall temporarily set them all in the .java file, but is there anything I can do to get roo to create them in the entity?

    Thanks

  • #2
    bump

    bump - no takers for this?

    Comment


    • #3
      Have you tried something like this...

      Code:
      CostiExtraApptPK pk = new CostiExtraApptPK();
      pk.setSerialLink(...)
      //...etcetera
      
      CostiExtraAppt costiExtraAppt = new CostiExtraAppt();
      costiExtraAppt.setId(pk);

      ...?

      Comment


      • #4
        Ah, that has set a light bulb off - obvious I suppose.
        Thanks, I'll try working along those lines.

        Comment

        Working...
        X