Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update interceptor (plugin) fires for inserts #16

Closed
GoogleCodeExporter opened this issue Mar 17, 2015 · 4 comments
Closed

Update interceptor (plugin) fires for inserts #16

GoogleCodeExporter opened this issue Mar 17, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

Reporter:    Eli Kizhnerman

The iBatis plugin does not seem to be resolving the target methods to
intercept properly. An interceptor that is defined to intercept only
updates is also executed on inserts.

I have the following definition:
@Intercepts({@Signature(
        type=Executor.class,
        method="update",
        args={MappedStatement.class,Object.class})})
public class UpdateInterceptor implements Interceptor {
...
}

In Plugin.invoke you have the following code:

      Set<Method> methods = signatureMap.get(method.getDeclaringClass());
      if (methods != null && methods.contains(method)) {
        return interceptor.intercept(new Invocation(target, method, args));
      }

DefaultSqlSession.insert internally calls an update method:

  public int insert(String statement, Object parameter) {
    return update(statement, parameter);
  }

I suspect that the Method that is being passed to plugin.invoke is actually
the update method and therefore the interceptor is executed. 

Original issue reported on code.google.com by clinton....@gmail.com on 17 May 2010 at 1:39

@GoogleCodeExporter
Copy link
Author

Clinton Begin added a comment - 10/Dec/09 03:58 PM
Executor only has update and query methods. Thus inserts and deletes are also
considered updates. It sounds like to do what you want, we need another 
interception
point, at the session level. You can do so right now with a proxy class between 
the
SqlSession interface and the default implementation.
[ Show » ]
Clinton Begin added a comment - 10/Dec/09 03:58 PM Executor only has update and 
query
methods. Thus inserts and deletes are also considered updates. It sounds like 
to do
what you want, we need another interception point, at the session level. You 
can do
so right now with a proxy class between the SqlSession interface and the default
implementation.

[ Permalink | Delete | « Hide ]
Eli Kizhnerman added a comment - 11/Dec/09 12:28 PM
This is not working the way I expected it but that it is not a bug. I can get 
what I
need from the MappedStatement SqlCommandType.

Original comment by clinton....@gmail.com on 17 May 2010 at 1:39

@GoogleCodeExporter
Copy link
Author

Original comment by clinton....@gmail.com on 17 May 2010 at 3:21

  • Added labels: Type-Feature, Priority-Low, Version-Release3.x, Component-SqlMaps
  • Removed labels: Type-Enhancement, Priority-Medium

@GoogleCodeExporter
Copy link
Author

Original comment by clinton....@gmail.com on 2 Jun 2010 at 4:45

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Seems there are not many people interested in this issue.

Original comment by eduardo.macarron on 10 Mar 2012 at 7:54

  • Changed state: WontFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant