Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting from Hibernate hbm.xml to annotations

Tags:

java

hibernate

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?

like image 576
Kris Avatar asked Jun 07 '09 16:06

Kris


People also ask

What is hibernate HBM XML?

Hibernate XML mapping file contains the mapping relationship between Java class and database table. This is always named as “xx. hbm. xml” and declared in the Hibernate configuration file “hibernate.

What is the use of @entity annotation in hibernate?

@Entity annotation marks this class as an entity. @Table annotation specifies the table name where data of this entity is to be persisted. If you don't use @Table annotation, hibernate will use the class name as the table name by default.


1 Answers

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.

like image 67
skaffman Avatar answered Sep 28 '22 21:09

skaffman