Hello,
I am using Hibernate 2.1.2, and am running into an odd problem. I have a class that has a Set of objects defined as composite-elements. There is no mapping document for the element, but there is a mapping file for the holding class. That snippet is:
<set
name="activities"
table="BUSINESS_ACTIVITIES"
lazy="true"
inverse="false"
cascade="all-delete-orphan"
sort="unsorted">
<key column="business_id"/>
<composite-element class="com.hic.eboss.Activity">
<property
name="type"
type="com.hic.eboss.ActivityType"
update="true"
insert="true"
column="type"/>
<property
name="started"
type="java.util.Date"
update="true"
insert="true"
column="started" />
</composite-element>
</set>
When I add some Activities into this object and try to save it, the correct SQL statements are generated, but an exception is thrown by hibernate:
net.sf.hibernate.MappingException: No persister for: com.hic.eboss.Activity
net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2656)
net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2663)
net.sf.hibernate.impl.SessionImpl.isSaved(SessionImpl.java:2700)
Some of the debug log follows:
[DEBUG,net.sf.hibernate.collection.BasicCollectionPersister] Inserting rows of collection: [com.hic.eboss.Business.activities#402801e6fbebdad900fbebdda5c90005]
[DEBUG,net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[DEBUG,net.sf.hibernate.SQL] insert into BUSINESS_ACTIVITIES (business_id, type, started) values (?, ?, ?)
Hibernate: insert into BUSINESS_ACTIVITIES (business_id, type, started) values (?, ?, ?)
.......
[DEBUG,net.sf.hibernate.collection.BasicCollectionPersister] done inserting rows: 3 inserted
[DEBUG,net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[DEBUG,net.sf.hibernate.impl.BatcherImpl] closing statement
[DEBUG,net.sf.hibernate.impl.SessionImpl] post flush
[DEBUG,net.sf.hibernate.transaction.JDBCTransaction] commit
[DEBUG,net.sf.hibernate.impl.SessionImpl] flushing session
.......
[DEBUG,net.sf.hibernate.engine.Cascades] cascading to collection: com.hic.eboss.Business.activities
[DEBUG,net.sf.hibernate.transaction.JDBCTransaction] rollback
[DEBUG,net.sf.hibernate.impl.SessionImpl] transaction completion
[DEBUG,net.sf.hibernate.impl.SessionImpl] flushing session
It's very odd. The schemaexport tool creates the right DDL given the above mapping file, and Hibernate seems to be making the write SQL. Still, an exception is thrown.
Any ideas or tips?
Thanks very much!
Seth
|