hibernate - Ejb3Configuration.addPackage() does not find entities -
i want add known jpa entities programatically when creating entitymanagerfactory. have sequence (hibernate 3.6)
ejb3configuration ejbconf = new ejb3configuration(); ejbconf.configure("testpu", null); ejbconf.addpackage("org.jboss.jawabot.irc.ent"); ejbconf.addpackage("org.jboss.jawabot.irc.model"); emf = ejbconf.buildentitymanagerfactory();
i tried calling addpackage()'s before configure(). adding packages fine. however, hibernate not find entities. when persist it, get:
unknown entity: org.jboss.jawabot.irc.model.ircmessage
what's wrong? how make hbernate recognize entities packages?
thanks, ondra
update: project here.
bit messy because trying few tricks in that.
and note, entities "core" module (jar) of app picked up.
the anwser is, purpose of addpackage()
tell hibernate take given package's annotations account, not load it's entities.
more, ejb3configuration
deprecated 4.0 in favor of entitymanagerfactorybuilder
, see https://hibernate.onjira.com/browse/hhh-6159 .
Comments
Post a Comment