ejbSelect without relationship
thomash76 Jan 31, 2002 10:17 AMHi,
corresponding to EJB2.0 specification i tried the following:
I implemented two remote entity beans (Group and User) and one local entity bean (GroupMember) - all with CMP. Both remote beans define their own ejbSelect method to access the database table of the local bean. This is very much like a container managed relationship, but unfortunately those relationships are only allowed between local beans.
Now the problem: jboss (3.0.0DR1) is unable to deploy the beans... following exception:
org.jboss.deployment.DeploymentException: Error in query spedification for method ejbSelectGroupMember
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory.createJDBCQueryMetaData(JDBCQueryMetaDataFac
tory.java:116)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory.createJDBCQueryMetaData(JDBCQueryMetaDataFac
tory.java:72)
at ... and so on.
The method signature is:
public abstract GroupMember ejbSelectGroupMember (long group, long member) throws FinderException;
Defined in ejb-jar.xml as:
<query-method>
<method-name>ejbSelectGroupMember</method-name>
<method-params>
<method-param>long</method-param>
<method-param>long</method-param>
</method-params>
</query-method>
<result-type-mapping>Local</result-type-mapping>
<ejb-ql>select distinct object(gm) from GROUPMEMBER as
gm where gm.jgroup=?1 and gm.member=?2</ejb-ql>
<ejb-name>GroupMember</ejb-name>
<local-home>GroupMemberHome</local-home>
GroupMember
<ejb-class>GroupMemberBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>GroupMemberPK</prim-key-class>
False
<cmp-version>2.x</cmp-version>
<abstract-schema-name>GROUPMEMBER</abstract-schema-name>
<cmp-field><field-name>jgroup</field-name></cmp-field>
<cmp-field><field-name>member</field-name></cmp-field>
... and in jbosscmp-jdbc.xml almost the same (just without result-type-mapping, ejb-ql, and abstract-schema-name).
In EJB spec there is nothing said that a CMR is needed to access a local bean via ejbSelect, but i'm drawing the conclusion that JBoss does not support that. Does it?!
Regards,
Thomas