Question

What is your opinion on iBatis / MyBatis? With respect to performance and flexibility.

How do you think it stacks up against other C# ORMs?

Is the C# version pretty stable and usable? Does caching work well?

Was it helpful?

Solution

I really like mybatis, but even so, there are a few bugs that I've seen.

For instance, when we implemented a paging solution, we had to write an interceptor that told mybatis to STOP CACHING STUFF because it saw the record, and a rowcount, and for some reason created a "cache key" that just used the presence of the record (not even doing an "equals" call on it) and the rowcount which matched the next record and rowcount (though it was a different record and if equals was invoked, it wouldn't have matched). Later we included the rownum to get around another similar issue. The interceptor actually had to introspect (yuck!) via breaking access with reflection in order to see if the handler was our own handler, because there was no getter for the field and it was private.

Secondly, I've seen mybatis construct an object to return, but everything was null, so it simply returned null instead of the record that it constructed - this is a serious bug. We got around that because the thing that we were returning was versioned, so the version wasn't null, so we returned that and hence the record was returned.

Furthermore, some of the methods that you'd expect to be implemented via the typesafe handlers actually are not implemented at all. Be careful with those.

We use the spring integration, but it really just wraps the SqlSession to autoclose - the underlying issues are from Mybatis code. Java-based experience I'm noting about here.

Also, even though there are "batch" statement things, I haven't seen anything in the API that indicates you can really do batch statements - so if you need that sort of functionality, you'll have to use something else or just go one by one.

OTHER TIPS

I'm loving mybatis, we recently began writing new services with mybatis 3.0.4, upgrading from iBatis 2.x.

I feel like mybatis has so many more tools to make development easier, the type safety, the broad annotation capabilities, no more hash maps when passing multiple parameters (@param tag), in my opinion are worth the upgrade alone. I've only mentioned a few of the new good things.

On the Java side the guice integration is a gift.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top