2012-07-05 47 views
2

我使用OpenJPA的2.1.2的WebSphere Application Server 8 首先我用:OpenJPA的持久性異常:負值不允許提取大小

<property name="openjpa.ConnectionUserName" value="xxx" /> 
<property name="openjpa.ConnectionPassword" value="yyyy" /> 
<property name="openjpa.ConnectionURL" value="zzz"> 

來定義XML持久性我的數據庫連接。

現在我改變了這一點,並使用了我在WebSphere Applicaiton Server管理控制檯中定義的數據源。

我卸下了添加

<jta-data-source>java:comp/env/jdbc/name/mysql</jta-data-source> 

這些屬性標記但是現在,當我進行查詢,我得到以下JPA異常:

<openjpa-2.1.2-SNAPSHOT-r422266:1227818 fatal general error> org.apache.openjpa.persistence.PersistenceException: DSRA9500E: Negative values are not allowed for fetch size. 
FailedObject: SELECT u FROM user_table u WHERE lower(u.username) = lower(:name) [java.lang.String] 
     at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4878) 
     at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4838) 
     at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136) 
     at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:118) 
     at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:70) 
     at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheckedException(SelectResultObjectProvider.java:155) 
     at org.apache.openjpa.datacache.QueryCacheStoreQuery$CachingResultObjectProvider.handleCheckedException(QueryCacheStoreQuery.java:701) 
     at org.apache.openjpa.lib.rop.WindowResultList.<init>(WindowResultList.java:64) 
     at org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl.newResultList(JDBCFetchConfigurationImpl.java:292) 
     at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1251) 
     at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1007) 
     at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863) 
     at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794) 
     at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542) 
     at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:315) 
     at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:331) 
     at gui.jpa.service.JPAQueries.getUser(JPAQueries.java:196) 
     at security.ContentAuthorisation.authorisedForAcess(ContentAuthorisation.java:10) 
     at web.app.auth.RequestFilter.doFilter(RequestFilter.java:31) 
     at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192) 
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89) 
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:926) 
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1023) 
     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3703) 
     at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) 
     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962) 
     at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) 
     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) 
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) 
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) 
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) 
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276) 
     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) 
     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnecti  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnecti 
onInitialReadCallback.java:113) 
     at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) 
     at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
     at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205) 
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659) 
Caused by: java.sql.SQLDataException: DSRA9500E: Negative values are not allowed for fetch size. 
     at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.setFetchSize(WSJdbcStatement.java:1935) 
     at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.setFetchSize(DelegatingPreparedStatement.java:242) 
     at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.setFetchSize(DelegatingPreparedStatement.java:242) 
     at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:568) 
     at org.apache.openjpa.jdbc.sql.SelectImpl.prepareStatement(SelectImpl.java:481) 
     at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:418) 
     at com.ibm.ws.persistence.jdbc.sql.SelectImpl.execute(SelectImpl.java:89) 
     at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:391) 
     at org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:427) 
     at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:230) 
     at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:220) 
     at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94) 
     at org.apache.openjpa.datacache.QueryCacheStoreQuery$CachingResultObjectProvider.open(QueryCacheStoreQuery.java:644) 
     at org.apache.openjpa.lib.rop.WindowResultList.<init>(WindowResultList.java:57) 
     ... 32 more 

爲什麼我得到這個例外?

最好的問候,Veote

回答

2

嘗試正確openjpa.DBDictionary property添加到您的persistence.xml文件。

我懷疑以前在指定openjpa.ConnectionURL時,JPA會使用該URL來確定您正在使用的數據庫類型。在您的SystemOut.log中搜索帶有前綴CWWJP ...的消息,該消息提到了一些關於不知道正在使用的數據庫類型的信息。

+0

不錯,這個屬性不見了。現在它工作正常!謝謝 – veote

相關問題