Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Translated SQL is null(getTranslatedSQL from DescriptorEvent returns null)
Translated SQL is null [message #1713109] Sat, 31 October 2015 08:44
Cobus Stroebel is currently offline Cobus StroebelFriend
Messages: 1
Registered: October 2015
Junior Member
I have a class that extends DescriptorEventAdapter and implements SessionCustomizer and DescriptorCustomizer.

I have override the postWrite and postDelete methods to obtain the SQL statements and store them into a separate database. On some of the objects that gets stored, the SQL returned is null, but the object was inserted.

How can I ensure that the SQL string is always returned?

public class SQLLogger extends DescriptorEventAdapter implements SessionCustomizer, DescriptorCustomizer {

    @Override
    public void customize(ClassDescriptor descriptor) throws Exception {
        descriptor.getEventManager().addListener(this);
    }

    @Override
    public void customize(Session session) throws Exception {
        for (ClassDescriptor descriptor : session.getDescriptors().values()) {
            customize(descriptor);
        }
    }

    @Override
    public void postWrite(DescriptorEvent event) {
        processDescriptorEvent(event);
    }

    @Override
    public void postDelete(DescriptorEvent event) {
        processDescriptorEvent(event);
    }

    protected void processDescriptorEvent(DescriptorEvent descriptorEvent) {
        String sql = descriptorEvent.getQuery().getTranslatedSQLString(descriptorEvent.getSession(), descriptorEvent.getQuery().getTranslationRow());
    //store sql into auditing database
}
Previous Topic:count queries with specification
Next Topic:"Transaction cannot proceed STATUS_COMMITTED" while leaving EJB container
Goto Forum:
  


Current Time: Thu Feb 25 09:14:57 GMT 2021

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

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

Back to the top