I found the solution.

Thank you, beffe, for pointing me to the CMP documentation.  Actually, the 
error was not in that part of my code, it was something much simpler and 
stupider.  (The reason my error was stupid is because I wasn't paying full 
attention when this error first happened.  I'm lazy.)

Unfortunately, O'Reilly's Enterprise JavaBeans is not well organized, and not 
everything involving CMR is under the CMR chapter, some of it is in Section 
6.5.  In there, a very subtle thing is implied, but not stated...  I'm 
frustrated with the book.

The solution is: Even though CMR is part of CMP, you do *not* create a 
<cmp-field> entry for each <cmr-field> in the  section.

This is my new ejb-jar.xml.  Notice the commented-out line in 
OptimizationStaticParameter:
<?xml version="1.0" encoding="UTF-8" ?>
  | <ejb-jar
  |             xmlns="http://java.sun.com/xml/ns/j2ee";
  |             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  |             
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd";
  |             version="2.1">
  |     <enterprise-beans>
  | 
  |             <entity>
  |                     <ejb-name>OptimizationEJB</ejb-name>
  |                     
<local-home>com.flytrading.trading.ejb.OptimizationHomeLocal</local-home>
  |                     
<local>com.flytrading.trading.ejb.OptimizationLocal</local>
  |                     
<ejb-class>com.flytrading.trading.ejb.OptimizationBean</ejb-class>
  |                     <persistence-type>Container</persistence-type>
  |                     <prim-key-class>java.lang.Object</prim-key-class>
  |                     <reentrant>False</reentrant>
  |                     
<abstract-schema-name>Optimization</abstract-schema-name>
  |                     <cmp-field><field-name>name</field-name></cmp-field>
  |                     
<cmp-field><field-name>timestamp</field-name></cmp-field>
  |                     <cmp-field><field-name>comment</field-name></cmp-field>
  |                     
<security-identity><use-caller-identity/></security-identity>
  |             </entity>
  |             <entity>
  |                     <ejb-name>OptimizationStaticParameterEJB</ejb-name>
  |                     
<local-home>com.flytrading.trading.ejb.OptimizationStaticParameterHomeLocal</local-home>
  |                     
<local>com.flytrading.trading.ejb.OptimizationStaticParameterLocal</local>
  |                     
<ejb-class>com.flytrading.trading.ejb.OptimizationStaticParameterBean</ejb-class>
  |                     <persistence-type>Container</persistence-type>
  |                     <prim-key-class>java.lang.Object</prim-key-class>
  |                     <reentrant>False</reentrant>
  |                     
<abstract-schema-name>OptimizationStaticParameter</abstract-schema-name>
  |                     
<cmp-field><field-name>parameterName</field-name></cmp-field>
  |                     <cmp-field><field-name>value</field-name></cmp-field>
  | <!--                
<cmp-field><field-name>optimization</field-name></cmp-field> -->
  |                     
<security-identity><use-caller-identity/></security-identity>
  |                     <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>
  | 
  |             </entity>
  |     </enterprise-beans>
  |             
  |     <relationships>
  |             <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>
  | 
  |     </relationships>
  |     
  |     <assembly-descriptor>
  |             <security-role>
  |                     <role-name>everyone</role-name>
  |                     <description>
  |                             This role represents everyone who is allowed 
full access to the system.
  |                     </description>
  |             </security-role>
  |             
  |             <method-permission>
  |                     <role-name>everyone</role-name>
  |                     <method>
  |                             <ejb-name>OptimizationEJB</ejb-name>
  |                             <method-name>*</method-name>
  |                     </method>
  |                     <method>
  |                             
<ejb-name>OptimizationStaticParameterEJB</ejb-name>
  |                             <method-name>*</method-name>
  |                     </method>
  |             </method-permission>
  | 
  |             <container-transaction>
  |                     <method>
  |                             <ejb-name>OptimizationEJB</ejb-name>
  |                             <method-name>*</method-name>
  |                     </method>
  |                     <method>
  |                             
<ejb-name>OptimizationStaticParameterEJB</ejb-name>
  |                             <method-name>*</method-name>
  |                     </method>
  |                     <trans-attribute>Required</trans-attribute>
  |             </container-transaction>
  |                             
  |     </assembly-descriptor>          
  |     
  | </ejb-jar>  

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

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


-------------------------------------------------------
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
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to