DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Containers Trend Report: Explore the current state of containers, containerization strategies, and modernizing architecture.

Low-Code Development: Learn the concepts of low code, features + use cases for professional devs, and the low-code implementation process.

E-Commerce Development Essentials: Considering starting or working on an e-commerce business? Learn how to create a backend that scales.

Related

  • FHIR Data Model With Couchbase N1QL
  • The Complete Tutorial on the Top 5 Ways to Query Your Relational Database in JavaScript - Part 2
  • SQL Data Manipulation Language (DML) Operations: Insert, Update, Delete
  • How to Build a Full-Stack App With Next.js, Prisma, Postgres, and Fastify

Trending

  • Data Consistency in Distributed Systems: Transactional Outbox
  • Demystifying Databases, Data Warehouses, Data Lakes, and Data Lake Houses
  • Exploring Apache Airflow for Batch Processing Scenario
  • You’re Wasting Time With Your Daily Standup
  1. DZone
  2. Data Engineering
  3. Databases
  4. Introduction to iBatis (MyBatis), An alternative to Hibernate and JDBC

Introduction to iBatis (MyBatis), An alternative to Hibernate and JDBC

Loiane Groner user avatar by
Loiane Groner
·
Feb. 09, 11 · Interview
Like (5)
Save
Tweet
Share
40.8K Views

Join the DZone community and get the full member experience.

Join For Free

i started to write a new article series about ibatis / mybatis . this is the first article and it will walk you through what is ibatis / mybatis and why you should use it.

for those who does not know ibatis / mybatis yet, it is a persistence framework – an alternative to jdbc and hibernate , available for java and .net platforms. i’ve been working with it for almost two years, and i am enjoying it!

the first thing you may notice in this and following articles about ibatis/mybatis is that i am using both ibatis and mybatis terms. why? until june 2010, ibatis was under apache license and since then, the framework founders decided to move it to google code and they renamed it to mybatis. the framework is still the same though,  it just has a different name now.

i gathered some resources, so i am just going to quote them:

what is mybatis/ibatis?

the mybatis data mapper framework makes it easier to use a relational database with object-oriented applications. mybatis couples objects with stored procedures or sql statements using a xml descriptor. simplicity is the biggest advantage of the mybatis data mapper over object relational mapping tools.to use the mybatis data mapper, you rely on your own objects, xml, and sql. there is little to learn that you don’t already know. with the mybatis data mapper, you have the full power of both sql and stored procedures at your fingertips.
( www.mybatis.org )

ibatis is based on the idea that there is value in relational databases and sql, and that it is a good idea to embrace the industrywide investment in sql. we have experiences whereby the database and even the sql itself have outlived the application source code, and even multiple versions of the source code. in some cases we have seen that an application was rewritten in a different language, but the sql and database remained largely unchanged.

it is for such reasons that ibatis does not attempt to hide sql or avoid sql. it is a persistence layer framework that instead embraces sql by making it easier to work with and easier to integrate into modern object-oriented software. these days, there are rumors that databases and sql threaten our object models, but that does not have to be the case. ibatis can help to ensure that it is not.

( ibatis in action book)

so…

what is ibatis ?

  • a jdbc framework
  • developers write sql, ibatis executes it using jdbc.
  • no more try/catch/finally/try/catch.
  • an sql mapper
  • automatically maps object properties to prepared statement parameters.
  • automatically maps result sets to objects.
  • support for getting rid of n+1 queries.
  • a transaction manager
  • ibatis will provide transaction management for database operations if no other transaction manager is available.
  • ibatis will use external transaction management (spring, ejb cmt, etc.) if available.
  • great integration with spring, but can also be used without spring (the spring folks were early supporters of ibatis).

what isn’t ibatis ?

  • an orm
  • does not generate sql
  • does not have a proprietary query language
  • does not know about object identity
  • does not transparently persist objects
  • does not build an object cache

essentially, ibatis is a very lightweight persistence solution that gives you most of the semantics of an o/r mapping toolkit, without all the drama. in other words ,ibatis strives to ease the development of data-driven applications by abstracting the low-level details involved in database communication (loading a database driver, obtaining and managing connections, managing transaction semantics, etc.), as well as providing higher-level orm capabilities (automated and configurable mapping of objects to sql calls, data type conversion management, support for static queries as well as dynamic queries based upon an object’s state, mapping of complex joins to complex object graphs, etc.). ibatis simply maps javabeans to sql statements using a very simple xml descriptor. simplicity is the key advantage of ibatis over other frameworks and object relational mapping tools.( http://www.developersbook.com )

who is using ibatis/mybatis?

see the list in this link: http://www.apachebookstore.com/confluence/oss/pages/viewpage.action?pageid=25

i think the biggest case is myspace , with millions of users. very nice!

this was just an introduction, so in next articles i will show how to create an application using ibatis/mybatis – step-by-step.

enjoy! :)

from http://loianegroner.com/2011/02/introduction-to-ibatis-mybatis-an-alternative-to-hibernate-and-jdbc/

MyBatis Database Relational database sql Object (computer science) Hibernate application Framework Data (computing) Query language

Opinions expressed by DZone contributors are their own.

Related

  • FHIR Data Model With Couchbase N1QL
  • The Complete Tutorial on the Top 5 Ways to Query Your Relational Database in JavaScript - Part 2
  • SQL Data Manipulation Language (DML) Operations: Insert, Update, Delete
  • How to Build a Full-Stack App With Next.js, Prisma, Postgres, and Fastify

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: