Newbie: CMP Problems
difranr Mar 29, 2003 11:16 AMFolks, This is somewhat of a newbie question, but for some reason, I can not get my enity beans to map properly to the database table. My deployment descriptors look like the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar >
<![CDATA[No Description.]]>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<![CDATA[Pager bean]]>
<ejb-name>Pager</ejb-name>
com.ronmar.paging.PagerHome
com.ronmar.paging.Pager
<local-home>com.ronmar.paging.PagerLocalHome</local-home>
com.ronmar.paging.PagerLocal
<ejb-class>com.ronmar.paging.PagerSession</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref >
<res-ref-name>Mail</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the markup for those beans.
-->
<!-- Entity Beans -->
<![CDATA[]]>
<ejb-name>ContactInfo</ejb-name>
com.ronmar.paging.ContactInfoHome
com.ronmar.paging.ContactInfo
<local-home>com.ronmar.paging.ContactInfoLocalHome</local-home>
com.ronmar.paging.ContactInfoLocal
<ejb-class>com.ronmar.paging.ContactInfoCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
False
<cmp-version>2.x</cmp-version>
<abstract-schema-name>ContactInfo</abstract-schema-name>
<cmp-field >
<![CDATA[Returns the id]]>
<field-name>id</field-name>
</cmp-field>
<cmp-field >
<![CDATA[Returns the emailAddress]]>
<field-name>emailAddress</field-name>
</cmp-field>
<cmp-field >
<![CDATA[Returns the fromLength]]>
<field-name>fromLength</field-name>
</cmp-field>
<cmp-field >
<![CDATA[Returns the subjectLength]]>
<field-name>subjectLength</field-name>
</cmp-field>
<cmp-field >
<![CDATA[Returns the messageLength]]>
<field-name>messageLength</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
<query-method>
<method-name>findAll</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(o) FROM ContactInfo o]]></ejb-ql>
<![CDATA[email_address is not indexed.]]>
<query-method>
<method-name>findByEmailAddress</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM ContactInfo o WHERE o.emailAddress = ?1]]></ejb-ql>
<![CDATA[from_length is not indexed.]]>
<query-method>
<method-name>findByFromLength</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM ContactInfo o WHERE o.fromLength = ?1]]></ejb-ql>
<![CDATA[subject_length is not indexed.]]>
<query-method>
<method-name>findBySubjectLength</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM ContactInfo o WHERE o.subjectLength = ?1]]></ejb-ql>
<![CDATA[message_length is not indexed.]]>
<query-method>
<method-name>findByMessageLength</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM ContactInfo o WHERE o.messageLength = ?1]]></ejb-ql>
<!-- Write a file named ejb-finders-ContactInfoBean.xml if you want to define extra finders. -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor >
<!--
To add additional assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->
<!-- finder permissions -->
<!-- finder permissions -->
<!-- transactions -->
<container-transaction >
<ejb-name>Pager</ejb-name>
<method-name>*</method-name>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<!-- finder transactions -->
</assembly-descriptor>
<ejb-client-jar>PagingBean.jar</ejb-client-jar>
</ejb-jar>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<unauthenticated-principal>nobody</unauthenticated-principal>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jboss-beans.xml that contains
the , and <message-driven></message-driven>
markup for those beans.
-->
<ejb-name>ContactInfo</ejb-name>
<jndi-name>ContactInfo</jndi-name>
<local-jndi-name>ejb/pager.ContactInfoLocalHome</local-jndi-name>
<ejb-name>Pager</ejb-name>
<jndi-name>ejb/pager/Pager</jndi-name>
<local-jndi-name>ejb/pager/PagerLocal</local-jndi-name>
<resource-ref>
<res-ref-name>Mail</res-ref-name>
<resource-name>java:/Mail</resource-name>
</resource-ref>
</enterprise-beans>
<resource-managers>
</resource-managers>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
<jbosscmp-jdbc>
java:/MySqlDS
<datasource-mapping>mySQL</datasource-mapping>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
that contains the markup for those beans.
-->
<ejb-name>ContactInfo</ejb-name>
<table-name>contact_info</table-name>
<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>
</cmp-field>
<cmp-field>
<field-name>emailAddress</field-name>
<column-name>email_address</column-name>
</cmp-field>
<cmp-field>
<field-name>fromLength</field-name>
<column-name>from_length</column-name>
</cmp-field>
<cmp-field>
<field-name>subjectLength</field-name>
<column-name>subject_length</column-name>
</cmp-field>
<cmp-field>
<field-name>messageLength</field-name>
<column-name>message_length</column-name>
</cmp-field>
<!-- merge point: jbosscmp-jdbc-load-{0}.xml -->
</enterprise-beans>
</jbosscmp-jdbc>