You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by lwp <lu...@uk.ibm.com> on 2010/07/13 13:10:04 UTC

Are there any tools which will map from Hibernate to OpenJPA XML mapping files?

I'm trying to migrate some Hibernate code to OpenJPA. I have a large number
of *.hbm.xml Hibernate mapping files which it would be great if I could run
through a tool to produce the equivalent OpenJPA XML mapping files. Is
anyone aware of any reliable tools out there that already do this?  (Of
course the client Java code will also have to be converted too but that's
another story...)

If there are no such tools... is anyone aware of any tables or mappings out
there which show you which OpenJPA/JPA mappings correspond to each Hibernate
mapping? (BTW I have seen the article on migration at
http://www.ibm.com/developerworks/websphere/techjournal/0708_vines/0708_vines.html
)

Thanks.
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Are-there-any-tools-which-will-map-from-Hibernate-to-OpenJPA-XML-mapping-files-tp5286969p5286969.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Are there any tools which will map from Hibernate to OpenJPA XML mapping files?

Posted by lwp <lu...@uk.ibm.com>.
Thanks for the tip! Your link also led me to 
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_mapping_middle
this  in the manual about meet-in-the-middle mapping. That tool could help
me validate that the proposed mapping between the pre-existing object and
data models is correct.
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Are-there-any-tools-which-will-map-from-Hibernate-to-OpenJPA-XML-mapping-files-tp5286969p5291660.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Are there any tools which will map from Hibernate to OpenJPA XML mapping files?

Posted by Michael Dick <mi...@gmail.com>.
I don't know of a tool that works from the hbm.xml files directly, but you
can use OpenJPA's ReverseMappingTool to generate an orm.xml file and .java
files for your entities (ignore these) based on the database.

There's a starting point in the manual 
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_pc_reverse
here . You probably don't need to worry about the customizer stuff, just run
SchemaTool -a reflect > someFile.xml followed by ReverseMappingTool
someFile.xml. 

Hope this helps,
-mike 

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Are-there-any-tools-which-will-map-from-Hibernate-to-OpenJPA-XML-mapping-files-tp5286969p5288932.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.