I get data persisted in the iltRegistration table and the appApproval table, but no data in the "map" table iltRegistrationApproval. I need help to understand why.
Hibernate version:
2.1.8
Mapping documents:
CREATE TABLE [dbo].[iltRegistration] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[uzer] [int] NOT NULL ,
[session] [int] NOT NULL ,
[passed] [bit] NOT NULL ,
[attended] [bit] NOT NULL ,
[mastery] [smallint] NOT NULL ,
[date] [datetime] NOT NULL ,
[postDate] [datetime] NULL ,
[notes] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[status] [smallint] NOT NULL
) ON [PRIMARY]
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[appApproval]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[appApproval] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[status] [int] NOT NULL ,
[requestDate] [datetime] NULL ,
[grantDate] [datetime] NULL ,
[note] [nvarchar] (2500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[registration] [int] NOT NULL ,
[ownedBy] [int] NOT NULL
) ON [PRIMARY]
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[iltRegistrationApproval]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[iltRegistrationApproval] (
[id] [int] NOT NULL ,
[type] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[approval] [int] NOT NULL
) ON [PRIMARY]
GO
<?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.ilt.beans">
<class name="Registration" table="iltRegistration">
<id name="ID" column="ID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="passed" column="passed"/>
<property name="attended" column="attended"/>
<property name="registered" column="date"/>
<property name="mastery" column="mastery"/>
<property name="status" column="status"/>
<property name="notes" column="notes"/>
<many-to-one name="session" column="session" class="Session"/>
<many-to-one name="student" column="uzer" class="User"/>
<map
name="approvals"
table="iltRegistrationApproval"
inverse="true"
cascade="all-delete-orphan"
lazy="false"
outer-join="false"
order-by="type"
batch-size="100">
<key column="ID"/>
<index column="type" type="string"/>
<many-to-many column="approval" class="Approval"/>
</map>
</class>
</hibernate-mapping>
<?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.ilt.beans">
<class name="Approval" table="appApproval">
<id name="ID" column="ID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="status" column="status"/>
<property name="requestDate" column="requestDate"/>
<property name="grantDate" column="grantDate"/>
<property name="note" column="note"/>
<many-to-one name="registration" class="Registration" column="registration"/>
<many-to-one name="ownedBy" class="User" column="ownedBy"/>
</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
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|