3

I have an old project in which java classes are generated from hbm files.

Is it possible ,using these hbm files, to generate java classes with annotations?

cнŝdk
  • 31,391
  • 7
  • 56
  • 78
senior
  • 2,196
  • 6
  • 36
  • 54
  • yes with netbeans i did that , during generation (reverse ingenering) it demande to me if i want to use xml file ou annotations – Abder KRIMA Jul 06 '15 at 10:12

3 Answers3

3

We have had the same issue and solved it by using this hbm to annotation converter script https://github.com/SchweizerischeBundesbahnen/hibernate_hbm2annotation

GreenRover
  • 1,486
  • 1
  • 14
  • 33
1

You can use a hibernate reverse engeneering tool, but for generating annoted classes from database not from hbm's.

bmlynarczyk
  • 808
  • 10
  • 19
1

I don't think you can do it directly from hbm to annotations, but it's possible to do it if you proceed like this:

  1. Generate the database schema from your hbm configuration.
  2. Use Hibernate reverse engeneering to generate annotated classes from this database.

You may take a look at these links for further information:

omerhakanbilici
  • 874
  • 1
  • 18
  • 26
cнŝdk
  • 31,391
  • 7
  • 56
  • 78