This deletion code works fine in v2. Had the same problem in alpha, waited until b to report. Bug or misconfiguration ?
Hibernate version: 3.0beta1
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="fi.documenta.dng.domain.doc.DocumentEntity"
table="DOCUMENT">
<id
name="id"
column="ID">
<generator class="increment"/>
</id>
<property
name="creationDate"
column="CREATION_DATE"/>
<property
name="documentName"
column="DOCUMENT_NAME"/>
<set name="documentVersions" table="DOCUMENTVERSION" inverse="true" cascade="all" lazy="true">
<key column="DOCUMENT_ID" />
<one-to-many class="fi.documenta.dng.domain.doc.DocumentVersionEntity" />
</set>
<set name="documentGroups" table="DocumentReference" inverse="true" cascade="all" lazy="true">
<key column="referred_document_id" />
<one-to-many class="fi.documenta.dng.domain.doc.DocumentReferenceEntity" />
</set>
<set name="accessControlList" table="DOCUMENT_ACL_ENTRY" inverse="true" cascade="all" lazy="false">
<key column="document_id" />
<one-to-many class="fi.documenta.dng.domain.doc.sec.DocumentAclEntryEntity" />
</set>
<many-to-one name="latestVersion" class="fi.documenta.dng.domain.doc.DocumentVersionEntity" column="LATEST_DOC_VERSION_ID" cascade="none"/>
<many-to-one name="latestReadyVersion" class="fi.documenta.dng.domain.doc.DocumentVersionEntity" column="LATEST_READY_VERSION_ID" cascade="none"/>
<filter name="docAuthFilter" condition="exists(select * from DOCUMENT_ACL_ENTRY acl, DOCUMENT_PERMISSION p where acl.document_id=id and acl.id=p.acl_id and :permissionType=p.permission_type and acl.immutable_principal_name in (:principal1, :principal2, :principal3, :principal4, :principal5))"/>
</class>
<filter-def name="docAuthFilter">
<filter-param name="principal1" type="string"/>
<filter-param name="principal2" type="string"/>
<filter-param name="principal3" type="string"/>
<filter-param name="principal4" type="string"/>
<filter-param name="principal5" type="string"/>
<filter-param name="permissionType" type="string"/>
</filter-def>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
public void deleteDocument(Long docId) throws Exception {
ses().delete("from DocumentEntity as de where de.id=" + docId);
}
Full stack trace of any exception that occurs:
2005-01-11 10:38:01,215 DEBUG [fi.documenta.dng.domain.doc.DocumentSFCProxyImpl] Entering method deleteDocument(java.lang.Long 4).
2005-01-11 10:38:01,215 DEBUG [org.hibernate.event.DefaultCopyEventListener] deleting a transient instance
2005-01-11 10:38:01,215 DEBUG [org.hibernate.impl.SessionImpl] closing session
2005-01-11 10:38:01,225 ERROR [fi.documenta.dng.mvc.doc.FolderContentsAction] fi.documenta.fwk.exception.BackEndException: org.hibernate.MappingException: Unknown entity: java.lang.String
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:444)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1259)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1264)
at org.hibernate.event.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:56)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:629)
at fi.documenta.dng.domain.doc.DocumentSFCProxyImpl.deleteDocument(DocumentSFCProxyImpl.java:333)
Name and version of the database you are using:
MySQL 4.1.7
The generated SQL (show_sql=true):
None generated before exception.
Debug level Hibernate log excerpt:
see above
|