Is there a way not to implement Serializeble for MyBatis domain objects
If I want to map sql to any object in MyBatis then I need to implement Serializable interface. Like this:
public class User implements Serializable {
Otherwise, it throws NotSerializableException when I try to map sql results to this object.
Is there a way to configure MyBatis in such a way that it allows me to have an object that does not implement Serializable?
+3
source to share
1 answer
I found the reason why mybatis needs a serializable object. Usually, when you don't use the <cache /> tag, everything works fine without implementing a serializable interface.
The reason is that mybatis needs to read / write an object through serialization.
This link may help https://mybatis.github.io/mybatis-3/sqlmap-xml.html.
+1
source to share