Forums Register Login

iBatis in Action: Can I persist my POJOs with it?

+Pie Number of slices to send: Send
Welcome to JavaRanch Clinton, Brandon and Larry!

Is iBatis an API which allows me to persist my POJOs to a datasource? If so, do you think it's easier to handle than Entity Beans or Hibernate.

What about the DAO pattern, shall I write a iBatis DAO?

Regards,
Darya
+Pie Number of slices to send: Send
Honestly, I'm not sure what you are asking. But, iBATIS is a tool to interact with a database via a Datasource. iBATIS uses JDBC to pass sql to the database and then translates the returned resultset into Java objects according to the parameters defined by the developer. iBATIS provides caching that can reduce needless hits against the database.
+Pie Number of slices to send: Send
 

If so, do you think it's easier to handle than Entity Beans or Hibernate.



From my little experience with iBatis:
- I find that it is definitely "easier", as in less complex, than Entity Beans 2.x. Hibernate is also "easier", than Entity Beans 2.x.
- I find that iBatis is "easier" than Hibernate. Hibernate tries to shield everything about the DB from the OO programmer. This can be frustrating if you like to write SQL and deal with the DB yourself, having more control etc.

For me, iBatis may be the tool that strikes the right balance between OO and DB, giving you much control over DB stuff like SQL and yet free you from doing low-level JDBC coding.

Having said that, it really depends. If you are not familiar with DB/SQL stuff and want to think in terms of OO programming only, then Hibernate may be "easier" to you/may be more suitable for you.

But then, I am still learning iBatis... What I can say is, I like what I see in iBatis so far.
[ December 05, 2006: Message edited by: Timothy Toe ]
+Pie Number of slices to send: Send
>> Is iBatis an API which allows me to persist my POJOs to a datasource?

Yes. It supports JavaBeans, primitives, collections (Map), and XML.

>> If so, do you think it's easier to handle than Entity Beans or Hibernate.

Absolutely easier than Entity Beans (but what isn't?). And yes it can be easier than Hibernate depending on what your needs are (see iBATIS vs. Hibernate topics in this forum).

>> What about the DAO pattern, shall I write a iBatis DAO?

Sure, you can. iBATIS did include a DAO framework for the first 4 years of its life. Spring also supports iBATIS with it's DAO features. But I'm a fan of either avoiding the DAO pattern or writing a custom abstraction layer for a project.

Cheers,
Clinton
+Pie Number of slices to send: Send
Thanks for your answers,

Originally posted by Brandon Goodin:
... iBATIS is a tool to interact with a database via a Datasource. iBATIS uses JDBC to pass sql to the database and then translates the returned resultset into Java objects according to the parameters defined by the developer. iBATIS provides caching that can reduce needless hits against the database.



Where in an J2EE environment does iBatis belongs? After your answer, I have the feeling that iBatis has no realtion to J2EE at all.

Originally posted by Clinton Begin:
... I'm a fan of either avoiding the DAO pattern or writing a custom abstraction layer for a project.

Cheers,
Clinton



Isn't a DAO pattern a pattern that belongs to J2EE or at least is heavily used there? After your answer I feel that iBatis can play a role in J2EE.

How would you persist the following domain model in a J2EE context with iBatis:

Order --> OrderLineItems

Can you give a little example.

Regards,
Darya
+Pie Number of slices to send: Send
 


Where in an J2EE environment does iBatis belongs? After your answer, I have the feeling that iBatis has no realtion to J2EE at all.


It belongs in the data access layer. I'm not sure I fully grasp what you mean by having a "relation to J2EE", but if you are asking can it be used in conjunction with the various J2EE APIs the answer is yes it can.


Isn't a DAO pattern a pattern that belongs to J2EE or at least is heavily used there?


The DAO pattern need not be used exclusively in applications that use J2EE technologies. It is used extensively in Srping for example.
+Pie Number of slices to send: Send
In J2EE I have Entity Beans I can use for persistence. Hibernate does a similar job in this context. For J2EE I could show what would be necessary to make my domain objects persistent, be it Entity Beans or Hibernate.

With iBatis I have no clue, whether it is thought to be a replacement for above technics or whether its intended for something complete different.

I would have had a problem to use iBatis for persistence when its intention is not that.

Maybe a small example can share some light

Regards,
Darya
+Pie Number of slices to send: Send
 

Maybe a small example can share some light



How about this one:

iBatis PetStore
+Pie Number of slices to send: Send
There are a lot of questions and confusion in this thread. I'm not sure where to start, so instead I'll give you somewhere to start.

First: iBATIS can work within a J2EE application, just like Hibernate, JDBC or any other persistance approach can. J2EE isn't a law, it's a guideline.

To aleviate any concern, realize that iBATIS has existed for 4 years and has been through two major releases.

Have a look at some of the press coverage of iBATIS here:

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Articles+and+other+coverage+of+iBATIS

Get an idea of who's using it here:

http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=25

Read what some of those people had to say here:

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Feedback+and+Experiences

Then move onto the JPetStore application (under Examples heading):

http://ibatis.apache.org/javadownloads.cgi

Then have a look at the documentation (in your choice of 5 languages under Documentation heading):

http://ibatis.apache.org/javadownloads.cgi

All of the above is available from http://ibatis.apache.org

Then if you're totally sold, buy the book: ;-)

http://www.manning.com/begin/

Hope that helps.

Cheers,
Clinton
+Pie Number of slices to send: Send
Thanks for all the links.

Regards,
Darya
Maybe he went home and went to bed. And took this tiny ad with him:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2163 times.
Similar Threads
Unable to view list in drop down menu - JSTL
Any books on Spring and iBatis?
Is there anyone who uses entity bean in his/her real enterprise project?
Separate DAO Classes
Why to use Ibatis DAO pattern
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 22:46:11.