• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
author
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>> 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
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maybe a small example can share some light



How about this one:

iBatis PetStore
 
Clinton Begin
author
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all the links.

Regards,
Darya
reply
    Bookmark Topic Watch Topic
  • New Topic