The datatype for the "optimization" field in OptimizationDynamicParameter and 
OptimizationStaticParameter is OptimizationLocal

I am using relations.  The relation blocks look like:

<ejb-relation>
  |     <ejb-relation-name>Optimization-OptStaticParam</ejb-relation-name>
  |     <ejb-relationship-role>
  |         <ejb-relationship-role-name>
  |             Optimization-may-have-StaticParams
  |         </ejb-relationship-role-name>
  |         <multiplicity>One</multiplicity>
  |         <relationship-role-source>
  |             <ejb-name>OptimizationEJB</ejb-name>
  |         </relationship-role-source>
  |     </ejb-relationship-role>
  |     <ejb-relationship-role>
  |         <ejb-relationship-role-name>
  |             OptStaticParam-belongs-to-Optimization
  |         </ejb-relationship-role-name>
  |         <multiplicity>Many</multiplicity>
  |         <relationship-role-source>
  |             <ejb-name>OptimizationStaticParameterEJB</ejb-name>
  |         </relationship-role-source>
  |             <cmr-field>
  |             <cmr-field-name>optimization</cmr-field-name>
  |         </cmr-field>
  |     </ejb-relationship-role>
  | </ejb-relation>
  | <ejb-relation>
  |     <ejb-relation-name>Optimization-OptDynParam</ejb-relation-name>
  |     <ejb-relationship-role>
  |         <ejb-relationship-role-name>
  |             Optimization-has-DynParams
  |         </ejb-relationship-role-name>
  |         <multiplicity>One</multiplicity>
  |         <relationship-role-source>
  |             <ejb-name>OptimizationEJB</ejb-name>
  |         </relationship-role-source>
  |     </ejb-relationship-role>
  |     <ejb-relationship-role>
  |         <ejb-relationship-role-name>
  |             OptDynParam-belongs-to-Optimization
  |         </ejb-relationship-role-name>
  |         <multiplicity>Many</multiplicity>
  |         <relationship-role-source>
  |             <ejb-name>OptimizationDynamicParameterEJB</ejb-name>
  |         </relationship-role-source>
  |             <cmr-field>
  |             <cmr-field-name>optimization</cmr-field-name>
  |         </cmr-field>
  |     </ejb-relationship-role>
  | </ejb-relation>


All of my EntityBeans have java.lang.Object Primary Keys, because I need JBoss 
to auto-increment all of my keys so that PostgreSQL will index the table for 
speed.

According to O'Reilly's Enterprise JavaBeans, I should be able to use 
EntityBeans as method-params to EJB-QL queries... so I should not have to worry 
about primary keys in ejb-jar.xml


So, I should be able to do EJB-QL like below: 
<query>
  |     <query-method>
  |             <method-name>ejbSelectTest1</method-name>
  |             <method-params>
  |                     
<method-param>com.flytrading.trading.ejb.OptimizationLocal</method-param>
  |             </method-params>
  |     </query-method>
  |     <ejb-ql>
  |             SELECT OBJECT(odp) FROM OptimizationDynamicParameter AS odp
  |                     WHERE odp.optimization = ?1
  |     </ejb-ql>
  | </query>

and it should compile.  At least, everything tells me that should work.


...
Since I have been trying to find different solutions, I have been creating 
ejbSelect queries that *do not* have EntityBeans as method-params, but the 
queries do use the optimization field...  With solutions like:

<query>
  |     <query-method>
  |             <method-name>ejbSelectUnique</method-name>
  |             <method-params>
  |                     <method-param>java.lang.String</method-param>  
  |                     <method-param>java.util.Date</method-param>    
  |                     <method-param>java.lang.String</method-param>  
  |             </method-params>
  |     </query-method>
  |     <ejb-ql>
  |             SELECT OBJECT(osp) FROM OptimizationStaticParameter AS osp
  |                     WHERE osp.optimization.name = ?1
  |                     AND   osp.optimization.timestamp = ?2
  |                     AND   osp.parameterName = ?3
  |     </ejb-ql>
  | </query>

I have been getting errors like:

anonymous wrote : org.jboss.ejb.plugins.cmp.ejbql.UnknownPathException: In path 
field is not a cmr field: at line 2, column 71.  Encountered: "optimization" 
after: "osp."

(The ejb-jar.xml for these entity beans are in my last post).  Does anyone know 
why this is happening?  I declared the CMR relationships in the relationships 
section in ejb-jar.xml, why does it tell me that it is not a CMR field?

Sorry if this is stupid, but everything says this should work.
Thanks for reading.

Chris

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3889351#3889351

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3889351


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to