Question about associated query is proxied by who?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Question about associated query is proxied by who?

unknown Mr.
Hi, I have something question about the associated query.

I try to implement hibernate5's criteria query at mybatis,
but I realize there are have a problem when it almost done.

Here is the method signature of 'invoke':

public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable    # method of class MapperProxy

Yep, I override it. And add my condition -> setting an object "Context" in thread local if proxy is instance of my interface
And interceptor will be replace result map if object "Context" has been found.

Here is the code structure:

```
if ( proxy instanceof BasicCrudMapper ) {
// generic query

} else if ( proxy instanceof BasicCriteriaQueryInterface ) {
// criteria query
}

return super.invoke( proxy, method, args );
```

Now, I have a result map like this:

```
<resultMap id="example">
  ...
  <association property="..." column="..." select="childQuery">
</resultMap>

<resultMap id="example2">
  ...
</resultMap>

and some selections like this:

<select id="parentQuery" resultMap="example">
  ...
</select>

<select id="childQuery" resultMap="example2">
  ...
</select>
```

The question is "Are they( parent query and child query ) have the same top interface( 'proxy' is a parameter at method 'invoke' ) when the query executing?".
My goal is find all child query and avoid it, because ResultMap of those queries is good to work and no need to replace it.


--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.