Here's the code that doesn't work:
ApplExpertise myApplExpertise = new ApplExpertise(this.applId);
session.save(myApplExpertise);
It crashes in session.save. I inserted a row manually and was able to update it. But for some reasons, it won't insert.
Thx
Hibernate version: version 3.0.5, 25 May 2005
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>
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class name="hibernate.ApplExpertise" table="APPL_EXPERTISE">
<id name="applId" type="java.lang.Integer" column="Appl_ID" unsaved-value="null">
<generator class="assigned"/>
</id>
<property name="keywords" type="java.lang.String" column="Keywords" length="255"/>
<property name="disciplineCode1" type="java.lang.Integer" column="Discipline_Code_1" length="5"/>
<property name="otherDisciplineName1" type="java.lang.String" column="Other_Discipline_Name_1" length="40"/>
<property name="disciplineCode2" type="java.lang.Integer" column="Discipline_Code_2" length="5"/>
<property name="otherDisciplineName2" type="java.lang.String" column="Other_Discipline_Name_2" length="40"/>
<property name="disciplineCode3" type="java.lang.Integer" column="Discipline_Code_3" length="5"/>
<property name="otherDisciplineName3" type="java.lang.String" column="Other_Discipline_Name_3" length="40"/>
<property name="disciplineCode4" type="java.lang.Integer" column="Discipline_Code_4" length="5"/>
<property name="otherDisciplineName4" type="java.lang.String" column="Other_Discipline_Name_4" length="40"/>
<property name="disciplineCode5" type="java.lang.Integer" column="Discipline_Code_5" length="5"/>
<property name="otherDisciplineName5" type="java.lang.String" column="Other_Discipline_Name_5" length="40"/>
<property name="areaOfResearchCode1" type="java.lang.Integer" column="Area_Of_Research_Code_1" length="4"/>
<property name="areaOfResearchCode2" type="java.lang.Integer" column="Area_Of_Research_Code_2" length="4"/>
<property name="areaOfResearchCode3" type="java.lang.Integer" column="Area_Of_Research_Code_3" length="4"/>
<property name="geoPoliticalCode1" type="java.lang.Integer" column="GeoPolitical_Code_1" length="4"/>
<property name="geoPoliticalCode2" type="java.lang.Integer" column="GeoPolitical_Code_2" length="4"/>
<property name="geoPoliticalCode3" type="java.lang.Integer" column="GeoPolitical_Code_3" length="4"/>
<property name="countryCode1" type="java.lang.Integer" column="Country_Code_1" length="5"/>
<property name="provinceStateCode1" type="java.lang.String" column="Province_State_Code_1" length="2"/>
<property name="countryCode2" type="java.lang.Integer" column="Country_Code_2" length="5"/>
<property name="provinceStateCode2" type="java.lang.String" column="Province_State_Code_2" length="2"/>
<property name="countryCode3" type="java.lang.Integer" column="Country_Code_3" length="5"/>
<property name="provinceStateCode3" type="java.lang.String" column="Province_State_Code_3" length="2"/>
<property name="countryCode4" type="java.lang.Integer" column="Country_Code_4" length="5"/>
<property name="provinceStateCode4" type="java.lang.String" column="Province_State_Code_4" length="2"/>
<property name="countryCode5" type="java.lang.Integer" column="Country_Code_5" length="5"/>
<property name="provinceStateCode5" type="java.lang.String" column="Province_State_Code_5" length="2"/>
<property name="temporalStartYear1" type="java.lang.Integer" column="Temporal_Start_Year_1" length="10"/>
<property name="temporalStartBcAd1" type="java.lang.String" column="Temporal_Start_BC_AD_1" length="2"/>
<property name="temporalEndYear1" type="java.lang.Integer" column="Temporal_End_Year_1" length="10"/>
<property name="temporalEndBcAd1" type="java.lang.String" column="Temporal_End_BC_AD_1" length="2"/>
<property name="temporalStartYear2" type="java.lang.Integer" column="Temporal_Start_Year_2" length="10"/>
<property name="temporalStartBcAd2" type="java.lang.String" column="Temporal_Start_BC_AD_2" length="2"/>
<property name="temporalEndYear2" type="java.lang.Integer" column="Temporal_End_Year_2" length="10"/>
<property name="temporalEndBcAd2" type="java.lang.String" column="Temporal_End_BC_AD_2" length="2"/>
<property name="humanSubjectResearchInd" type="java.lang.String" column="Human_Subject_Research_Ind" length="1"/>
<property name="createDate" type="java.sql.Timestamp" column="Create_Date" length="23" insert="false" update="false"/>
<property name="createUserId" type="java.lang.String" column="Create_User_ID" length="3" update="false" insert="false"/>
<property name="changeDate" type="java.sql.Timestamp" column="Change_Date" length="23" insert="false" update="false"/>
<property name="changeUserId" type="java.lang.String" column="Change_User_ID" length="3" insert="false" update="false"/>
<property name="environmentalAssessmentInd" type="java.lang.String" column="Environmental_Assessment_Ind" length="1"/>
<!-- associations -->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
org.hibernate.MappingException: Unknown entity:
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:569)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1086)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:409)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:82)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:463)
at ca.sshrc.web.forms.beans.programs.ParticipantBean.save(ParticipantBean.java:399)
at ca.sshrc.web.common.services.CommonAction.save(CommonAction.java:205)
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:324)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at ca.sshrc.web.common.services.filters.GZIPFilter.doFilter(GZIPFilter.java:20)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at ca.sshrc.web.common.services.filters.NavigationFilter.doFilter(NavigationFilter.java:124)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at ca.sshrc.web.common.services.filters.SessionExpiredFilter.doFilter(SessionExpiredFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Name and version of the database you are using:ASE 12