-->
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: Many-to-many cascade=none problem
PostPosted: Mon Jul 02, 2007 6:17 am 
Newbie

Joined: Tue Apr 24, 2007 2:43 am
Posts: 6
Hi all,

i am having a problem with a many-to-many (cascade="none") relationship.

since the information in the 'bridge' table wont be set when the object is updated (since the cascade=none). i wanted to write my own query. but i am getting a mapping error. i probebly have to write the tablename somewhere, but what i have tryed faild.

Code:
select_query = "insert into functiontype_compententionlevels_bridge CompetentionLevelId, FunctionTypeId values("+competentionLevels.get(i)+"," + functionTypeId +")";
query = session.createQuery(select_query);


if you have an other solution for my many-to-many problem, i would like to hear them too. But i am more interested in writing my own query..

thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 10:44 am 
Senior
Senior

Joined: Tue Jun 12, 2007 4:49 pm
Posts: 127
Location: India
Let us know when you are getting the mapping exception. AFAIK, executing this query cannot throw a mapping exception.


Kindly follow the forum template to get quick answers.

Regards,
Jitendra

*don't forget to rate if it helps*


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 1:42 pm 
Newbie

Joined: Tue Apr 24, 2007 2:43 am
Posts: 6
Code:
[eHRM] ERROR [http-8080-2] DispatcherUtils.serviceAction(237) | Could not execute action
org.hibernate.hql.ast.QuerySyntaxException: functiontype_compententionlevels_bridge is not mapped [delete from functiontype_compententionlevels_bridge where FunctionTypeId=1]
   at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
   at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
   at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
   at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:265)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.deleteStatement(HqlSqlBaseWalker.java:417)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:245)
   at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
   at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
   at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
   at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
   at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
   at nl.carthago_ict.eHRM.dao.hibernate.FunctionTypeDaoHibernate.saveFunctionTypeCompentionLevels(FunctionTypeDaoHibernate.java:50)
   at nl.carthago_ict.eHRM.service.impl.FunctionTypeManagerImpl.saveFunctionTypeCompentionLevels(FunctionTypeManagerImpl.java:58)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
   at $Proxy11.saveFunctionTypeCompentionLevels(Unknown Source)
   at nl.carthago_ict.eHRM.webapp.action.FunctionTypeAction.saveCompetentionLevels(FunctionTypeAction.java:115)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:364)
   at com.opensymphony.xwork.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:216)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
   at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:168)
   at com.opensymphony.xwork.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:115)
   at com.opensymphony.xwork.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.webwork.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:171)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:151)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:186)
   at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:188)
   at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:113)
   at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:225)
   at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
   at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:375)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at nl.carthago_ict.eHRM.webapp.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:42)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at nl.carthago_ict.eHRM.webapp.filter.LocaleFilter.doFilterInternal(LocaleFilter.java:55)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at com.opensymphony.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:42)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
   at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
   at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
   at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
   at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
   at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
   at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
   at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
   at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:108)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
   at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:193)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
   at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
   at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Unknown Source)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 09, 2007 1:26 pm 
Senior
Senior

Joined: Tue Jun 12, 2007 4:49 pm
Posts: 127
Location: India
Ah...

oversight on my part. You will need to createSqlQuery instead of createQuery. createQuery is for hql queries.

*Don't forget to rate*

Regards,
Jitendra


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.