Topic: JBoss CMP 的问题:

  Print this page

1.JBoss CMP 的问题: Copy to clipboard
Posted by: jianhua23
Posted on: 2003-04-28 11:45

我发现一个关于 JBoss CMP 的问题:
环境是: JBoss 3.0.4 JBuilder 7 和 MySQL
我创建了相应的 DataSource:
<jndi-name>Engines</jndi-name>
<connection-url>jdbc:mysql://127.0.0.1/engines</connection-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<user-name>root</user-name>
<password>8888</password>
在 JBuilder Database Pilot 下运行的过,在 JBuilder 下创建相应的 CMP。
表为 ACL:
---------------------------------------------------------
<jbosscmp-jdbc>
  <default></default>
<enterprise-beans>
<entity>
<ejb-name>Acl</ejb-name>
<table-name>acl</table-name>
<cmp-field>
<field-name>id</field-name>
<column-name>ID</column-name>
</cmp-field>
<cmp-field>
<field-name>assetcode</field-name>
<column-name>ASSETCODE</column-name>
</cmp-field>
<cmp-field>
<field-name>type</field-name>
<column-name>TYPE</column-name>
</cmp-field>
<cmp-field>
<field-name>description</field-name>
<column-name>DESCRIPTION</column-name>
</cmp-field>
<cmp-field>
<field-name>objId</field-name>
<column-name>OBJ_ID</column-name>
</cmp-field>
</entity>
</enterprise-beans>
</jbosscmp-jdbc>
---------------------------------------------------------
CMP 直接公开他的 Remote Method.
创建 FindAll() 方法:
在客户端调试打印
---------------------------------------------------------
public static void main(String[] args) {
AclTestClient client = new AclTestClient();
// client.create(new Integer(3));
System.out.println(client.findAll().size());
---------------------------------------------------------
打印出的值为 0.单一当你先创建(调用 create() 方法)后,findAll()既有相应的值。
怀疑是程序根本没有连上数据库,但是 JNDI 名称是准确的。
是否在jbosscmp-jdbc.xml 中需要配置相应的 <default></default> 属性,如何配置。
---------------------------------------------------------
<jndi-definitions>
<visitransact-datasource>
<jndi-name>serial://datasources/Engines</jndi-name>
<driver-datasource-jndiname>serial://datasources/driverEngines</driver-datasource-jndiname>
<property>
<prop-name>connectionType</prop-name>
<prop-type>Enumerated</prop-type>
<prop-value>Direct</prop-value>
</property>
<property>
<prop-name>dialect</prop-name>
<prop-type>Enumerated</prop-type>
<prop-value>none</prop-value>
</property>
</visitransact-datasource>
<driver-datasource>
<jndi-name>serial://datasources/driverEngines</jndi-name>
<datasource-class-name>com.inprise.visitransact.jdbc1w2.InpriseConnectionPoolDataSource</datasource-class-name>
<property>
<prop-name>user</prop-name>
<prop-type>String</prop-type>
<prop-value>root</prop-value>
</property>
<property>
<prop-name>password</prop-name>
<prop-type>String</prop-type>
<prop-value>8888</prop-value>
</property>
<property>
<prop-name>url</prop-name>
<prop-type>String</prop-type>
<prop-value>jdbc:mysql://127.0.0.1/engines</prop-value>
</property>
<property>
<prop-name>driverClassName</prop-name>
<prop-type>String</prop-type>
<prop-value>org.gjt.mm.mysql.Driver</prop-value>
</property>
</driver-datasource>
</jndi-definitions>
---------------------------------------------------------
哎,困扰我好长时间了!!!

2.Re:JBoss CMP 的问题: [Re: jianhua23] Copy to clipboard
Posted by: jianhua23
Posted on: 2003-04-29 09:12

我自己已经解决了 Smile

3.Re:JBoss CMP 的问题: [Re: jianhua23] Copy to clipboard
Posted by: jackzhuo
Posted on: 2003-05-13 15:41

怎么解决的讲一讲嘛!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923