私はこのクエリを作成しました:
Usuario user1=(Usuario) request.getSession().getAttribute("user");
String query1 = "SELECT f FROM Favorito f WHERE f.usuarioBean = 'user1'";
ここで Manager メソッドを呼び出します
List<Favorito> favoritos = managerFavorito.getFavoritoByUser(query1);
Manager メソッドは次のようになります。
public List<Favorito> getFavoritoByUser(String query1) {
EntityManager em = getEntityManager();
List<Favorito> results = null;
try {
Query query = em.createNativeQuery(query1);
results = (List<Favorito>) query.getResultList();
} finally {
em.close();
}
return results;
}
エラー:
org.apache.openjpa.persistence.ArgumentException: Metadata not found for type "class java.lang.String". Class not improved.
完全なエラー:
[25/11/12 0:17:37:538 CET] 0000002b servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Se ha creado una excepción no detectada en uno de los métodos de servicio del servlet servletControl en la aplicación MotorSalesGR83.15. Excepción creada: <openjpa-2.0.2-SNAPSHOT-r422266:1032678 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: No se han encontrado metadatos para el tipo "class java.lang.String". La clase no se ha mejorado.
at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:377)
at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:358)
at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:355)
at org.apache.openjpa.jdbc.meta.strats.RelationStrategies.toDataStoreValue(RelationStrategies.java:88)
at org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.toDataStoreValue(RelationFieldStrategy.java:836)
at org.apache.openjpa.jdbc.meta.FieldMapping.toDataStoreValue(FieldMapping.java:938)
at org.apache.openjpa.jdbc.kernel.exps.PCPath.toDataStoreValue(PCPath.java:844)
at org.apache.openjpa.jdbc.kernel.exps.Lit.calculateValue(Lit.java:109)
at org.apache.openjpa.jdbc.kernel.exps.CompareEqualExpression.appendTo(CompareEqualExpression.java:98)
at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.buildWhere(SelectConstructor.java:298)
at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate(SelectConstructor.java:93)
at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects(JDBCStoreQuery.java:349)
at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:187)
at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:776)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1003)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:861)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:792)
at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:288)
at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
at entities.controller.FavoritoManager.getVehiculoFavorito(FavoritoManager.java:172)
at tiw.servletControl.doPost(servletControl.java:78)
at tiw.servletControl.doGet(servletControl.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
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.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
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.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
何か問題でも?単純な Where を使用して Favorito の行を検索できないと思い始めています。