cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: DeleteQuery exception
Date Wed, 27 Feb 2008 12:05:11 GMT
Yeah, that's a limitation of DeleteQuery (which btw is deprecated in  
3.0, replaced with EJBQLQuery). It is mapped to a single table SQL  
delete statement and does not support joins. In 2.0 your alternative  
is SQLTemplate. In 3.0 - SQLTemplate and EJBQLQuery (that would allow  
to use subqueries in the WHERE clause, but still no joins).

Andrus


On Feb 27, 2008, at 11:56 AM, Dave Merrin wrote:

> Hi,
>
> I'm trying to delete records from a database table based on some  
> info in another related table. Unfortunately I'm getting an  
> exception when using the DeleteQuery. Has this been fixed or is  
> there any other way to delete like this?
>
> java.lang.RuntimeException: db relationships not supported
>       at  
> org 
> .apache 
> .cayenne 
> .access 
> .trans.DeleteTranslator.dbRelationshipAdded(DeleteTranslator.java:37)
>      at  
> org 
> .apache 
> .cayenne 
> .access 
> .trans.QueryAssemblerHelper.appendObjPath(QueryAssemblerHelper.java: 
> 103)
>       at  
> org 
> .apache 
> .cayenne 
> .access 
> .trans.QualifierTranslator.objectNode(QualifierTranslator.java:339)
>       at org.apache.cayenne.exp.Expression.traverse(Expression.java: 
> 514)
>       at org.apache.cayenne.exp.Expression.traverse(Expression.java: 
> 511)
>       at org.apache.cayenne.exp.Expression.traverse(Expression.java: 
> 491)
>       at  
> org 
> .apache 
> .cayenne 
> .access 
> .trans.QualifierTranslator.doTranslation(QualifierTranslator.java:74)
>       at  
> org 
> .apache 
> .cayenne 
> .access.trans.DeleteTranslator.createSqlString(DeleteTranslator.java: 
> 51)
>       at  
> org 
> .apache 
> .cayenne 
> .access.trans.QueryAssembler.createStatement(QueryAssembler.java:95)
>       at  
> org 
> .apache 
> .cayenne.access.jdbc.UpdateAction.performAction(UpdateAction.java:91)
>       at  
> org 
> .apache 
> .cayenne 
> .access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:59)
>       at  
> org.apache.cayenne.access.DataNode.performQueries(DataNode.java:273)
>       at  
> org 
> .apache 
> .cayenne 
> .access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:319)
>       at org.apache.cayenne.access.DataDomainQueryAction.access 
> $000(DataDomainQueryAction.java:60)
>       at org.apache.cayenne.access.DataDomainQueryAction 
> $1.transform(DataDomainQueryAction.java:291)
>       at  
> org 
> .apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java: 
> 820)
>       at  
> org 
> .apache 
> .cayenne 
> .access 
> .DataDomainQueryAction 
> .runQueryInTransaction(DataDomainQueryAction.java:288)
>       at  
> org 
> .apache 
> .cayenne 
> .access.DataDomainQueryAction.execute(DataDomainQueryAction.java:109)
>       at  
> org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:730)
>       at  
> org 
> .apache 
> .cayenne 
> .util 
> .ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:217)
>       at  
> org 
> .apache 
> .cayenne 
> .access.DataContextQueryAction.execute(DataContextQueryAction.java:54)
>       at  
> org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1386)
>       at  
> org 
> .apache 
> .cayenne.access.DataContext.performGenericQuery(DataContext.java:1341)
>       at  
> org 
> .apache 
> .cayenne 
> .access.DataContext.performNonSelectingQuery(DataContext.java:1396)
>       at  
> ipa 
> .printexpress 
> .datahelpers.Session.deleteEntityCollection(Session.java:172)
>       at  
> ipa 
> .px 
> .tracker 
> .trackerserver 
> .purge.PurgeDatabaseHelper.purgeElements(PurgeDatabaseHelper.java:63)
>       at  
> ipa 
> .px 
> .tracker 
> .trackerserver 
> .purge.PurgeDatabaseHelper.purge(PurgeDatabaseHelper.java:476)
>       at  
> ipa 
> .px 
> .tracker 
> .trackerserver.remoteobjects.Purger.purgeEditions(Purger.java:94)
>       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:597)
>       at  
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>       at sun.rmi.transport.Transport$1.run(Transport.java:159)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>       at  
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java: 
> 535)
>       at sun.rmi.transport.tcp.TCPTransport 
> $ConnectionHandler.run0(TCPTransport.java:790)
>       at sun.rmi.transport.tcp.TCPTransport 
> $ConnectionHandler.run(TCPTransport.java:649)
>       at java.util.concurrent.ThreadPoolExecutor 
> $Worker.runTask(ThreadPoolExecutor.java:885)
>       at java.util.concurrent.ThreadPoolExecutor 
> $Worker.run(ThreadPoolExecutor.java:907)
>       at java.lang.Thread.run(Thread.java:619)
>
> BTW. I'm using Cayenne version 2 (not sure which exact version but  
> can find out if required).
>
> Cheers,
>
> Dave
>


Mime
View raw message