Search in sources :

Example 1 with DeleteVisitor

use of org.teiid.translator.coherence.visitor.DeleteVisitor in project teiid by teiid.

the class CoherenceUpdateExecution method executeDelete.

private void executeDelete() throws TranslatorException {
    DeleteVisitor visitor = new DeleteVisitor(metadata);
    visitor.visitNode((Delete) command);
    if (visitor.getException() != null) {
        throw visitor.getException();
    }
    if (visitor.getKeys() == null || visitor.getKeys().isEmpty()) {
        // $NON-NLS-1$
        final String msg = CoherencePlugin.Util.getString("CoherenceUpdateExecution.objectNotDeleted", new Object[] { visitor.getTableName() });
        throw new TranslatorException(msg);
    }
    for (java.util.Iterator it = visitor.getKeys().iterator(); it.hasNext(); ) {
        Object key = it.next();
        try {
            this.connection.remove(key);
        } catch (ResourceException e) {
            throw new TranslatorException(e);
        }
    }
}
Also used : TranslatorException(org.teiid.translator.TranslatorException) ResourceException(javax.resource.ResourceException) DeleteVisitor(org.teiid.translator.coherence.visitor.DeleteVisitor)

Aggregations

ResourceException (javax.resource.ResourceException)1 TranslatorException (org.teiid.translator.TranslatorException)1 DeleteVisitor (org.teiid.translator.coherence.visitor.DeleteVisitor)1