注意一点的是,如果使用JBoss OpenTools,让JBoss和JBuilder进行整合的话
jbosscmp-jdbc.xml是由OpenTools自动生成的,修改过后,OpenTools有可能覆盖你的修改.
所以要注意.
jbosscmp-jdbc.xml源代码:
[CODE]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC '-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN' 'http://www.jboss.org/j2ee/dtd/_3_0.dtd'>
<!--
Generated by JBoss OpenTool 2.5 for JBoss Server 3.x
** DO NOT MAKE MANUAL MODIFICATIONS TO THIS FILE **
This deployment descriptor will be regenerated every time changes are made in the EJB designer.
Note: See opentool usage notes in jboss.xml.
- For those of you running into this problem for one-to-many relationships:
org.jboss.deployment.DeploymentException:
Role: ______ with multiplicity many using foreign-key mapping
is not allowed to have key-fields
verify that the 'many' table has a foreign key to the primary key in
the 'one' table and not the other way around, as may happen if you let
JBuilder generate the schema from the Beans, or if you do this
incorrectly yourself
-->
<jbosscmp-jdbc>
<enterprise-beans>
<entity>
<ejb-name>Fungus</ejb-name>
<cmp-field>
<field-name>formalName</field-name>
</cmp-field>
<cmp-field>
<field-name>chineseAlias</field-name>
</cmp-field>
<cmp-field>
<field-name>classification</field-name>
</cmp-field>
<cmp-field>
<field-name>feature</field-name>
</cmp-field>
<cmp-field>
<field-name>biology</field-name>
</cmp-field>
<cmp-field>
<field-name>season</field-name>
</cmp-field>
<cmp-field>
<field-name>plantingTech</field-name>
</cmp-field>
<cmp-field>
<field-name>latinName</field-name>
</cmp-field>
<cmp-field>
<field-name>usages</field-name>
</cmp-field>
<query>
<query-method>
<method-name>findByUsagesLike</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<jboss-ql>
SELECT OBJECT(f) FROM Fungus f WHERE f.usages LIKE ?1
</jboss-ql>
</query>
</entity>
</enterprise-beans>
</jbosscmp-jdbc>
[/CODE]
看JBoss的书吧,这个书上的例子