Regular |
|
Joined: Tue Oct 12, 2004 9:02 am Posts: 66 Location: Italy
|
Hibernate version:2-1
Mapping documents: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> <class name="model.Normativa" table="normative" lazy="true"> <id name="id" column="ID" type="long" unsaved-value="null"> <generator class="native" /> </id>
<property name="idsettore" type="integer" />
<property name="idautore" type="integer" />
<property name="idtipo" type="integer" />
<property name="idfonte" type="integer" />
<property name="titolo" type="string" />
<property name="numero" type="string" />
<property name="data" type="date" />
<property name="numerofonte" type="string" />
<property name="datafonte" type="date" />
<property name="datainserimento" type="date" /> <many-to-one name="argomento" column="idargomento" class="model.Argomento" />
<set name="normativaUtenti" lazy="true"> <key column="IDNORMA" />
<one-to-many class="model.Accesso" /> </set>
</class>
</hibernate-mapping>
AND
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> <class name="model.NormativaBody" table="normative" lazy="true" polymorphism="explicit"> <id name="id" column="ID" type="long" unsaved-value="null"> <generator class="native" /> </id>
<property name="idsettore" type="integer" />
<property name="idautore" type="integer" />
<property name="idtipo" type="integer" />
<property name="idfonte" type="integer" />
<property name="titolo" type="string" />
<property name="numero" type="string" />
<property name="data" type="date" />
<property name="numerofonte" type="string" />
<property name="datafonte" type="date" />
<property name="datainserimento" type="date" /> <property name="body" type="text" /> <many-to-one name="argomento" column="idargomento" class="model.Argomento" />
<set name="normativaUtenti" lazy="true"> <key column="IDNORMA" />
<one-to-many class="model.Accesso" /> </set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close(): norms = session.createCriteria(NormativaBody.class) .add(Example.create(normativa)) .add(Expression.ilike("body", body, MatchMode.ANYWHERE)) .list();
Name and version of the database you are using: interbase 6
The generated SQL (show_sql=true): NO SQL GENERATED!
The problem is that this code doens't generate any SQL!
If I use
session.createCriteria(Normativa.class)
instead of
session.createCriteria(NormativaBody.class)
hibernate perform a select (but without body field).
What is happening?
|
|