Kris
Kris

Reputation: 14458

Converting from Hibernate hbm.xml to annotations

I have a rather large program that uses Hibernate for its ORM needs. Due to the age of the project it is using hbm.xml to configure it. I would like to convert it to annotations but I'm vary of investing days (weeks?) in manually adding the annotations and then testing everything.

Is there any tool out there that can help facilitate this?

Upvotes: 10

Views: 13605

Answers (3)

Marius Schär
Marius Schär

Reputation: 336

I know this question is rather old, but this may help someone coming from a search engine:

We recently undertook this endeavor in our own fairly large project and wrote a tool that parses hbm.xml-files and generates annotations into Java-files to help us.

You can find it here. It automates a majority of the migration, leaving you to only do the difficult parts. All the easy things are done for you.

Upvotes: 3

mysomic
mysomic

Reputation: 1567

Have you looked at hibernate tools - specifically the hbm2java component?

Upvotes: 2

skaffman
skaffman

Reputation: 403441

I don't think so. But you don't have to do it in one go, you can mix annotation and .xml config quite easily.

Also, why do you feel the need to convert to annotations? I wouldn't say they're so much better than xml config to warrant the investment in time to convert them.

Upvotes: 11

Related Questions