我的也是weblogic ,现在在访问ejb时遇到这样的问题: javax.ejb.EJBException: nested exception is: <1.0.0 fatal store error> org.apache.openjpa.persistence.RollbackException: Attempt to update the sequence table "OPENJPA_SEQUENCE_TABLE" failed. The sequence table is typically created when you run the mappingtool's refresh action on any datastore identity class. If you have not run the mappingtool but want to create the sequence table, run: java org.apache.openjpa.jdbc.kernel.TableJDBCSeq -action add 请问你的OPENJPA_SEQUENCE_TABLE表是怎么生成的? 我的配置文件是这样的: <?xml version="1.0"?><persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <!-- ======================================================================= --> <!-- Configure Kodo Persistence Runtime by specifiying database URL, Driver --> <!-- All persistent domain classes are specified here --> <!-- Configured to build database schema, if necessary, at runtime --> <!-- --> <!-- Two different persistence units are specified --> <!-- 1. reviewService : used with RESOURCE_LOCAL transaction --> <!-- 2. reviewSession : used with JTA transaction by Session Beans --> <!-- ======================================================================= --> <persistence-unit name="reviewService" transaction-type="RESOURCE_LOCAL"> <provider> org.apache.openjpa.persistence.PersistenceProviderImpl </provider>
以后oracle还会创建这个表吗?
你先把它删了再起,看还有没有异常,如果没有异常就再重启一次,看看是不是资源清理的问题,如果是JBoss容器就把源码导一下,大概看一下。
我没有用过JPA提供的ID自动生成功能,有些业务场景满足不了,灵活性和性能也不是太好。
不过我还想问一下这个JPA提供的ID自动生成功能是在服务器安装的时候设定的吗?
我用的是weblogic!!
weblogic再你第一次生成Entity的时候要创建那张表,然后插入初始值,为Entity赋值。
java org.apache.openjpa.jdbc.kernel.TableJDBCSeq -action add 请问你的OPENJPA_SEQUENCE_TABLE表是怎么生成的?
我的配置文件是这样的:
<?xml version="1.0"?><persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0"> <!-- ======================================================================= -->
<!-- Configure Kodo Persistence Runtime by specifiying database URL, Driver -->
<!-- All persistent domain classes are specified here -->
<!-- Configured to build database schema, if necessary, at runtime -->
<!-- -->
<!-- Two different persistence units are specified -->
<!-- 1. reviewService : used with RESOURCE_LOCAL transaction -->
<!-- 2. reviewSession : used with JTA transaction by Session Beans -->
<!-- ======================================================================= -->
<persistence-unit name="reviewService"
transaction-type="RESOURCE_LOCAL"> <provider>
org.apache.openjpa.persistence.PersistenceProviderImpl
</provider>
<non-jta-data-source>oracle</non-jta-data-source>
<class>domain.Book</class>
<properties>
<property name="kodo.jdbc.SynchronizeMappings"
value="buildSchema" />
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema" />
<property name="openjpa.ConnectionDriverName"
value="com.mysql.jdbc.Driver"/>
<property name="openjpa.ConnectionURL"
value="jdbc:mysql://localhost:3306/db"/>
<property name="openjpa.ConnectionUserName" value="sa"></property> <property name="openjpa.ConnectionPassword" value=""></property>
<!--refresh -->
</properties>
</persistence-unit></persistence>
请问我作的有错误的地方吗?谢谢!!