Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

  • Fix TAXONLABEL.linked column type mismatch (first commit)
  • Comprehensive check for all smallint→boolean ORM/database type mismatches
  • Fix all identified mismatches in TBASE2_POSTGRES_CREATION.sql:
    • analysis.validated
    • analyzeddata.input
    • geneticcode.predefined
    • matrix.aligned
    • matrix.diagonal
    • matrix.casesensitive
    • matrixelement.andlogic
    • matrixelement.gap
    • phylotree.bigtree
    • phylotree.rootedtree
    • statechangeset.reversible
    • taxonlabelset.taxa
  • Code review - passed
  • CodeQL security check - no applicable code changes
Original prompt

I try to upload a nexus file through Mesquite, and this happens (in the web UI):

Data Access Failure
could not execute batch; SQL [insert into TAXONLABEL (VERSION, LINKED, STUDY_ID, TaxonLabel, TAXONVARIANT_ID, TAXONLABEL_ID) values (?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute batch

org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute batch; SQL [insert into TAXONLABEL (VERSION, LINKED, STUDY_ID, TaxonLabel, TAXONVARIANT_ID, TAXONLABEL_ID) values (?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute batch at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:195) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:374) at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:334) at org.springframework.orm.hibernate5.HibernateTemplate.flush(HibernateTemplate.java:786) at org.cipres.treebase.dao.AbstractDAO.flush(AbstractDAO.java:164) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:234) at jdk.proxy3/jdk.proxy3.$Proxy125.flush(Unknown Source) at org.cipres.treebase.service.study.SubmissionServiceImpl.addNexusFile(SubmissionServiceImpl.java:691) at org.cipres.treebase.service.study.SubmissionServiceImpl.addNexusFilesJDBC(SubmissionServiceImpl.java:604) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241) at jdk.proxy3/jdk.proxy3.$Proxy141.addNexusFilesJDBC(Unknown Source) at org.cipres.treebase.web.controllers.UploadFileController.onSubmit(UploadFileController.java:219) at org.cipres.treebase.web.compat.CancellableFormController.processFormSubmission(CancellableFormController.java:209) at org.cipres.treebase.web.compat.CancellableFormController.handleRequestInternal(CancellableFormController.java:112) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:51) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:555) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215)...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

The TBASE2_POSTGRES_CREATION.sql file defined the linked column as
smallint, but the Java TaxonLabel entity uses a boolean field mapped
to this column. This caused a type mismatch error when Hibernate tried
to insert boolean values into the smallint column.

This fix changes the column type to boolean in the schema creation
script, matching the type expected by the Hibernate entity mapping
and the existing snapshot schema.

Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix data access failure during nexus file upload Fix TAXONLABEL.linked column type mismatch (smallint → boolean) Jan 13, 2026
Copilot AI requested a review from rvosa January 13, 2026 20:40
@rvosa
Copy link
Contributor

rvosa commented Jan 13, 2026

@copilot do a comprehensive check to see if there are other similar cases, where the database schema has a smallint but the ORM layer has a boolean. Report and fix all such impedance mismatches.

Comprehensive fix for all columns where the database schema defines
smallint but the Java entity expects boolean type:

- analysis.validated (Analysis.java)
- analyzeddata.input (AnalyzedData.java)
- geneticcode.predefined (GeneticCode.java)
- matrix.aligned (DiscreteMatrix.java)
- matrix.diagonal (DistanceMatrix.java)
- matrix.casesensitive (StandardMatrix.java)
- matrixelement.andlogic (CompoundMatrixElement.java)
- matrixelement.gap (for consistency)
- phylotree.bigtree (PhyloTree.java)
- phylotree.rootedtree (PhyloTree.java)
- statechangeset.reversible (StateChangeSet.java)
- taxonlabelset.taxa (TaxonLabelSet.java)

submission.test is correctly left as smallint since it maps to Integer.

Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot do a comprehensive check to see if there are other similar cases, where the database schema has a smallint but the ORM layer has a boolean. Report and fix all such impedance mismatches.

Completed comprehensive check. Found and fixed 12 additional columns in TBASE2_POSTGRES_CREATION.sql where smallint should be boolean to match the Java entity mappings:

Table Column Java Entity
analysis validated Analysis
analyzeddata input AnalyzedData
geneticcode predefined GeneticCode
matrix aligned DiscreteMatrix
matrix diagonal DistanceMatrix
matrix casesensitive StandardMatrix
matrixelement andlogic CompoundMatrixElement
matrixelement gap (for consistency)
phylotree bigtree PhyloTree
phylotree rootedtree PhyloTree
statechangeset reversible StateChangeSet
taxonlabelset taxa TaxonLabelSet

The only smallint left is submission.test, which correctly maps to Integer in Java.

Fixed in commit 203c12b.

@rvosa rvosa marked this pull request as ready for review January 13, 2026 20:55
@rvosa rvosa merged commit 0703486 into master Jan 13, 2026
3 checks passed
@rvosa rvosa deleted the copilot/fix-data-access-failure-again branch January 13, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants