Hi all,
I have one bean (Menu) mapped twice in my hbm.xml using different entity-name:
Code:
<class name="Menu" table="nav_stage_menu" entity-name="stageMenu">
...
Code:
<class name="Menu" table="nav_public_menu" entity-name="publicMenu">
...
I can easily RETRIVE information from both tables using such a syntax:
Code:
Menu m = (Menu) hsc.session.createQuery("from "+boundary+"Menu m where m.uid=?")
.setParameter(0, uid)
.uniqueResult();
where boundary is a string "stage" or "public"
Here is my question...
Which is the right syntax to save an instance of Menu m, since the Exeception I get from Hibernate, when I execute
Code:
hsc.session.save(m);
is, obviously, this:
Code:
Unknown entity: backend.entities.navigation.Menu
ps:
I'm trying this awful thing but it reeeeeeallly sucks, since it's not Hibernate (and even it does not work):
Code:
hsc.session.createQuery("insert into "+boundary.getValue()+"Menu (parent, label) values (?, ?)")
.setParameter(0, m.getParent())
.setParameter(1, m.getLabel());