-->
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.  [ 1 post ] 
Author Message
 Post subject: Many to Many unidirectional
PostPosted: Thu Nov 04, 2004 7:06 pm 
Beginner
Beginner

Joined: Thu Sep 23, 2004 6:03 am
Posts: 27
2.1:

org.springframework.orm.hibernate.HibernateSystemException: Batch update row count wrong: 0; nested exception is net.sf.hibernate.HibernateException: Batch update row count wrong: 0
net.sf.hibernate.HibernateException: Batch update row count wrong: 0
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:65)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:59)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:56)
at net.sf.hibernate.impl.BatcherImpl.prepareBatchStatement(BatcherImpl.java:109)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:659)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:640)
at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2407)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2361)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2229)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:447)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:375)
at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:241)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152)
at $Proxy13.saveLicence(Unknown Source)
at au.edu.tlf.lips.webapp.action.RightsFormController.onSubmit(RightsFormController.java:207)
at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:223)
at au.edu.tlf.lips.webapp.action.RightsFormController.processFormSubmission(RightsFormController.java:142)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:237)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:121)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:495)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:321)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:73)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.opensymphony.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at au.edu.tlf.lips.webapp.filter.ActionFilter.doFilter(ActionFilter.java:160)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at au.edu.tlf.lips.webapp.filter.BreadcrumbFilter.doFilter(BreadcrumbFilter.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at au.edu.tlf.lips.webapp.filter.GZIPFilter.doFilter(GZIPFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:587)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Unknown Source)


MySQL 4:

Hi,

I'm having difficulty trying to implement this association
in my project. I have a Rights class that is composed of

id
rightsType
conditionType
notes

Then I have a many to many relationship with another class
conditionTypeValue. I am trying to populate the join table
with conditionTypeIds and conditionTypeValuesId but am
having difficulties trying to implement it. Can anyone see
where I'm going wrong. Any help would be great

Thanks


create table condition_type_value (
id BIGINT NOT NULL AUTO_INCREMENT,
has_text BIT,
is_defaulted_value BIT,
value VARCHAR(255),
fk_condition_type_value_id BIGINT,
primary key (id)
);

create table table_join_rights_condition_type_value (
fk_rights_id BIGINT not null,
fk_rights BIGINT not null
);

create table rights (
id BIGINT NOT NULL AUTO_INCREMENT,
comments VARCHAR(255),
rights_id BIGINT,
fk_rights_type_id BIGINT,
fk_condition_type_id BIGINT,
primary key (id)
);



I was hoping that someone might be able to point me in a
certain direction with regard to what I am trying to do. As
you can see for the generated SQL I have a many to many
relationship between rights and conditionTypeValues, what I
would also like to be able to do is add another attribute to
table_join_rights_condition_type_value to capture comments.
How is this done? I am using Xdoclet to generate the
hibernate mappings, any input would be more appreicated.

RIGHTS CLASS
-----------------------------------------
/**
* @return Returns the conditionTypeValue.
* @hibernate.bag
* table="table_join_rights_condition_type_value"
* cascade="all"
* inverse="true"
* @hibernate.collection-key
* column="fk_rights_id"
* @hibernate.collection-many-to-many
* class="au.edu.tlf.lips.model.ConditionTypeValue"
* column="fk_rights"
*/
public List getConditionTypeValue() {
return conditionTypeValue;
}

/**
* @param conditionTypeValue The conditionTypeValue to set.
*/
public void setConditionTypeValue(List conditionTypeValue) {
this.conditionTypeValue = conditionTypeValue;
}



RightsForm
-------------

public ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException
errors)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("entering 'onSubmit' method...");
}

//define the licence
Licence licence = (Licence) command;

//set up list to contain all rights
List rights = new LinkedList();

//a single instance of a right
Rights right = null;

//success screen
String success = getSuccessView();

//get the parent rights type
String rightsTypeId = request.getParameter("rightsTypeId");
RightsType rightsType =
rightsTypeMgr.getRightsType(Long.valueOf(rightsTypeId));

//get conditions that applied to that rightsType
List conditionTypes =
conditionTypeMgr.getAllCondtionTypesForRightsType(rightsType);
Iterator keys = conditionTypes.iterator();

//for each condition set actual right information
while(keys.hasNext()){
ConditionType conditionType = (ConditionType)keys.next();

//populate right object
right = new Rights();
right.setLicence(licence);
right.setRightsType(rightsType);
right.setConditionType(conditionType);

List conditionTypeValuesToAddToRights = new LinkedList();
List conditionTypeValuesToAddToConditions = new LinkedList();

String[] requestIds =
request.getParameterValues(conditionType.getId().toString());

for(int i=0; i<requestIds.length; i++) {
ConditionTypeValue conditionTypeValue =
conditionTypeValueMgr.getConditionTypeValue(Long.valueOf(requestIds[i]));
conditionTypeValuesToAddToRights.add(conditionTypeValue);
}
right.setConditionTypeValue(conditionTypeValuesToAddToRights);

rightsMgr.saveRights(right);

rights.add(right);
}

rightsMgr.removeRights(licence);

licence.setRights(rights);

licenceMgr.saveLicence(licence);


String message = getMessageSourceAccessor().getMessage(
"rights.updated",
new Object[] { licence.getLicenceDescriptor() });

saveMessage(request, message);

success = "viewLicence.html?id=" + licence.getId();

return new ModelAndView(new RedirectView(success));
}


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

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.