ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harvey Kim" <cash...@fastmail.fm>
Subject Re: Hibernate 3.2 Native SQL versus iBATIS
Date Wed, 06 Aug 2008 21:52:22 GMT
One thing you may consider ...

I have been happy with ibatis 90% of the time. However, I had no choice
but to convert good chunk of my project from ibatis to JDBC in the past
because of a memory leak issue.  I've posed this question here in the
past but - here is the code that generated the memory leak:

sqlMapClient.queryWithRowHandler("getLargeQuery", queryParameterDto,

handleRow(Object someObject)
  Runtime r = Runtime.getRuntime();
  System.out.println("HANDLE ROW: free memory is: " + r.totalMemory() +
  " : " + r.freeMemory());       
  System.out.println("free memory is: " + r.totalMemory() + " : " +

Literally, this is the whole test code that was creating the memory
leak.  As you can see, there is no other java code that could possibly
be the culprit.  As I noticed the numbers decreasing with each
iteration, I decided to convert it to JDBC.  Bang! memory leak gone!  At
that point, I converted everything to JDBC.  After that, the same query
that was giving me java.lang.outOfMemory every single time disappeared
forever.  These queries are rather involved with 6 to 7 joins and a
"where" clause that would not fit on one page.  It's a shopping cart
application where the user can pick and choose their criteria so the
query can grow indefinitely.

I'm only bringing this up again in the hopes that somebody will look
into the problem so that in the future I can convert it back to ibatis. 
All my other projects do use ibatis as most of the projects at our
company do not require complex queries that returns millions of rows. 
And I've been quite happy with them.

But I've tried everything to fix it within ibatis - everything from
turning off caching (which I understand is the default) to using LRU,
MEMORY, ...  Maybe I just didn't understand how to tune it properly. 
But any explanation would be appreciated.  However, for now, it is fully
converted to JDBC and my customers are happy.


On Wed, 6 Aug 2008 13:48:09 -0700, "Sundar Sankar"
<fatboysuns@gmail.com> said:
> for Hibernate 2, they had something called as hibernate tools(which
> apparently had a eclipse plug-in too) which could generate xmls and bean
> classes. Am not sure if there is an upgraded version for hibernate 3 to
> get
> the annotations in place in the bean class.
> On Wed, Aug 6, 2008 at 1:44 PM, Fidel Viegas <fidel.viegas@gmail.com>
> wrote:
> > On Wed, Aug 6, 2008 at 9:02 PM, Jeff Butler <jeffgbutler@gmail.com> wrote:
> > > If I may interject too...
> > >
> > > You could use ibator to guickly generate a basic iBATIS based CRUD layer
> > and
> > > then just focus on the complex queries.  This can give you some of the
> > > productivity benefits of Hibernate, and still leave you free to code the
> > > complex stuff in an efficient manner.
> >
> > Doesn't Hibernate come with command line tools that allow you to do
> > that as well? I haven't played with Hibernate in a while, but I have
> > the impression that I have seen this somewhere.
> >
> > I am fairly new to iBatis as well, but I prefer it over Hibernate
> > because I use quite a lot of stored procedures, and I love to have the
> > freedom on modifying the SQL for tuning, etc...
> >
> > I have recently purchased the iBatis book and I am actually enjoying it.
> >
> > Fidel.
> >

http://www.fastmail.fm - Same, same, but differentÂ…

View raw message