Load relation failed; CausedByException is:
w__y__f May 11, 2003 11:00 AMI have two tables, created by the statements below.
CREATE TABLE mvdc_customer(
customer_id INT NOT NULL,
name VARCHAR(30) NOT NULL,
pword VARCHAR(30) NOT NULL,
PRIMARY KEY (customer_id)
) TYPE=INNODB;
CREATE TABLE customer_details(
pk_id INT NOT NULL,
fk_customer_id INT NOT NULL,
customer_id INT NOT NULL,
email_address VARCHAR(50) NOT NULL,
PRIMARY KEY (fk_customer_id,pk_id),
FOREIGN KEY (fk_customer_id) REFERENCES mvdc_customer (customer_id) ON DELETE CASCADE
) TYPE=INNODB;
I created 2 entity beans accroding to the 2 tables. and the jbosscmp_jdbc.xml file just like this.
<?xml version="1.0" encoding="UTF-8"?>
<jbosscmp-jdbc>
<enterprise-beans>
<ejb-name>MvdcCustomer</ejb-name>
<table-name>mvdc_customer</table-name>
<ejb-designer-id>MvdcCustomer</ejb-designer-id>
java:/MySqlDS
<datasource-mapping>mySQL</datasource-mapping>
<cmp-field>
<field-name>customerId</field-name>
<column-name>customer_id</column-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
<column-name>name</column-name>
</cmp-field>
<cmp-field>
<field-name>pword</field-name>
<column-name>pword</column-name>
</cmp-field>
<ejb-name>CustomerDetails</ejb-name>
<table-name>customer_details</table-name>
<ejb-designer-id>CustomerDetails</ejb-designer-id>
java:/MySqlDS
<datasource-mapping>mySQL</datasource-mapping>
<cmp-field>
<field-name>pkId</field-name>
<column-name>pk_id</column-name>
</cmp-field>
<cmp-field>
<field-name>fkCustomerId</field-name>
<column-name>fk_customer_id</column-name>
</cmp-field>
<cmp-field>
<field-name>customerId</field-name>
<column-name>customer_id</column-name>
</cmp-field>
<cmp-field>
<field-name>emailAddress</field-name>
<column-name>email_address</column-name>
</cmp-field>
</enterprise-beans>
<ejb-relation>
<ejb-relation-name>mvdcCustomer-customerDetails</ejb-relation-name>
<foreign-key-mapping />
<ejb-relationship-role>
<ejb-relationship-role-name>MvdcCustomerRelationshipRole</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>customerId</field-name>
<column-name>customer_id</column-name>
</key-field>
</key-fields>
<ejb-designer-id>MvdcCustomer</ejb-designer-id>
java:/MySqlDS
<datasource-mapping>mySQL</datasource-mapping>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>CustomerDetailsRelationshipRole</ejb-relationship-role-name>
</ejb-relationship-role>
</ejb-relation>
</jbosscmp-jdbc>
but when I call the entity beans,the system got the error below:
2003-05-12 00:15:39,748 ERROR [STDERR] javax.ejb.TransactionRolledbackLocalException: Load relation failed; CausedByException is:
Table not found: CUSTOMER_DETAILS in statement [SELECT pk_id, fk_customer_id FROM Customer_details WHERE (customer_id=1)]; CausedByException is:
Load relation failed; CausedByException is:
Table not found: CUSTOMER_DETAILS in statement [SELECT pk_id, fk_customer_id FROM Customer_details WHERE (customer_id=1)]
2003-05-12 00:15:39,758 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:224)
I don't know why,because the table customer_details is obviously here. Anyone give me a idea? thx a lot.