ISA-tools / BioInvIndex

The web application, model, database persistence, services package and web services for the BII. Led by Eamonn Maguire (Uni. of Oxford) & Philippe Rocca-Serra (Uni. of Oxford).
http://www.isa-tools.org
16 stars 13 forks source link

How to... #52

Open pconesa opened 12 years ago

pconesa commented 12 years ago

Hi!

W have added in our fork 3 more entities to the model.

Study ---n--> AssayGroup --n-->Metabolite --n--> MetaboliteSample.

Load and save into the database works fine....but unloading is not working.

I have done this:

StudyUnloader.unload --> unloadManager.queueAll ( study.getAssayGroups() );

UnloadManager.unloaderClassses --> // Pablo Conesa, add unloader for metabolites new UnloaderMapping(AssayGroup.class, AssayGroupUnloader.class), new UnloaderMapping(Metabolite.class, MetaboliteUnloader.class), new UnloaderMapping(MetaboliteSample.class, MetaboliteSampleUnloader.class)

And I have created the correspondent unloaders: AssayGroupUnloader, MetaboliteUnloader, MetaboliteSampleUnloader

Am I missing anything...this is not working!

Cheers!

eamonnmag commented 12 years ago

I guess it's to do with the order. Perhaps @marco-brandizi can shed some light on this?

pconesa commented 12 years ago

This is what I get when unloading using the SimpleManager:

2012-05-11 11:06:27,264 []: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) org.hibernate.AssertionFailure: collection [uk.ac.ebi.bioinvindex.model.Metabolite.metaboliteSamples] was not processed by flush() at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:228) at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:356) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:65) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1141) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67) at uk.ac.ebi.bioinvindex.unloading.AbstractUnloader.hasNoReferringEntities(AbstractUnloader.java:339) at uk.ac.ebi.bioinvindex.unloading.AbstractUnloader.delete(AbstractUnloader.java:265) at uk.ac.ebi.bioinvindex.unloading.AbstractUnloader.deleteAll(AbstractUnloader.java:214) at uk.ac.ebi.bioinvindex.unloading.UnloadManager.deleteType(UnloadManager.java:521) at uk.ac.ebi.bioinvindex.unloading.UnloadManager.delete(UnloadManager.java:483) at org.isatools.isatab.ISATABUnloader.unload(ISATABUnloader.java:128) at org.isatools.isatab.gui_invokers.GUIISATABUnloader.unload(GUIISATABUnloader.java:108) at org.isatools.isatab.manager.SimpleManager.unLoadISAtab(SimpleManager.java:366) at org.isatools.isatab.manager.SimpleManager.unLoadISAtab(SimpleManager.java:392) at uk.ac.ebi.metabolights.metabolightsuploader.IsaTabUploader.unloadISATabFile(IsaTabUploader.java:492) at uk.ac.ebi.metabolights.controller.UpdateStudyController.updateStudy(UpdateStudyController.java:419) 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:597) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) 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:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:680)

NOTE: Our entities do not have timestamp (don't ask me why!). Is this critical?

eamonnmag commented 12 years ago

Unloading is one part I haven't yet dug into. I understand the loading and persistence fairly well, but i'd need to check the mechanisms used for deciding what to unload. I would guess that the timestamp is required. I remember a conversation with marco a while ago about how things were unloaded and I believe that time was one thing used in the process.

marco-brandizi commented 12 years ago

I haven't touched this code for quite a while (I'm no longer in this project), so I can only talk about what I remember. The submission timestamp of the objects to be possibly deleted is inspected to check whether it is the same as the timestamp of the study that was requested to delete. When I designed this we wanted to be able to delete reusable objects (e.g., ReferenceSource) if these are left unused and belonging to the same submission that is being deleted.

This way of loading/unloading should be reviewed in favour of an approach that relies more on hibernate's cascading functionality. For the moment, best thing is to extend from unloaders of most similar object types (eg, MaterialUnloader should be the thing closest MetaboliteSampleUnloader). The most important thing that the loader/unloading code deals with is the operation's order and linking/unlinking things before/after a storage operation, so that Hibernate doesn't complain about referential integrity.

marco-brandizi commented 12 years ago

I haven't touched this code for quite a while (I'm no longer in this project), so I can only talk about what I remember. The submission timestamp of the objects to be possibly deleted is inspected to check whether it is the same as the timestamp of the study that was requested to delete. When I designed this we wanted to be able to delete reusable objects (e.g., ReferenceSource) if these are left unused and belonging to the same submission that is being deleted.

This way of loading/unloading should be reviewed in favour of an approach that relies more on hibernate's cascading functionality. For the moment, best thing is to extend from unloaders of most similar object types (eg, MaterialUnloader should be the thing closest MetaboliteSampleUnloader). The most important thing that the loader/unloading code deals with is the operation's order and linking/unlinking things before/after a storage operation, so that Hibernate doesn't complain about referential integrity.

pconesa commented 12 years ago

Many thanks for your time...let see if I can solve it with your useful key points!

Cheers!

On 11/05/2012 12:28, Marco Brandizi wrote:

I haven't touched this code for quite a while (I'm no longer in this project), so I can only talk about what I remember. The submission timestamp of the objects to be possibly deleted is inspected to check whether it is the same as the timestamp of the study that was requested to delete. When I designed this we wanted to be able to delete reusable objects (e.g., ReferenceSource) if these are left unused and belonging to the same submission that is being deleted.

This way of loading/unloading should be reviewed in favour of an approach that relies more on hibernate's cascading functionality. For the moment, best thing is to extend from unloaders of most similar object types (eg, MaterialUnloader should be the thing closest MetaboliteSampleUnloader). The most important thing that the loader/unloading code deals with is the operation's order and linking/unlinking things before/after a storage operation, so that Hibernate doesn't complain about referential integrity.


Reply to this email directly or view it on GitHub: https://github.com/ISA-tools/BioInvIndex/issues/52#issuecomment-5648577

Pablo Conesa Mingo Skype: pconesa Phone: 01223 494596 Chemoinformatics and Metabolism Team EMBL - European Bioinformatics Institute. Wellcome Trust Genome Campus, Hinxton, Cambridge, CB10 1SD, UK Twitter: @emblebi | Facebook: /EMBLEBI