Hi, All,
I'm a new user in Cayenne and I'm using the latest 1.04b version under Windows XP, JBuilder 8.0 and accessing SQL Server 2000 database. I'm having a trouble when trying o delete some records from the database.
My model is:
Entity:
GrupoEscoteiro =======> CadastroEndereco
n 1
PK: Two columns in One column that uses AUTO_PK_SUPPORT
meangninfull style.
The table "CadastroEndereco" is referenced by another 2 tables ("Almoxarifado" and "Escotista").
In my application, I have a UI that allows to delete one record on "GrupoEscoteiro" table. And after delete that selected record, I ask if the referenced ID of the "CadastroEndereco" table is being referenced by any others records in another relationships and a strangeous error is happening at this moment. See the stack trace at the end. Bellow is a code fragment that I wrote.
Am I doing anything stupid? : ) Can anybody help me?
.... . . . . . .
if (wResultList != null && wResultList.size() > 0) {
GrupoEscoteiro wGESC = (GrupoEscoteiro) wResultList.get(0);
wIdeEndereco = wGESC.getIdeEnderecoFk02();
CadastroEndereco wObj = wGESC.getToCadastroEndereco();
wObj.removeFromGrupoEscoteiroArray(wGESC);
CadastroEndereco wObj2 = tratarEndereco(pSessao,
2,
wIdeEndereco);
ctxt.commitChanges();
}
. . . . . . . .
private CadastroEndereco tratarEndereco(HttpSession pSessao,
int pTipoOperacao,
Integer pIdeEndereco) {
DataContext ctxt = getCayenneDataContext(pSessao);
Expression qual1 = null;
SelectQuery query = null;
List wResultList = null;
List wExpressoes = null;
CadastroEndereco wEndereco = null;
if (pIdeEndereco != null && pIdeEndereco.intValue() != MathUtil.NULL_INT) {
qual1 = ExpressionFactory.binaryDbPathExp(Expression.EQUAL_TO,
"IDE_ENDERECO",
pIdeEndereco);
query = new SelectQuery(CadastroEndereco.class, qual1);
query.setLoggingLevel(Level.WARN);
wResultList = ctxt.performQuery(query);
if (wResultList != null && wResultList.size() > 0) {
wEndereco = (CadastroEndereco) wResultList.get(0);
}
}
if ( (wEndereco.getGrupoEscoteiroArray() == null || wEndereco.getGrupoEscoteiroArray().size() == 0) &&
(wEndereco.getAlmoxarifadoArray() == null || wEndereco.getAlmoxarifadoArray().size() == 0) &&
(wEndereco.getEscotistaArray() == null || wEndereco.getEscotistaArray().size() == 0)
) {
ctxt.deleteObject(wEndereco);
wEndereco = null;
}
}
return wEndereco;
}
}
--------------------------------------------------------------------------------
StackTrace:
WARN DefaultOperationObserver: Query exception: org.objectstyle.cayenne.query.SelectQuery
java.lang.NullPointerException
at org.objectstyle.cayenne.access.trans.QueryAssemblerHelper.processColumn(QueryAssemblerHelper.java:208)
at org.objectstyle.cayenne.access.trans.QualifierTranslator.appendObjectMatch(QualifierTranslator.java:184)
at org.objectstyle.cayenne.access.trans.QualifierTranslator.endBinaryNode(QualifierTranslator.java:337)
at org.objectstyle.cayenne.exp.ExpressionTraversal.traverseExpression(ExpressionTraversal.java:129)
at org.objectstyle.cayenne.exp.ExpressionTraversal.traverseExpression(ExpressionTraversal.java:84)
at org.objectstyle.cayenne.access.trans.QualifierTranslator.doTranslation(QualifierTranslator.java:116)
at org.objectstyle.cayenne.access.trans.SelectTranslator.createSqlString(SelectTranslator.java:133)
at org.objectstyle.cayenne.access.trans.QueryAssembler.createStatement(QueryAssembler.java:134)
at org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:375)
at org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:279)
at org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:473)
at org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:831)
at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:888)
at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:760)
at org.objectstyle.cayenne.access.util.RelationshipDataSource.updateListData(RelationshipDataSource.java:97)
at org.objectstyle.cayenne.access.ToManyList.getObjectList(ToManyList.java:113)
at org.objectstyle.cayenne.access.ToManyList.size(ToManyList.java:232)
at br.org.scout23.controladores.controladorconfiguracaogeral.ControladorConfiguracaoGeral.tratarEndereco(ControladorConfiguracaoGeral.java:394)
at br.org.scout23.controladores.controladorconfiguracaogeral.ControladorConfiguracaoGeral.excluirGrupoEscoteiro(ControladorConfiguracaoGeral.java:312)
at br.org.scout23.appclients.struts.actions.GerenteGrupoEscoteiroAction.excluirRegistro(GerenteGrupoEscoteiroAction.java:143)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:220)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
WARN DefaultOperationObserver: global exception
org.objectstyle.cayenne.CayenneRuntimeException: [v.1.0b4 June 16 2003] Query exception.
at org.objectstyle.cayenne.access.util.SelectObserver.nextQueryException(SelectObserver.java:146)
at org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:301)
at org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:473)
at org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:831)
at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:888)
at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:760)
at org.objectstyle.cayenne.access.util.RelationshipDataSource.updateListData(RelationshipDataSource.java:97)
at org.objectstyle.cayenne.access.ToManyList.getObjectList(ToManyList.java:113)
at org.objectstyle.cayenne.access.ToManyList.size(ToManyList.java:232)
at br.org.scout23.controladores.controladorconfiguracaogeral.ControladorConfiguracaoGeral.tratarEndereco(ControladorConfiguracaoGeral.java:394)
at br.org.scout23.controladores.controladorconfiguracaogeral.ControladorConfiguracaoGeral.excluirGrupoEscoteiro(ControladorConfiguracaoGeral.java:312)
at br.org.scout23.appclients.struts.actions.GerenteGrupoEscoteiroAction.excluirRegistro(GerenteGrupoEscoteiroAction.java:143)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:220)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NullPointerException
at org.objectstyle.cayenne.access.trans.QueryAssemblerHelper.processColumn(QueryAssemblerHelper.java:208)
at org.objectstyle.cayenne.access.trans.QualifierTranslator.appendObjectMatch(QualifierTranslator.java:184)
at org.objectstyle.cayenne.access.trans.QualifierTranslator.endBinaryNode(QualifierTranslator.java:337)
at org.objectstyle.cayenne.exp.ExpressionTraversal.traverseExpression(ExpressionTraversal.java:129)
at org.objectstyle.cayenne.exp.ExpressionTraversal.traverseExpression(ExpressionTraversal.java:84)
at org.objectstyle.cayenne.access.trans.QualifierTranslator.doTranslation(QualifierTranslator.java:116)
at org.objectstyle.cayenne.access.trans.SelectTranslator.createSqlString(SelectTranslator.java:133)
at org.objectstyle.cayenne.access.trans.QueryAssembler.createStatement(QueryAssembler.java:134)
at org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:375)
at org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:279)
... 50 more
java.sql.SQLException: [v.1.0b4 June 16 2003] Global exception.
This archive was generated by hypermail 2.0.0 : Tue Jul 08 2003 - 18:51:52 EDT