Now that I am using the jTDS driver I no longer have the re-read problem that I had with the SQL Server driver. However, I have some unexpected behavior for a joined-subclass. When the joined-subclass object is inserted, hibernate tries to insert it into the parent class' table. As I understand the mapping, the tables are distinct.
Why does it do this? Have I misconfigured? I only want hibernate to persist subclass objects to the subclass table, nowhere else.
Thanks,
Derrick
CREATE TABLE [dbo].[emailTemplate] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[name] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[description] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[fromAddress] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[toAddresses] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[cc] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[bcc] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[subject] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[body] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[calendarAppointment] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[enabled] [bit] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[emailMessage] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[name] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[description] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[fromAddress] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[toAddresses] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[cc] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[bcc] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[subject] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[body] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[calendarAppointment] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
Hibernate version:
2.1.3
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 package="com.skillsoft.mgs.email">
<class mutable="false" name="EmailTemplateBean" table="emailTemplate">
<id name="ID" column="ID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" column="name"/>
<property name="descr" column="description"/>
<property name="from" column="fromAddress"/>
<property name="to" column="toAddresses"/>
<property name="cc" column="cc"/>
<property name="bcc" column="bcc"/>
<property name="subject" column="subject"/>
<property name="body" column="body"/>
<property name="calendarAppointment" column="calendarAppointment"/>
<property name="enabled" column="enabled"/>
<joined-subclass name="com.skillsoft.mgs.email.queued.EmailMessage" table="emailMessage">
<key column="ID"/>
<property name="name" column="name"/>
<property name="descr" column="description"/>
<property name="from" column="fromAddress"/>
<property name="to" column="toAddresses"/>
<property name="cc" column="cc"/>
<property name="bcc" column="bcc"/>
<property name="subject" column="subject"/>
<property name="body" column="body"/>
<property name="calendarAppointment" column="calendarAppointment"/>
</joined-subclass>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
SQL Server 2000 with jTDS 0.9 driver
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|