geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xh <xhsaymyn...@yahoo.co.uk>
Subject two entity beans in one module
Date Wed, 01 Aug 2007 10:47:54 GMT
Hi All,

I'm using WAS-CE (based on Geronimo 1.1) , I have defined two entity beans, while fetching
them this way:

WebPageLocalHome home =
    (WebPageLocalHome)context.lookup("java:comp/env/ejb/WebPageBean");

System.out.println(home.getClass().getSimpleName());

WebModuleLocalHome mhome =
    (WebModuleLocalHome)context.lookup("java:comp/env/ejb/WebModuleBean");

System.out.println(mhome.getClass().getSimpleName());


I have:

EntityEJBLocalHome$$EnhancerByCGLIB$$904af65b
javax.naming.NameNotFoundException: env/ejb/WebModuleBean
        at org.apache.geronimo.naming.enc.AbstractReadOnlyContext.lookup(AbstractReadOnlyContext.java:81)
        at org.apache.geronimo.naming.java.RootContext.lookup(RootContext.java:51)
        at javax.naming.InitialContext.lookup(Unknown Source)


WebPageBean is successfully retrieved, the result of home.getClass().getSimpleName() is:
EntityEJBLocalHome$$EnhancerByCGLIB$$904af65b

but the WebModuleBean is not found.

WebPageBean is successfully registered, for example its non-default finder works fine:


WebPageLocal local = home.findByNameAndIdModule("Menu", 1);


but normally I need WebModuleBean to get idModule


I've gone through ejb-jar.xml and openejb-jar.xml several times and I cannot see the reason
why WebModuleBean is no registered in JNDI.

While deploying my application WAS-CE does not show any errors.

maybe I miss something, don't see simple error?
my descriptors are attached below

thanks best regards
Lukasz

ejb-jar.xml fragment:

<entity>
            <description>An EJB named WebPageBean</description>
            <ejb-name>WebPageBean</ejb-name>
            <local-home>
                org.xh.dataweaver.web.entity.WebPageLocalHome
            </local-home>
            <local>org.xh.dataweaver.web.entity.WebPageLocal</local>
            <ejb-class>
                org.xh.dataweaver.web.entity.WebPageBean
            </ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            <reentrant>false</reentrant>
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>WebPage</abstract-schema-name>
            <cmp-field>
                <description>idPage</description>
                <field-name>idPage</field-name>
            </cmp-field>
            <cmp-field>
                <description>idModule</description>
                <field-name>idModule</field-name>
            </cmp-field>
            <cmp-field>
                <description>name</description>
                <field-name>name</field-name>
            </cmp-field>
            <cmp-field>
                <description>title</description>
                <field-name>title</field-name>
            </cmp-field>
            <cmp-field>
                <description>noOfVisits</description>
                <field-name>noOfVisits</field-name>
            </cmp-field>
            <cmp-field>
                <description>noOfAJAXRequests</description>
                <field-name>noOfAJAXRequests</field-name>
            </cmp-field>
            <primkey-field>idPage</primkey-field>
            <resource-ref>
                <description>
                    This is a reference to DataWeaver Derby database.
                </description>
                <res-ref-name>jdbc/DataWeaverDS</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
            </resource-ref>
        </entity>
        <entity>
            <description>An EJB named WebModuleBean</description>
            <ejb-name>WebModuleBean</ejb-name>
            <local-home>
                org.xh.dataweaver.web.entity.WebModuleLocalHome
            </local-home>
            <local>org.xh.dataweaver.web.entity.WebModuleLocal</local>
            <ejb-class>
                org.xh.dataweaver.web.entity.WebModuleBean
            </ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            <reentrant>false</reentrant>
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>WebModule</abstract-schema-name>
            <cmp-field>
                <description>idModule</description>
                <field-name>idModule</field-name>
            </cmp-field>
            <cmp-field>
                <description>name</description>
                <field-name>name</field-name>
            </cmp-field>
            <cmp-field>
                <description>description</description>
                <field-name>description</field-name>
            </cmp-field>
            <cmp-field>
                <description>host</description>
                <field-name>host</field-name>
            </cmp-field>
            <cmp-field>
                <description>username</description>
                <field-name>username</field-name>
            </cmp-field>
            <cmp-field>
                <description>passwd</description>
                <field-name>passwd</field-name>
            </cmp-field>
            <primkey-field>idModule</primkey-field>
            <resource-ref>
                <description>
                    This is a reference to DataWeaver Derby database.
                </description>
                <res-ref-name>jdbc/DataWeaverDS</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
            </resource-ref>
        </entity>

openejb-jar.xml fragment:

<entity>
            <ejb-name>WebModuleBean</ejb-name>
            <local-jndi-name>WebModuleBean</local-jndi-name>
            <table-name>dw_modules</table-name>
            <cmp-field-mapping>
                <cmp-field-name>idModule</cmp-field-name>
                <table-column>idModule</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>name</cmp-field-name>
                <table-column>name</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>description</cmp-field-name>
                <table-column>description</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>host</cmp-field-name>
                <table-column>host</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>username</cmp-field-name>
                <table-column>username</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>passwd</cmp-field-name>
                <table-column>passwd</table-column>
            </cmp-field-mapping>
            <resource-ref>
                <ref-name>jdbc/DataWeaverDS</ref-name>
                <resource-link>DataWeaverDispatcherDerby</resource-link>
            </resource-ref>
            <query>
                <query-method>
                    <method-name>findByName</method-name>
                    <method-params>
                        <method-param>java.lang.String</method-param>
                    </method-params>
                </query-method>
                <ejb-ql>
                    SELECT OBJECT(m) FROM
                    WebModule m WHERE
                    m.name = ?1
                </ejb-ql>
            </query>
        </entity>
    
        <entity>
            <ejb-name>WebPageBean</ejb-name>
            <local-jndi-name>WebPageBean</local-jndi-name>
            <table-name>dw_pages</table-name>
            <cmp-field-mapping>
                <cmp-field-name>idPage</cmp-field-name>
                <table-column>idPage</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>idModule</cmp-field-name>
                <table-column>idModule</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>name</cmp-field-name>
                <table-column>name</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>title</cmp-field-name>
                <table-column>title</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>noOfVisits</cmp-field-name>
                <table-column>noOfVisits</table-column>
            </cmp-field-mapping>
            <cmp-field-mapping>
                <cmp-field-name>noOfAJAXRequests</cmp-field-name>
                <table-column>noOfAJAXRequests</table-column>
            </cmp-field-mapping>
            <resource-ref>
                <ref-name>jdbc/DataWeaverDS</ref-name>
                <resource-link>DataWeaverDispatcherDerby</resource-link>
            </resource-ref>
            <query>
                <query-method>
                    <method-name>findByNameAndIdModule</method-name>
                    <method-params>
                        <method-param>java.lang.String</method-param>
                        <method-param>java.lang.Integer</method-param>
                    </method-params>
                </query-method>
                 <ejb-ql>
                    SELECT OBJECT(p) FROM
                    WebPage p WHERE
                    p.name = ?1 AND p.idModule = ?2
                </ejb-ql>
            </query>
        </entity>




      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 
Mime
View raw message