My Hibernate mapping xml looks like this :-
<?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="com.cisco.dms.rco.profile.model.ProductServiceDeferral" table="CCRM_REV_DEF_ROLL_FWD_VW"
discriminator_value="pd">
<composite-id name="profileFinancialId" class="com.cisco.dms.rco.profile.model.ProfileFinancialId">
<key-property name="profileId">
<column name="PROFILE_ID"/>
</key-property>
<key-property name="offerType">
<column name="OFFER_TYPE"/>
</key-property>
<key-property name="fiscalPeriod">
<column name="FISCAL_PERIOD"/>
</key-property>
</composite-id>
<discriminator column="offer_type" type="character"/>
<property name="begManualDeferral" type="double">
<column name="BEG_MANUAL_DEF"/>
</property>
<property name="begManualRelease" type="double">
<column name="BEG_MANUAL_REL"/>
</property>
<property name="begManualReserve" type="double">
<column name="BEG_MANUAL_RES"/>
</property>
<property name="begManualUsage" type="double">
<column name="BEG_MANUAL_USAGE"/>
</property>
<property name="begAPHDeferral" type="double">
<column name="BEG_AE_DEFERRAL"/>
</property>
<property name="fx" type="double">
<column name="CURRENCY_EFFECT"/>
</property>
<property name="mrtaManualDeferral" type="double">
<column name="REV_TRANS_MANUAL_DEFERRAL"/>
</property>
<property name="mrtaManualRelease" type="double">
<column name="REV_TRANS_MANUAL_RELEASE"/>
</property>
<property name="mmaManualDeferral" type="double">
<column name="MANUAL_DEFERRAL"/>
</property>
<property name="mmaManualRelease" type="double">
<column name="MANUAL_RELEASE"/>
</property>
<property name="mmaManualReserve" type="double">
<column name="MANUAL_RESERVE"/>
</property>
<property name="mmaManualUsage" type="double">
<column name="MANUAL_USAGE"/>
</property>
<subclass name="ProductRevenue" discriminator-value="PRD_REV">
</subclass>
<subclass name="TSSCore" discriminator-value="TSS_REV">
</subclass>
</class>
<query name="product.deferral.productrevenue"><![CDATA[
select begManualDeferral,begManualRelease,begManualReserve,
begManualUsage,begAPHDeferral,fx,mrtaManualDeferral,mrtaManualRelease,
mmaManualDeferral,mmaManualRelease,mmaManualReserve,mmaManualUsage,profileFinancialId.offerType
from ProductServiceDeferral
where profileFinancialId.profileId=? and profileFinancialId.fiscalPeriod=?
]]>
</query>
</hibernate-mapping>
I am using Tomcat 5.0.28 and hibernate version is 3 .
My database is oracle 9i.When Tomcat starts,I get following exception.The root error is "Attribute "discriminator_value" must be declared for element type "class" as can be seen from the stack trace below.Any pointers? Thanks
org.hibernate.MappingException: Could not read mappings from resource: com/cisco/dms/rco/profile/model/CcrmProfileFinancial.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:523)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1511)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1479)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1458)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1432)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1367)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:627)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:625)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:431)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:463)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:520)
... 41 more
Caused by: org.xml.sax.SAXParseException: Attribute "discriminator_value" must be declared for element type "class".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:460)
|