You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Yuri de Wit <yd...@gmail.com> on 2009/06/04 23:35:40 UTC

JPA Annotations + iBatis

Would it be possible to have iBatis reuse JPA persistence annotations to
infer resultmaps/submaps/discriminators and still allow me to customize the
SQL behind the scenes?

I am creating a bi-temporal data model and I am finding JPA a bit limiting
since it assumes a certain model for inserts, updates, and deletes. In my
case, for instance an update translates into an update + insert with added
assertions as where criteria and JPA doesnt offer me that kind of
flexibility. On the one hand, I am sold on class annotations to describe
mappings from classes/fields to tables/columns and the standard api to
persist, delete, etc, but on the other hand I would like to have total
freedom to craft my own SQL behind the scenes.

IBatis seems the perfect solution for me: total flexibility in the
mappings/statements with support for polymorphic queries etc. Thats when it
occurred to me what a great combination it would be if iBatis could reuse
the JPA persistence annotations to infer resultmaps and allow me to provide
the SQL to CRUD the POJOs. iBatis could even provide standard SQL queries
that would mimic the semantic of JPA although in my case I would rewrite
those.

Does something like this even make sense? Maybe there is even an open source
JPA implementation with a good separation of concerns so that the
annotations and API implementation could be reused to plugin the iBatis back
end.  Maybe this could even increase the adoption of iBatis?

best regards,

-- yuri

Re: JPA Annotations + iBatis

Posted by Clinton Begin <cl...@gmail.com>.
As Kai stated, we still have annotation support, just not join mapping in
the annotation syntax -- 100% a Java Annotation limitation (and it works
with a loophole in Java 5)

That said, I think it would be possible for someone to do something with JPA
annotations.  I just don't think it would be anyone on our team.  :-)

Cheers,
Clinton

On Sun, Jun 7, 2009 at 2:18 AM, Kai Grabfelder <no...@kaigrabfelder.de>wrote:

> Clinton added Annotation support to iBATIS 3 but it was dropped due to a
> problem with circular references
> between resultmaps. Unfortunately we found no solution for that so I guess
> using JPA instead of iBATIS
> annotations doesn't help as well.
>
> Regards
>
> Kai
>
> --- Original Nachricht ---
> Absender: Yuri de Wit
> Datum: 04.06.2009 23:35
> > Would it be possible to have iBatis reuse JPA persistence annotations to
> > infer resultmaps/submaps/discriminators and still allow me to customize
> the
> > SQL behind the scenes?
> >
> > I am creating a bi-temporal data model and I am finding JPA a bit
> limiting
> > since it assumes a certain model for inserts, updates, and deletes. In my
> > case, for instance an update translates into an update + insert with
> added
> > assertions as where criteria and JPA doesnt offer me that kind of
> > flexibility. On the one hand, I am sold on class annotations to describe
> > mappings from classes/fields to tables/columns and the standard api to
> > persist, delete, etc, but on the other hand I would like to have total
> > freedom to craft my own SQL behind the scenes.
> >
> > IBatis seems the perfect solution for me: total flexibility in the
> > mappings/statements with support for polymorphic queries etc. Thats when
> it
> > occurred to me what a great combination it would be if iBatis could reuse
> > the JPA persistence annotations to infer resultmaps and allow me to
> provide
> > the SQL to CRUD the POJOs. iBatis could even provide standard SQL queries
> > that would mimic the semantic of JPA although in my case I would rewrite
> > those.
> >
> > Does something like this even make sense? Maybe there is even an open
> source
> > JPA implementation with a good separation of concerns so that the
> > annotations and API implementation could be reused to plugin the iBatis
> back
> > end.  Maybe this could even increase the adoption of iBatis?
> >
> > best regards,
> >
> > -- yuri
> >
>
>

Re: JPA Annotations + iBatis

Posted by Kai Grabfelder <no...@kaigrabfelder.de>.
Clinton added Annotation support to iBATIS 3 but it was dropped due to a problem with circular references
between resultmaps. Unfortunately we found no solution for that so I guess using JPA instead of iBATIS
annotations doesn't help as well.

Regards

Kai

--- Original Nachricht ---
Absender: Yuri de Wit
Datum: 04.06.2009 23:35
> Would it be possible to have iBatis reuse JPA persistence annotations to
> infer resultmaps/submaps/discriminators and still allow me to customize the
> SQL behind the scenes?
> 
> I am creating a bi-temporal data model and I am finding JPA a bit limiting
> since it assumes a certain model for inserts, updates, and deletes. In my
> case, for instance an update translates into an update + insert with added
> assertions as where criteria and JPA doesnt offer me that kind of
> flexibility. On the one hand, I am sold on class annotations to describe
> mappings from classes/fields to tables/columns and the standard api to
> persist, delete, etc, but on the other hand I would like to have total
> freedom to craft my own SQL behind the scenes.
> 
> IBatis seems the perfect solution for me: total flexibility in the
> mappings/statements with support for polymorphic queries etc. Thats when it
> occurred to me what a great combination it would be if iBatis could reuse
> the JPA persistence annotations to infer resultmaps and allow me to provide
> the SQL to CRUD the POJOs. iBatis could even provide standard SQL queries
> that would mimic the semantic of JPA although in my case I would rewrite
> those.
> 
> Does something like this even make sense? Maybe there is even an open source
> JPA implementation with a good separation of concerns so that the
> annotations and API implementation could be reused to plugin the iBatis back
> end.  Maybe this could even increase the adoption of iBatis?
> 
> best regards,
> 
> -- yuri
>