You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Sebastian Wagner <se...@gmail.com> on 2009/11/20 10:47:01 UTC

Migration strategy from Hibernate

hi,


in follow up from a discussion on the Apache General List:
http://mail-archives.apache.org/mod_mbox/incubator-general/200911.mbox/%3C1434b04c0911200121g2d99f359m9c27fa41fe63ac72@mail.gmail.com%3E

I have some quite basic questions about migrating a existing Project using
Hibernate to openJPA.

We are using a Hibernate 3.4 + XDoclet2 to generate the HBM files.
We don't use a Spring Managed Transaction Manager yet for handling the
Session (but we should).
We have a lot of HQL Statements in the Code.
The project is: http://openmeetings.googlecode.com
(For anybody interested the Sources are located into
http://openmeetings.googlecode.com/svn/trunk/singlewebapp/src/app/org/openmeetings/app/
)
And we are applying for Apache Incubation, so we have to get rid of
Hibernate.

What is your general advice on an easy way to migrate to openJPA?

Writing the intermediate database description per object, you use
annotations I guess?
In what kind of Java-Structure do you Map Many-To-One relations?
How do you handle Multi-Threaded Applications and Database Caches? In
hibernate a very common problem is that you have problems with Objects that
are several times in the Cache but in different Threads. In that case a
Session.flush does not really work as it only flushs one Thread. This can be
solved in Hibernate by using a Spring managed Transaction Manager. What is
JPAs approach in that area?
And finally => HQL Statements, I guess I have to rewrite them all, but is
the openJPA *JPQL* very different from that? From what I have seen its not
that big Issue to refactor those statements to JPQL.

And I have a lot more questions before I can finally decide on what is the
best and feasable way to migrate.
But I am eager to learn ^^ so maybe somebody is eager to give us some tipps

I will try to study the docs,
but i have not seen any kick-start example yet that covers the most of basic
topics. Is there any sample that can be re-used?


thanks a lot
Sebastian Wagner

-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.laszlo-forum.de
seba.wagner@gmail.com

Re: Migration strategy from Hibernate

Posted by Sebastian Wagner <se...@gmail.com>.
wow, that is quite extended material, thanks for the link.
I will study and come back.


sebastian

2009/11/20 Kevin Sutter <kw...@gmail.com>

> Hi Sebastian,
> I'm sorry to day that we don't have a cookbook on this Hibernate migration
> exercise.  I would highly suggest (beg?) that you take good notes during
> this migration so that we can all learn from the experience.
>
> I'm assuming you are moving from Hibernate "classic", meaning pre-JPA
> programming model.  Otherwise known as the Hibernate Session programming
> model.  If you are actually on moving from Hibernate JPA to OpenJPA, then
> the migration should be relatively straight forward.  But, from the content
> of your notes below, I believe you are migrating from "classic" to OpenJPA.
>
> To that end, a colleague of mine and myself have written a white paper [1]
> outlining the common Hibernate "classic" programming model paradigms and
> how
> to best map them to OpenJPA.  So, I would start with that white paper and
> see it gets you started.
>
> Also, OpenJPA supports both Annotations and XML, so if you feel more
> comfortable with the XML configuration approach, you could stick with that.
>
> I hope this helps.
> Good luck and let us know how it goes!
> Kevin
>
> [1]
>
> http://www.ibm.com/developerworks/websphere/techjournal/0708_vines/0708_vines.html
>
> On Fri, Nov 20, 2009 at 3:47 AM, Sebastian Wagner <seba.wagner@gmail.com
> >wrote:
>
> > hi,
> >
> >
> > in follow up from a discussion on the Apache General List:
> >
> >
> http://mail-archives.apache.org/mod_mbox/incubator-general/200911.mbox/%3C1434b04c0911200121g2d99f359m9c27fa41fe63ac72@mail.gmail.com%3E
> >
> > I have some quite basic questions about migrating a existing Project
> using
> > Hibernate to openJPA.
> >
> > We are using a Hibernate 3.4 + XDoclet2 to generate the HBM files.
> > We don't use a Spring Managed Transaction Manager yet for handling the
> > Session (but we should).
> > We have a lot of HQL Statements in the Code.
> > The project is: http://openmeetings.googlecode.com
> > (For anybody interested the Sources are located into
> >
> >
> http://openmeetings.googlecode.com/svn/trunk/singlewebapp/src/app/org/openmeetings/app/
> > )
> > And we are applying for Apache Incubation, so we have to get rid of
> > Hibernate.
> >
> > What is your general advice on an easy way to migrate to openJPA?
> >
> > Writing the intermediate database description per object, you use
> > annotations I guess?
> > In what kind of Java-Structure do you Map Many-To-One relations?
> > How do you handle Multi-Threaded Applications and Database Caches? In
> > hibernate a very common problem is that you have problems with Objects
> that
> > are several times in the Cache but in different Threads. In that case a
> > Session.flush does not really work as it only flushs one Thread. This can
> > be
> > solved in Hibernate by using a Spring managed Transaction Manager. What
> is
> > JPAs approach in that area?
> > And finally => HQL Statements, I guess I have to rewrite them all, but is
> > the openJPA *JPQL* very different from that? From what I have seen its
> not
> > that big Issue to refactor those statements to JPQL.
> >
> > And I have a lot more questions before I can finally decide on what is
> the
> > best and feasable way to migrate.
> > But I am eager to learn ^^ so maybe somebody is eager to give us some
> tipps
> >
> > I will try to study the docs,
> > but i have not seen any kick-start example yet that covers the most of
> > basic
> > topics. Is there any sample that can be re-used?
> >
> >
> > thanks a lot
> > Sebastian Wagner
> >
> > --
> > Sebastian Wagner
> > http://www.webbase-design.de
> > http://openmeetings.googlecode.com
> > http://www.laszlo-forum.de
> > seba.wagner@gmail.com
> >
>



-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.laszlo-forum.de
seba.wagner@gmail.com

Re: Migration strategy from Hibernate

Posted by Kevin Sutter <kw...@gmail.com>.
Hi Sebastian,
I'm sorry to day that we don't have a cookbook on this Hibernate migration
exercise.  I would highly suggest (beg?) that you take good notes during
this migration so that we can all learn from the experience.

I'm assuming you are moving from Hibernate "classic", meaning pre-JPA
programming model.  Otherwise known as the Hibernate Session programming
model.  If you are actually on moving from Hibernate JPA to OpenJPA, then
the migration should be relatively straight forward.  But, from the content
of your notes below, I believe you are migrating from "classic" to OpenJPA.

To that end, a colleague of mine and myself have written a white paper [1]
outlining the common Hibernate "classic" programming model paradigms and how
to best map them to OpenJPA.  So, I would start with that white paper and
see it gets you started.

Also, OpenJPA supports both Annotations and XML, so if you feel more
comfortable with the XML configuration approach, you could stick with that.

I hope this helps.
Good luck and let us know how it goes!
Kevin

[1]
http://www.ibm.com/developerworks/websphere/techjournal/0708_vines/0708_vines.html

On Fri, Nov 20, 2009 at 3:47 AM, Sebastian Wagner <se...@gmail.com>wrote:

> hi,
>
>
> in follow up from a discussion on the Apache General List:
>
> http://mail-archives.apache.org/mod_mbox/incubator-general/200911.mbox/%3C1434b04c0911200121g2d99f359m9c27fa41fe63ac72@mail.gmail.com%3E
>
> I have some quite basic questions about migrating a existing Project using
> Hibernate to openJPA.
>
> We are using a Hibernate 3.4 + XDoclet2 to generate the HBM files.
> We don't use a Spring Managed Transaction Manager yet for handling the
> Session (but we should).
> We have a lot of HQL Statements in the Code.
> The project is: http://openmeetings.googlecode.com
> (For anybody interested the Sources are located into
>
> http://openmeetings.googlecode.com/svn/trunk/singlewebapp/src/app/org/openmeetings/app/
> )
> And we are applying for Apache Incubation, so we have to get rid of
> Hibernate.
>
> What is your general advice on an easy way to migrate to openJPA?
>
> Writing the intermediate database description per object, you use
> annotations I guess?
> In what kind of Java-Structure do you Map Many-To-One relations?
> How do you handle Multi-Threaded Applications and Database Caches? In
> hibernate a very common problem is that you have problems with Objects that
> are several times in the Cache but in different Threads. In that case a
> Session.flush does not really work as it only flushs one Thread. This can
> be
> solved in Hibernate by using a Spring managed Transaction Manager. What is
> JPAs approach in that area?
> And finally => HQL Statements, I guess I have to rewrite them all, but is
> the openJPA *JPQL* very different from that? From what I have seen its not
> that big Issue to refactor those statements to JPQL.
>
> And I have a lot more questions before I can finally decide on what is the
> best and feasable way to migrate.
> But I am eager to learn ^^ so maybe somebody is eager to give us some tipps
>
> I will try to study the docs,
> but i have not seen any kick-start example yet that covers the most of
> basic
> topics. Is there any sample that can be re-used?
>
>
> thanks a lot
> Sebastian Wagner
>
> --
> Sebastian Wagner
> http://www.webbase-design.de
> http://openmeetings.googlecode.com
> http://www.laszlo-forum.de
> seba.wagner@gmail.com
>