Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Delete Query Redirects in Second time
icon4.gif  Delete Query Redirects in Second time [message #1084254] Sun, 11 August 2013 07:34 Go to next message
Omid Pourhadi is currently offline Omid PourhadiFriend
Messages: 13
Registered: May 2013
Junior Member
I've created a queryredirector on Delete in order to use soft delete but it updates database after being called for second time.

@QueryRedirectors(delete = DeleteRedirector.class)
public class EMPLOYEE {


public class DeleteRedirector implements QueryRedirector
    public Object invokeQuery(DatabaseQuery query, Record arguments, Session session)
        ClassDescriptor descriptor = session.getDescriptor(query.getReferenceClass());
        DeleteObjectQuery deleteObjectQuery = (DeleteObjectQuery) query;
        EMPLOYEE emp = (EMPLOYEE) deleteObjectQuery.getObject();
        UpdateObjectQuery updateObjectQuery = new UpdateObjectQuery(emp);
        descriptor.addDirectQueryKey("status", "STATUS");
        return updateObjectQuery.execute((AbstractSession) session, (AbstractRecord) arguments);        

Am I missing sth ?
Re: Delete Query Redirects in Second time [message #1085875 is a reply to message #1084254] Tue, 13 August 2013 13:38 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

If would set the deleteSQLString is the DescriptorQueryManager to use an update, not use a redirector.

James : Wiki : Book : Blog : Twitter
Previous Topic:JPA selecting, what should be lazy loaded, when not necessary
Next Topic:Log Rotation
Goto Forum:

Current Time: Wed Nov 25 04:20:42 GMT 2015

Powered by FUDForum. Page generated in 0.01636 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software