EJB-QL Finder method error
pumuckel Jun 10, 2004 1:58 PMHello
I use JBoss-3.2.3.
I have set up a many to many relationship:
<ejb-relation> <ejb-relation-name>student_module_relation</ejb-relation-name> <ejb-relationship-role> <ejb-relationship-role-name>student-takes-modules</ejb-relationship-role-name> <multiplicity>Many</multiplicity> <relationship-role-source> <ejb-name>UserBean</ejb-name> </relationship-role-source> <cmr-field> <cmr-field-name>takenModules</cmr-field-name> <cmr-field-type>java.util.Collection</cmr-field-type> </cmr-field> </ejb-relationship-role> <ejb-relationship-role> <ejb-relationship-role-name>module-is-taken-by-students</ejb-relationship-role-name> <multiplicity>Many</multiplicity> <relationship-role-source> <ejb-name>ModuleBean</ejb-name> </relationship-role-source> <cmr-field> <cmr-field-name>students</cmr-field-name> <cmr-field-type>java.util.Collection</cmr-field-type> </cmr-field> </ejb-relationship-role> </ejb-relation>
I have also defined a query to get all students which are in a given module:
<query> <query-method> <method-name>findByModule</method-name> <method-params> <method-param>moduledb.ejb.ModuleLocal</method-param> </method-params> </query-method> <ejb-ql>SELECT OBJECT(u) FROM User AS u WHERE ?1 MEMBER OF u.takenModules</ejb-ql> </query>
I have not defined a table mapping for this relation.
When I now invoke this finder method I get the error:
19:53:41,664 INFO [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true 19:53:43,156 ERROR [LogInterceptor] EJBException, causedBy: javax.ejb.FinderException: Find failed: java.sql.SQLException: General error, message from server: "Unknown table 't2_u_takenModules_RELATION_TABLE' in where clause" at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:238) at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:111) at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntitiesCommand.execute(JDBCFindEntitiesCommand.java:38) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntities(JDBCStoreManager.java:579) at org.jboss.ejb.plugins.CMPPersistenceManager.findEntities(CMPPersistenceManager.java:311) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntities(CachedConnectionInterceptor.java:322) at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:613)
Can anybody help me or is this a JBoss bug, is there a workaround?