Hibernate version:
version 3.1.2
Name and version of the database you are using:
MySQL 4.0.18-standard
Mapping documents:
case 1:
Code:
<class name="Person" table="person">
<id name="id" column="id">
<generator class="native"/>
</id>
<version name="version"/>
<property name="name"/>
<property name="surname"/>
</class>
case 2:
Code:
<class name="Person" table="person">
<id name="id" column="id">
<generator class="native"/>
</id>
<version name="version"/>
<property name="name"/>
<property name="surname"/>
<joined-subclass name="Male" table="male">
<key column="pid"/>
<property name="car"/>
</joined-subclass>
</class>
Code between sessionFactory.openSession() and session.close():
session.createQuery("update Person set surname = :foo").setString("foo", "example.com").executeUpdate();
The generated SQL (show_sql=true):
case 1: update person set surname=?
case 2: Hibernate: insert into HT_person select person0_.id as id from person person0_
16 Μαϊ 2006 3:57:29 μμ org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 1146, SQLState: 42S02
16 Μαϊ 2006 3:57:29 μμ org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Table 'test.HT_person' doesn't exist
16 Μαϊ 2006 3:57:29 μμ org.hibernate.hql.ast.exec.AbstractStatementExecutor$2 doWork
WARNING: unable to drop temporary id table after use
java.sql.SQLException: Unknown table 'HT_person'
Hello
I bulk update a property of Person which works fine (case 1).
If I have a class Male extending Person, the bulk update cannot happen on that Person class (case 2). I found that out by commenting out the <joined-subclass> element in the Person.hbm.xml and made the bulk update work, but of course this is not what I want as then I will not be able to find instances of the Male class.
am I doing something wrong?
thanks