0

I'm a bit lazy and i'm trying to find a single liner to map all my classes in my hibernate.cfg.config. (I'm using annotations not an xml file)

What i've tried to do :

<mapping class="my_group.my_artifact.*"></mapping>

Can this be acheived using one line of code? I've looked to other answers on SO but didn't find a lazy way that fits me, and I'm new to SO to I'll appreciate any helpful comment.

Luiz Agner
  • 77
  • 10
Perdamaian
  • 23
  • 3
  • 1
    Maybe you give more specific examples why they "dont fit" you. How are we supposed to know what you have read so far and "rejected" when you don't tell us? – GhostCat Jul 28 '16 at 09:12
  • Ah sorry for that, but what i meant by "don't fit" is just that i'm looking for a one-line code to do the job, "out of the box". Otherwise i found other ways to do it, like [this](http://stackoverflow.com/questions/1413190/hibernate-mapping-package) for example. – Perdamaian Jul 28 '16 at 09:44

1 Answers1

0

You can't do it using Hibernate only.

You can use Spring with org.springframework.orm.hibernate5.LocalSessionFactoryBean (package hibernate5 for Hibernate 5, change it if need) or additional libraries as described here:

Hibernate config not list all Entities in XML

Community
  • 1
  • 1
v.ladynev
  • 19,275
  • 8
  • 46
  • 67
  • Thank you for clearing that out! My company isn't using spring or anything like that for the moment so i'll have to do it manually ! cheers – Perdamaian Jul 29 '16 at 06:53