-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Please HELP!!!
PostPosted: Fri Jun 23, 2006 6:36 am 
Newbie

Joined: Thu Jun 01, 2006 5:09 am
Posts: 16
Hibernate version: 3

Full stack trace of any exception that occurs:11:32:17,406 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
javax.servlet.ServletException: Error calling action method of component with id _tagId0:_tagId131
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
11:32:17,406 INFO [SeamExceptionFilter] killing transaction
11:32:17,406 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Error calling action method of component with id _tagId0:_tagId131
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.faces.el.EvaluationException: /editPersone.xhtml @488,126 action="#{personeEditor.update}": org.hibernate.HibernateException: identifier of an instance of unibiblio.dati.anagrafica.DAO.DizNazioni was altered from IL to IT
at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
... 31 more
Caused by: org.hibernate.HibernateException: identifier of an instance of unibiblio.dati.anagrafica.DAO.DizNazioni was altered from IL to IT
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:58)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:157)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:957)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1529)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at unibiblio.business.anagrafica.BO.PersoneFinder.executeQuery(PersoneFinder.java:114)
at unibiblio.business.anagrafica.BO.PersoneFinder.refresh(PersoneFinder.java:143)
at unibiblio.business.anagrafica.BO.PersoneFinder$$EnhancerByCGLIB$$95043fe2.CGLIB$refresh$2(<generated>)
at unibiblio.business.anagrafica.BO.PersoneFinder$$EnhancerByCGLIB$$95043fe2$$FastClassByCGLIB$$1d69d22d.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
at org.jboss.seam.interceptors.JavaBeanInterceptor$1.proceed(JavaBeanInterceptor.java:80)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.interceptors.ValidationInterceptor.validateTargetComponent(ValidationInterceptor.java:65)
at sun.reflect.GeneratedMethodAccessor136.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:32)
at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
at sun.reflect.GeneratedMethodAccessor135.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:58)
at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:58)
at sun.reflect.GeneratedMethodAccessor129.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at unibiblio.business.anagrafica.Autenticazione.LoggedInInterceptor.checkLoggedIn(LoggedInInterceptor.java:31)
at sun.reflect.GeneratedMethodAccessor326.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:30)
at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:38)
at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:41)
at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:51)
at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:39)
at unibiblio.business.anagrafica.BO.PersoneFinder$$EnhancerByCGLIB$$95043fe2.refresh(<generated>)
at unibiblio.business.anagrafica.BO.PersoneEditor.refreshFinder(PersoneEditor.java:282)
at unibiblio.business.anagrafica.BO.PersoneEditor.update(PersoneEditor.java:270)
at unibiblio.business.anagrafica.BO.PersoneEditor$$EnhancerByCGLIB$$17708f69.CGLIB$update$3(<generated>)
at unibiblio.business.anagrafica.BO.PersoneEditor$$EnhancerByCGLIB$$17708f69$$FastClassByCGLIB$$6c7d7296.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
at org.jboss.seam.interceptors.JavaBeanInterceptor$1.proceed(JavaBeanInterceptor.java:80)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.interceptors.ValidationInterceptor.validateTargetComponent(ValidationInterceptor.java:47)
at sun.reflect.GeneratedMethodAccessor136.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:32)
at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
at sun.reflect.GeneratedMethodAccessor135.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:58)
at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:58)
at sun.reflect.GeneratedMethodAccessor129.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at unibiblio.business.anagrafica.Autenticazione.LoggedInInterceptor.checkLoggedIn(LoggedInInterceptor.java:31)
at sun.reflect.GeneratedMethodAccessor326.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:30)
at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:38)
at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:41)
at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:51)
at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:39)
at unibiblio.business.anagrafica.BO.PersoneEditor$$EnhancerByCGLIB$$17708f69.update(<generated>)
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 com.sun.el.parser.AstValue.invoke(AstValue.java:130)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)

Name and version of the database:Postgres 8.0




Hi everybody, i'm going hell for a problem about hibernate and collections.
I have two mapped classes:
public class Indirizzi implements java.io.Serializable {
private int idIndirizzo; (ID)

private DizNazioni dizNazioni;

private String indirizzo;
.................(other code)
}

public class DizNazioni implements java.io.Serializable {

private String siglanazione; (ID)

private String nazione;

private Set<Indirizzi> indirizzis = new HashSet<Indirizzi>(0);
.................(other code)

}

and hbm mapping files:
<hibernate-mapping>
<class name="unibiblio.dati.anagrafica.DAO.Indirizzi" table="indirizzi">
<id name="idIndirizzo" type="int">
<column name="id_indirizzo" />
<generator class="sequence">
<param name="sequence">seq_generica</param>
</generator>
</id>
<many-to-one name="dizNazioni" class="unibiblio.dati.anagrafica.DAO.DizNazioni" fetch="select">
<column name="siglanazione" length="2" not-null="true" />
</many-to-one>
<property name="indirizzo" type="string">
<column name="indirizzo" length="40" />
</property>
</class>
</hibernate-mapping>

and

<hibernate-mapping>
<class name="unibiblio.dati.anagrafica.DAO.DizNazioni" table="diz_nazioni">
<id name="siglanazione" type="string">
<column name="siglanazione" length="2" />
<generator class="assigned" />
</id>
<property name="nazione" type="string">
<column name="nazione" length="50" not-null="true" />
</property>
<set name="indirizzis" inverse="true">
<key>
<column name="siglanazione" length="2" not-null="true" />
</key>
<one-to-many class="unibiblio.dati.anagrafica.DAO.Indirizzi" />
</set>
</class>
</hibernate-mapping>

Well, I'll have a DizNazioni record associated to 1..n indirizzi, and I can associate a DizNazioni to an Indirizzi choosing from lot DizNazioni.
I made a form to insert and modify Indirizzi data:

edit: indirizzo
dropdown: DizNazioni

When I insert it works but if I try to modify it throw error:
identifier of an instance of unibiblio.dati.anagrafica.DAO.DizNazioni was altered from IL to IT

It seems to try to change ID for DizNazioni record instead of change reference in Indirizzi record of it.
How do I have to work? Where's my mistake?

Thanks
Peppe


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 23, 2006 7:42 am 
Regular
Regular

Joined: Wed Jan 11, 2006 12:49 pm
Posts: 64
Location: Campinas, Brazil
You cannot change the value of an identifier. This is one principle you must respect when you are using Hibernate. As a result, you should also not make identifier fields editable by your application users once the entity has been persisted.
To solve this you just have to create another (perhaps auto generated) identifier field and a unique index for the field that is your primary key now. That way you keep semantics intact and everything will work just fine. You will not need to change the database's Foreign Key as long as you change the mapping to specify the column that your FK refers to.

_________________
Henrique Sousa
Don't forget to rate useful responses


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 23, 2006 11:41 am 
Newbie

Joined: Thu Jun 01, 2006 5:09 am
Posts: 16
Yes, ok but I don't want to change the DizNazioni's ID but the reference to it in the table indirizzi.
How I said in the form I use to insert indirizzi data I've a combo full of DizNazioni records. When I choose a record inside it I wish change indirizzi.DizNazioni value.
This action gives me the error.
More clearly:
Suppose I've a combo "nazioni". To it I associate value="#{backbean.nazione}"
in the backbean I create
setNazione(value){
indirizzi.setDizNazioni(session.get(DizNazioni.class, value);
}
this gives me the error.
If I do:
setNazione(value){
localnazioni = value;
}
and then in the update method I do:
indirizzi.setDizNazioni(session.get(DizNazioni.class, localnazioni);
session.persist(indirizzi);
it does work!!
WHY????


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 23, 2006 2:49 pm 
Regular
Regular

Joined: Wed Jan 11, 2006 12:49 pm
Posts: 64
Location: Campinas, Brazil
This is happening almost certainly because you are (or some famework) reusing attached (session-managed) instances of unibiblio.dati.anagrafica.DAO.DizNazioni. By using session.get(DizNazioni.class, id) you are getting a fresh attached instance with the id you want, and then you don't change it until session.update(). This is certain to work.
Try putting a breakpoint into DizNazioni.setSiglanazione, then use the Thread stack to trace where it is being called from when you select the value from the combo; compare the current value of with the one passed in, if they are different you have the source of the problem.
Also, I saw people suggesting to use session.merge() instead of update(), though I always use merge() since it is the method available throught EJB 3.

_________________
Henrique Sousa
Don't forget to rate useful responses


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.