I am getting this error at session.flush();
I am really confused.
Code:
17:27:33,962 ERROR [STDERR] net.sf.hibernate.HibernateException: identifier of a
n instance of com.nielsenmedia.myEVNTS.Episode altered from 8aad0b01f8c7c0e800f8
c7c1c3ab0002 to null
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2141
)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:20
17)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2004)
at com.nielsenmedia.myEVNTS.server.ProcessEchoEJB.flushAndCloseSession(P
rocessEchoEJB.java:323)
at com.nielsenmedia.myEVNTS.server.ProcessEchoEJB.testWithHibernate(Proc
essEchoEJB.java:156)
at com.nielsenmedia.myEVNTS.server.ProcessEchoEJB.createMultiplePrograms
WithHibernate(ProcessEchoEJB.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
tatelessSessionContainer.java:550)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
ke(CachedConnectionInterceptor.java:114)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
elessSessionInstanceInterceptor.java:47)
at org.jboss.ejb.plugins.TxSupport.invokeInOurTx(TxSupport.java:213)
at org.jboss.ejb.plugins.TxSupport$Required.serverInvoke(TxSupport.java:
655)
at org.jboss.ejb.plugins.TxInterceptorCMT.internalInvoke(TxInterceptorCM
T.java:104)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:5
6)
at org.jboss.security.RunAsSecurityInterceptor.invoke(RunAsSecurityInter
ceptor.java:61)
at org.jboss.security.RoleBasedAuthorizationInterceptor.invoke(RoleBased
AuthorizationInterceptor.java:54)
at org.jboss.security.AuthenticationInterceptor.invoke(AuthenticationInt
erceptor.java:65)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:117)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:102)
at org.jboss.ejb.Container.invoke(Container.java:1159)
at org.jboss.ejb.Container.invoke(Container.java:1281)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:7
2)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:544)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:90)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
a:89)
at org.jboss.ejb.plugins.TxSupport$Required.clientInvoke(TxSupport.java:
644)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
java:129)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:8
1)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessi
onInterceptor.java:110)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:84)
at $Proxy56.createMultipleProgramsWithHibernate(Unknown Source)
at org.apache.jsp.RequestProcessor_jsp._jspService(RequestProcessor_jsp.
java:75)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
95)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.jboss.web.catalina.security.JBossSecurityMgrRealm.invoke(JBossSec
urityMgrRealm.java:236)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.jboss.web.catalina.statistics.ContainerStatsValve.invoke(Containe
rStatsValve.java:75)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
509)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:22
3)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:619)
at java.lang.Thread.run(Thread.java:534)
My mapping file is
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.nielsenmedia.myEVNTS.DistributorProgram" table="dist_program">
<!-- A 32 hex character is our surrogate key. It's automatically
generated by Hibernate with the UUID pattern. -->
<id name="programID" type="string" unsaved-value="null" >
<column name="PROGRAM_ID" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>
<!-- A program has to have a name, but it shouldn' be too long. -->
<property name="programName">
<column name="PROGRAM_NAME" sql-type="varchar(16)" not-null="true"/>
</property>
<!-- A program has to have a name, but it shouldn' be too long. -->
<property name="duration">
<column name="PROGRAM_DURATION" sql-type="int" not-null="true"/>
</property>
<bag name = "episodes" inverse="true" lazy="true" cascade="all">
<key column="EPISODE_ID"/>
<one-to-many class="com.media.myEVNTS.Episode"/>
</bag>
</class>
<class name="com.media.myEVNTS.Episode" table="episode" dynamic-update="true">
<id name="episodeID" column="EPISODE_ID" type="string">
<generator class="uuid.hex"/>
</id>
<property name="episodeName">
<column name="EPISODE_NAME" sql-type="varchar(16)"/>
</property>
<property name="episodeNo">
<column name="EPISODE_NO" sql-type="int"/>
</property>
<many-to-one name="distributorProgram" column="PROGRAM_ID_FK" not-null="true"/>
</class>
</hibernate-mapping>
[/code]