hi there I got the same problem:
Mapping document:
<?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="musicfinder.persistence.hibernate.bean.Archivable"
table="Archivable"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="id"
type="long"
unsaved-value="0"
>
<generator class="native">
</generator>
</id>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Archivable.xml
containing the additional properties and place it in your merge dir.
-->
<joined-subclass
name="musicfinder.persistence.hibernate.bean.Media"
dynamic-update="false"
dynamic-insert="false"
>
<key
column="archivable"
/>
<property
name="timestamp"
type="timestamp"
update="true"
insert="true"
access="property"
column="timestamp"
/>
</joined-subclass>
</class>
</hibernate-mapping>
CODE:
query = "SELECT {Archivable.*} FROM Archivable Archivable";
logger.debug("findArchivable: query: " + query);
Session session = HibernateSession.acquireSession();
try {
Query q = session.createSQLQuery(query, "Archivable", Archivable.class);
List list = q.list();
return list;
} finally {
HibernateSession.releaseSession();
}
LOG:
Hibernate: SELECT Archivable.id as id0_, case when Archivable_1_.archivable is not null then 1 when Archivable.id is not null then 0 end as clazz_0_, Archivable_1_.timestamp as timestamp1_0_ FROM Archivable Archivable
WARN 2004-09-20 17:50:42,532 [util.JDBCExceptionReporter; main]: SQL Error: 1109, SQLState: S1000
ERROR 2004-09-20 17:50:42,533 [util.JDBCExceptionReporter; main]: General error, message from server: "Unknown table 'Archivable_1_' in field list"
WARN 2004-09-20 17:50:42,538 [util.JDBCExceptionReporter; main]: SQL Error: 1109, SQLState: S1000
ERROR 2004-09-20 17:50:42,538 [util.JDBCExceptionReporter; main]: General error, message from server: "Unknown table 'Archivable_1_' in field list"
ERROR 2004-09-20 17:50:42,538 [util.JDBCExceptionReporter; main]: SQLException occurred
java.sql.SQLException: General error, message from server: "Unknown table 'Archivable_1_' in field list"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:956)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1874)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1538)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92)
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3806)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
at musicfinder.persistence.hibernate.MediaDAOSessionBean.findArchivable(MediaDAOSessionBean.java:111)
at musicfinder.persistence.hibernate.MediaDAOSessionBean.main(MediaDAOSessionBean.java:376)
when i do not have a joined-subclass element in the mapping document, everthing goes fine!
anybody? any ideas? - thanks!