Cannot find FactoryHelper / ProxyFactory in source

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot find FactoryHelper / ProxyFactory in source

Ryan Griffith
I'm a bit new to Java, but have used .Net since it was introduced in the early 2000's. I'm still learning about how things are done in Java and I think one of those aspects is eluding me at the moment.

For context, I'm using MyBatis v3.4.6 with Spring MVC. I have a MyBatis entity with lazy-loaded associations so my class ends up being a Proxy class. I'm looking to determine the super class of that class (basically I'm looking for my actual entity class type not the proxy class type).

I used javassist.util.proxy.ProxyFactory.isProxyClass(this.getClass()) which returned false despite my class actually being a Proxy class.

I then found org.apache.ibatis.javassist.util.proxy.ProxyFactory. When calling ProxyFactory.isProxyClass() from this class, I get an appropriate true response.

Now,  because I'm interested in how all this works, I looked for this class in my MyBatis repository at this version, 3.4.6. I cannot find any reference to this ProxyFactory class nor can I find a reference to the FactoryHelper class. I also noticed that these classes look to mimic the classes of the same name in the javassist.util.proxy package.

Is there some way in java to have a package (javassist) masquerade within another package (org.apache.ibatis.javassis)? What am I missing here?




--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/d260013b-283a-49e5-b5db-58ea1859d5a1n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot find FactoryHelper / ProxyFactory in source

Iwao AVE!
Hello Ryan,

We use maven-shade-plugin [1] to include Javassist (and OGNL) source when building the binary (i.e. mybatis-x.x.x.jar).
For how or why, this answer may be informative.

If you want to use ProxyFactory or FactoryHelper in your code, you should add Javassist to your project's dependencies and use (=import) the classes in `javassist` package instead of the ones in `org.apache.ibatis.javassist` package.


Regards,
Iwao


On Thu, Sep 17, 2020 at 12:38 AM Ryan Griffith <[hidden email]> wrote:
I'm a bit new to Java, but have used .Net since it was introduced in the early 2000's. I'm still learning about how things are done in Java and I think one of those aspects is eluding me at the moment.

For context, I'm using MyBatis v3.4.6 with Spring MVC. I have a MyBatis entity with lazy-loaded associations so my class ends up being a Proxy class. I'm looking to determine the super class of that class (basically I'm looking for my actual entity class type not the proxy class type).

I used javassist.util.proxy.ProxyFactory.isProxyClass(this.getClass()) which returned false despite my class actually being a Proxy class.

I then found org.apache.ibatis.javassist.util.proxy.ProxyFactory. When calling ProxyFactory.isProxyClass() from this class, I get an appropriate true response.

Now,  because I'm interested in how all this works, I looked for this class in my MyBatis repository at this version, 3.4.6. I cannot find any reference to this ProxyFactory class nor can I find a reference to the FactoryHelper class. I also noticed that these classes look to mimic the classes of the same name in the javassist.util.proxy package.

Is there some way in java to have a package (javassist) masquerade within another package (org.apache.ibatis.javassis)? What am I missing here?




--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/d260013b-283a-49e5-b5db-58ea1859d5a1n%40googlegroups.com.

--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2Qt764nPQMD74EXBHAD2p%3D8kNs8DptRLQpK99O76rk1hg%40mail.gmail.com.