Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.2
Mapping documents:Code:
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" default-cascade="all-delete-orphan" default-lazy="false">
<!-- Mapping the elements of the TypeFile class -->
<class discriminator-value="[uk.gov.nationalarchives.xip.TypeFile]"
name="uk.gov.nationalarchives.xip.TypeFile"
table="DIGITALFILE">
<!-- <id>
<column name="METADATAREF"/>
<type name="org.hibernate.type.LongType"/>
<generator class="sequence">
<param name="sequence">hibernate_sequence</param>
</generator>
</id> -->
<id name="FileRef" type="org.hibernate.type.StringType">
<column name="FILEREF"/>
</id>
<property name="WorkingPath" type="org.hibernate.type.StringType">
<column name="FILELOCATION" />
</property>
<property name="FileName" type="org.hibernate.type.StringType" >
<column name="NAME" not-null="true"/>
</property>
<property name="FileSize" type="org.hibernate.type.LongType">
<column name="FILESIZE" />
</property>
<property access="com.tessella.sdb.core.metadatastore2.GregorianCalendarAccessor"
name="LastModifiedDate">
<column name="LASTMODIFIEDDATE"/>
<type name="org.hibernate.type.DateType"/>
</property>
<property name="IngestedFileSetRef" type="org.hibernate.type.StringType">
<column name="INGESTEDFILESETREF" />
</property>
<property name="Extant" type="org.hibernate.type.BooleanType">
<column name="EXTANT" not-null="true"/>
</property>
<property name="Valid" type="org.hibernate.type.BooleanType">
<column name="DELETED" />
</property>
<property name="Directory" type="org.hibernate.type.BooleanType">
<column name="DIRECTORY" />
</property>
<bag name="fileProperty" access="field" table="DIGITALFILEPROPERTY" cascade="all-delete-orphan">
<key column="FILEREF" not-null="true" />
<one-to-many class="uk.gov.nationalarchives.xip.TypeFileProperty" not-found="ignore"/>
</bag>
<bag name="fixityInfo" access="field" table="DIGITALFILEFIXITYINFO" cascade="all-delete-orphan">
<key column="FILEREF" not-null="true"/>
<one-to-many class="uk.gov.nationalarchives.xip.TypeFixityInfo" not-found="ignore"/>
</bag>
<bag name="formatInfo" access="field" table="DIGITALFILEFORMAT" cascade="all-delete-orphan">
<key column="FILEREF" not-null="true" />
<one-to-many class="uk.gov.nationalarchives.xip.TypeFormatInfo" not-found="ignore"/>
</bag>
<any access="com.tessella.sdb.core.metadatastore2.FileMetadataAccessor"
name="metadata" id-type="org.hibernate.type.LongType">
<column name="column1"/>
<column name="column2"/>
</any>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:Code:
2008-08-22 15:23:48,595 INFO [org.springframework.context.support.ClassPathXmlApplicationContext] - <Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1ee4648: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1ee4648]; startup date [Fri Aug 22 15:23:48 BST 2008]; root of context hierarchy>
2008-08-22 15:23:48,626 DEBUG [org.springframework.util.ClassUtils] - <Class [edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap] or one of its dependencies is not present: java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap>
2008-08-22 15:23:48,689 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from class path resource [com/tessella/sdb/core/metadatastore2/beans.xml]>
2008-08-22 15:23:48,705 DEBUG [org.springframework.beans.factory.xml.DefaultDocumentLoader] - <Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]>
2008-08-22 15:23:48,751 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] - <Loading schema mappings from [META-INF/spring.schemas]>
2008-08-22 15:23:48,767 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] - <Loaded schema mappings: {http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jms/spring-jms-2.5.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/jms/spring-jms.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd}>
2008-08-22 15:23:48,767 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] - <Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.5.xsd>
2008-08-22 15:23:48,923 DEBUG [org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader] - <Loading bean definitions>
2008-08-22 15:23:48,970 DEBUG [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loaded 2 bean definitions from location pattern [classpath:com/tessella/sdb/core/metadatastore2/beans.xml]>
2008-08-22 15:23:48,970 INFO [org.springframework.context.support.ClassPathXmlApplicationContext] - <Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@1ee4648]: org.springframework.beans.factory.support.DefaultListableBeanFactory@ff2413>
2008-08-22 15:23:48,970 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] - <2 beans defined in org.springframework.context.support.ClassPathXmlApplicationContext@1ee4648: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1ee4648]; startup date [Fri Aug 22 15:23:48 BST 2008]; root of context hierarchy>
2008-08-22 15:23:48,986 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] - <Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@ad8659]>
2008-08-22 15:23:48,986 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] - <Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@1b5998f]>
2008-08-22 15:23:49,001 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@ff2413: defining beans [dataSource,sessionFactory]; root of factory hierarchy>
2008-08-22 15:23:49,001 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Creating shared instance of singleton bean 'dataSource'>
2008-08-22 15:23:49,001 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Creating instance of bean 'dataSource' with merged definition [Root bean: class [org.apache.commons.dbcp.BasicDataSource]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=close; defined in class path resource [com/tessella/sdb/core/metadatastore2/beans.xml]]>
2008-08-22 15:23:49,048 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Eagerly caching bean 'dataSource' to allow for resolving potential circular references>
2008-08-22 15:23:49,095 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Creating shared instance of singleton bean 'sessionFactory'>
2008-08-22 15:23:49,095 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Creating instance of bean 'sessionFactory' with merged definition [Root bean: class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [com/tessella/sdb/core/metadatastore2/beans.xml]]>
2008-08-22 15:23:49,126 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Eagerly caching bean 'sessionFactory' to allow for resolving potential circular references>
2008-08-22 15:23:49,126 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Returning cached instance of singleton bean 'dataSource'>
2008-08-22 15:23:49,657 INFO [org.springframework.orm.hibernate3.LocalSessionFactoryBean] - <Building new Hibernate SessionFactory>
FileMetadataAccessor used 1
FileMetadataAccessor used 2
FileMetadataSetter used 2
2008-08-22 15:23:52,157 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] - <Publishing event in context [org.springframework.context.support.ClassPathXmlApplicationContext@1ee4648]: org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.context.support.ClassPathXmlApplicationContext@1ee4648: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1ee4648]; startup date [Fri Aug 22 15:23:48 BST 2008]; root of context hierarchy]>
2008-08-22 15:23:52,157 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Returning cached instance of singleton bean 'sessionFactory'>
8
2008-08-22 15:23:52,876 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] - <Opening Hibernate Session>
2008-08-22 15:23:53,094 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] - <Closing Hibernate Session>
Exception in thread "main" org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: java.lang.String; nested exception is org.hibernate.MappingException: Unknown entity: java.lang.String
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:659)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:378)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:693)
at com.tessella.sdb.core.metadatastore2.Store.main(Store.java:75)
Caused by: org.hibernate.MappingException: Unknown entity: java.lang.String
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:80)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:431)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:696)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:373)
... 2 more
I'm getting an org.hibernate.MappingException: Unknown entity: java.lang.String exception and I can't understand why, can anyone help me with this? Thanks