问两个EJB的问题。

本人在Weblogic,MySQL下开发CMP Entity Bean,有以下两个表:
CREATE TABLE ADDRESS (
ID int NOT NULL PRIMARY KEY,
STREET varchar (40) NULL ,
CITY varchar (20) NULL ,
STATE varchar (2) NULL ,
ZIP varchar (10) NULL
);
CREATE TABLE CUSTOMER (
ID int NOT NULL PRIMARY KEY,
LAST_NAME varchar (20) NULL ,
FIRST_NAME varchar (20) NULL ,
ADDRESS_ID int NULL ,
HAS_GOOD_CREDIT int NULL
);

它们之间的对应关系为:
<!-- Automatically generate the value of ID in the database on inserts using sequence table -->
<automatic-key-generation>
<generator-type>NAMED_SEQUENCE_TABLE</generator-type>
<generator-name>ADDRESS_SEQUENCE</generator-name>
<key-cache-size>10</key-cache-size>
</automatic-key-generation>

</weblogic-rdbms-bean>

<weblogic-rdbms-relation>
<relation-name>Customer-Address</relation-name>
<weblogic-relationship-role>
<relationship-role-name>Customer-has-a-Address</relationship-role-name>
<column-map>
<foreign-key-column>ADDRESS_ID</foreign-key-column>
<key-column>ID</key-column>
</column-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>

<relationships>
<ejb-relation>
<ejb-relation-name>Customer-Address</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>
Customer-has-a-Address
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>homeAddress</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>
Address-belongs-to-Customer
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>AddressEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>

出现下面的Exception:

C:\weblogic_examples\ex06_3>java com.titan.clients.Client_63
Creating Customer 1..
Creating AddressDO data object..
Setting Address in Customer 1...
Exception in thread "main" java.rmi.RemoteException: EJB Exception: ; nested exc
eption is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[java.sql.SQLException: Transaction Isolation Levels are not supported.]]
java.sql.SQLException: Transaction Isolation Levels are not supported.
<<no stack trace available>>
--------------- nested within: ------------------
javax.ejb.EJBException
- with nested exception:
[java.sql.SQLException: Transaction Isolation Levels are not supported.]
<<no stack trace available>>
--------------- nested within: ------------------
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[java.sql.SQLException: Transaction Isolation Levels are not supported.]]
<<no stack trace available>>

C:\weblogic_examples\ex06_3>

是不是因为MySQL的原因?

还有,CMP Entity Bean的Local接口主要是用来干什么的?什么时候用?


谢谢!

看来是你应该使用mysql MAX版本

local是2.0规范中的local EJB,相对于remote EJB而言。

to be more specific, set type=innoDB in ddl

谢谢你的意见,不过我这几天有事也没有再进行测试。MySQL数据库的几种类型如TYPE=MyISAM我还真没有仔细的看过有什么不同之处呢。

> to be more specific, set type=innoDB in ddl

TYPE=MyISAM 不支持事务。mysql 最早不打算支持事务,所以库结构用 isam,现在支持事务了,库结构就得变化,但为了保持兼容,还支持 isam 类型的表。