facebook

Primary Key Hassles

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #253369 Reply

    Lance Drake
    Member


    In the EJB-JAR.XML file – there is added a line which I cannot seem to cause to simply represent “java.lang.String”

    Despite the fact I have removed the ‘entityPK’ refrence in the ejbdoclet for MyEclipse-XDoclet properties, there seems to be no way to adjust what is resolved to be the <prim-key-class>

       <prim-key-class>com.jcm.table.pcb.interfaces.PcbPK</prim-key-class>

    Adding a pk reference such as shown to the javadoc for the bean does not help.

     * @ejb.pk    class="java.lang.String"

    adding “* prim-key-class=”java.lang.String” to the bean’s javadoc has no effect, either.

    Here’s what get’s added into the xxxDATA.java file:

    
    public com.jcm.table.pcb.interfaces.PcbPK getPrimaryKey() 
    {
    com.jcm.table.pcb.interfaces.PcbPK pk = new com.jcm.table.pcb.interfaces.PcbPK();
    return pk;
    }
    

    It is completely confounding how I have found myself fiddling with this aspect of the configuration that seems so central, such a given BUT… that there seems to be no other such mention from anyone else of a similar quandary. Whaa?

    Thanks for whatever insights you may be able to provide.

    #253370

    Lance Drake
    Member


    If I include prim-key-class in the javadoc for the entity-bean and, with no entityPK inclusion in the ejbdocket properties, it is obliterated by some generated entityPK reference – is that not a bug?

    
    <!--
    The enterprise-beans element contains the declarations of one or more enterprise beans.
    -->
    <!ELEMENT enterprise-beans (session | entity)+>
    
    <!--
    The entity element declares an entity bean. The declaration consists of: 
    an optional description; 
    optional display name; 
    optional small icon file name; 
    optional large icon file name; 
    a name assigned to the enterprise bean in the deployment descriptor; 
    the names of the entity bean's home and remote interfaces; 
    the entity bean's implementation class; 
    the entity bean's persistence management type; the entity bean's primary key class name; 
    an indication of the entity bean's reentrancy;
    an optional list of container-managed fields; 
    an optional specification of the primary key field; 
    an optional declaration of the bean's environment entries; 
    an optional declaration of the bean's EJB references; 
    an optional declaration of the security role references;
    an optional declaration of the bean's resource manager connection factory references.
    
    The optional primkey-field may be present in the descriptor if the entity's persistency-type is Container.
    
    The other elements that are optional are "optional" in the sense that they are omitted if the lists represented by them are empty.
    
    At least one cmp-field element must be present in the descriptor if the entity's persistency-type is Container, and none must not be present if the entity's persistence-type is Bean.
    
    Used in: enterprise-beans
    -->
    <!ELEMENT entity 
    (description?, 
    display-name?, 
    small-icon?,
    large-icon?, 
    ejb-name, 
    home, 
    remote, 
    ejb-class,
    persistence-type, 
    prim-key-class,         <- They're not even showing is as optional
    reentrant,
    cmp-field*, 
    primkey-field?, 
    env-entry*,
    ejb-ref*, 
    security-role-ref*, 
    resource-ref*)
    
    

    Note: the above is from …/MyEclipse/eclipse/plugins/com.genuitec.eclipse.j2eedt.core_4.1.1/dtd/ejb-jar_1_1.dtd

    #253372

    Riyad Kalla
    Member

    Lance,
    I’m sending your post off to our EJB/XDoclet guy to have a look. We may ask you for a simple project that exhibits the problem with instructions on how to reproduce the issue to attach to a bug report for our developers.

    #253390

    Lance Drake
    Member

    Oh my… Well, at least I can take heart in the ever-deepening gloom that, not only is my dog finally getting enough cheese, but I have overcome the impossibly LAMO error in my source code.

    JAVA DOC BEFORE:

    /**
     * @ejb.bean name="Trident"
     *           description="Trident Table Entity Bean"
     *           display-name="Trident"
     *           jndi-name="ejb/Trident"
     *           type="CMP"
     *           cmp-version="2.x"
     *           view-type="local"
     *           local-jndi-name="ejb/TridentLocalHome" 
     *             schema="TridentList"
     *           cmp-field="table_pk"
     *           cmp-field="table_name"
     *           cmp-field="table_type"
     *           cmp-field="table_id" 
     *           cmp-field="table_ipaddr"
     *           cmp-field="table_pit"
     *           cmp-field="table_status"
     *           cmp-field="table_serial"
     *           cmp-field="table_features"
     *           cmp-field="table_installed"
     *           cmp-field="table_txtime"
     *           cmp-field="table_heartbeat"
     *           primkey-field="table_pk"
     *           prim-key-class="java.lang.String"
     *           
     * @ejb.pk    class="java.lang.String"
     *             generate="true"
     *           
     * @ejb:util generate="physical"
     *
     * @ejb.finder  
    *            description="Get ALL table records - returns a COLLECTION"
    *             signature="java.util.Collection findAllTables(com.jcm.table.trident.interfaces.TridentLocal a)"
    *            query="SELECT OBJECT(a) FROM TridentList a"
    */
    
    // -------------------------- BAD BAD BAD Commentline -----------------------------------
    
    public abstract class TridentBean implements EntityBean
    {
    
    /** The entity context */
    private EntityContext context;
    

    Produced an EJB-JAR.XML:

          <!-- Entity Beans -->
          <entity >
             <description><![CDATA[]]></description>
    
             <ejb-name>Trident</ejb-name>
    
             <home>com.jcm.table.trident.interfaces.TridentHome</home>
             <remote>com.jcm.table.trident.interfaces.Trident</remote>
             <local-home>com.jcm.table.trident.interfaces.TridentLocalHome</local-home>
             <local>com.jcm.table.trident.interfaces.TridentLocal</local>
    
             <ejb-class>com.jcm.table.trident.ejb.TridentCMP</ejb-class>
             <persistence-type>Container</persistence-type>
             <prim-key-class>com.jcm.table.trident.interfaces.TridentPK</prim-key-class>
             <reentrant>False</reentrant>
             <cmp-version>2.x</cmp-version>
             <abstract-schema-name>Trident</abstract-schema-name>
             <cmp-field >
                <description><![CDATA[PRIMARY KEY GET]]></description>
                <field-name>table_pk</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE ID GET]]></description>
                <field-name>table_id</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Name GET]]></description>
                <field-name>table_name</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Type GET]]></description>
                <field-name>table_type</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE IPaddr GET]]></description>
                <field-name>table_ipaddr</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Pit GET]]></description>
                <field-name>table_pit</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Status GET]]></description>
                <field-name>table_status</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE PCBSerialNumber GET]]></description>
                <field-name>table_serial</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Features GET]]></description>
                <field-name>table_features</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Installed DateTime GET]]></description>
                <field-name>table_installed</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE TransactionTime GET]]></description>
                <field-name>table_txtime</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Heartbeat GET]]></description>
                <field-name>table_heartbeat</field-name>
             </cmp-field>
    
          <!-- Write a file named ejb-finders-TridentBean.xml if you want to define extra finders. -->
    
          </entity>
    

    Notice – WRONG schema – WRONG prim-key-class – NO ejb.finder ref

    Removing the BAD BAD BAD Comment-line inbetween the JAVADOC and class declaration then yields an EJB-JAR.XML of:

    
         <!-- Entity Beans -->
          <entity >
             <description><![CDATA[Trident Table Entity Bean]]></description>
             <display-name>Trident</display-name>
    
             <ejb-name>Trident</ejb-name>
    
             <local-home>com.jcm.table.trident.interfaces.TridentLocalHome</local-home>
             <local>com.jcm.table.trident.interfaces.TridentLocal</local>
    
             <ejb-class>com.jcm.table.trident.ejb.TridentCMP</ejb-class>
             <persistence-type>Container</persistence-type>
             <prim-key-class>java.lang.String</prim-key-class>
             <reentrant>False</reentrant>
             <cmp-version>2.x</cmp-version>
             <abstract-schema-name>TridentList</abstract-schema-name>
             <cmp-field >
                <description><![CDATA[PRIMARY KEY GET]]></description>
                <field-name>table_pk</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE ID GET]]></description>
                <field-name>table_id</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Name GET]]></description>
                <field-name>table_name</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Type GET]]></description>
                <field-name>table_type</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE IPaddr GET]]></description>
                <field-name>table_ipaddr</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Pit GET]]></description>
                <field-name>table_pit</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Status GET]]></description>
                <field-name>table_status</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE PCBSerialNumber GET]]></description>
                <field-name>table_serial</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Features GET]]></description>
                <field-name>table_features</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Installed DateTime GET]]></description>
                <field-name>table_installed</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE TransactionTime GET]]></description>
                <field-name>table_txtime</field-name>
             </cmp-field>
             <cmp-field >
                <description><![CDATA[TABLE Heartbeat GET]]></description>
                <field-name>table_heartbeat</field-name>
             </cmp-field>
             <primkey-field>table_pk</primkey-field>
    
             <query>
                <description><![CDATA[Get ALL table records - returns a COLLECTION]]></description>
                <query-method>
                   <method-name>findAllTables</method-name>
                   <method-params>
                      <method-param>com.jcm.table.trident.interfaces.TridentLocal</method-param>
                   </method-params>
                </query-method>
                <ejb-ql><![CDATA[SELECT OBJECT(a) FROM TridentList a]]></ejb-ql>
             </query>
          <!-- Write a file named ejb-finders-TridentBean.xml if you want to define extra finders. -->
    
          </entity>
    

    OK – Xdoclet could not get past the notion there was a comment in the source. I dunno… but it would seem this is a bug.

    #253395

    Riyad Kalla
    Member

    Hmm yes this seems to be… an obscure use case, but a bug none the less. I’m not sure if XDoclet is still maintained but you can file an issue here:
    http://opensource.atlassian.com/projects/xdoclet/secure/CreateIssue!default.jspa

    #253401

    Lance Drake
    Member

    With key = XJD-71, there is an existing bug for this phenom at XDoclet – I added my comments – THANKS!

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Primary Key Hassles

You must be logged in to post in the forum log in