nhibernate « HBM « JPA Q&A





1. Embed hibernate hbm.xml mappings in jar    stackoverflow.com

Is it possible to embed the hibernate mapping hbm.xml’s to the jar and avoid manual reference in applicationContext.xml like

  <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property ...

2. How to use Dynamic Instantiation with ICriteria in Nhibernate?    stackoverflow.com

I know that you can do this easily with HQL using the following syntax:

"select new ItemRow(item.id, item.name) from ..."
In this example, the ItemRow need not be a persistent class that has ...

3. Mapping key-many-to-one + many-to-one    stackoverflow.com

I'm trying to mapping follow class X: Class A

<composite-id>
 <key-many-to-one name="group" class="Group" column="groupID" />
 <key-property name="Id" column="Id" type="Int32" />
</composite-id>
<property ....
Class B
<composite-id>
 <key-many-to-one name="group" class="Group" column="groupID" />
 <key-property name="Id" column="Id" type="Int32" />
</composite-id>
<property ....
Class ...

4. Hibernate hibernate.hbm2ddl.auto=create/update/validate doesn't work for correctly for custom dialects?    stackoverflow.com

I recently upgrade Hibernate from version 3.3.x to 3.6.4. In version 3.3.x validateSchema (hibernate.hbm2ddl.auto=validate) works correctly. In version 3.6.x validation is broken (tested for 3.6.4 and 3.6.7 as well). The issue is ...

5. Define Named Query in NHibernate Fluent Mapping without .hbm or xml files    stackoverflow.com

Currently I am using NHibernate and Fluent mapping for as ORM. I use named queries to call stored procedures. The named queries are saved in .hbm files. e.g:

<hibernate-mapping default-cascade="none" 
   xmlns="urn:nhibernate-mapping-2.2" ...