From c9f4dce79b572f4198bee9e45e4a8a09a0a75cbb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:31:34 +0000 Subject: [PATCH 1/4] Initial plan From 47bae1b5586e8de9c08f5c6ce398e6168d8d2131 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:35:35 +0000 Subject: [PATCH 2/4] Fix deprecated Session.connection() calls in EnvironmentTest Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com> --- .../test/java/org/cipres/treebase/dao/EnvironmentTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java b/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java index a1f5a98bd..2e8f30c7c 100644 --- a/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java +++ b/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java @@ -7,6 +7,7 @@ import java.sql.Statement; import org.hibernate.Query; +import org.hibernate.impl.SessionImpl; import com.mchange.v2.c3p0.ComboPooledDataSource; @@ -126,7 +127,7 @@ public void testGetGeneratedKey() throws Exception { StringBuffer query = new StringBuffer( "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"); - Connection con = hibernateTemplate.getSessionFactory().getCurrentSession().connection(); + Connection con = ((SessionImpl)hibernateTemplate.getSessionFactory().getCurrentSession()).connection(); String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"; // String idQuery = "identity_val_local()"; @@ -197,7 +198,7 @@ public void testSelectFromInsert() throws Exception { StringBuffer query = new StringBuffer( "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?) RETURNING phylochar_id"); - Connection con = hibernateTemplate.getSessionFactory().getCurrentSession().connection(); + Connection con = ((SessionImpl)hibernateTemplate.getSessionFactory().getCurrentSession()).connection(); //String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"; // String idQuery = "identity_val_local()"; From 68431f67790afca69397bad05948510479479f44 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:39:01 +0000 Subject: [PATCH 3/4] Fix HQL query in testHibernateQueryStatement to use id-based subquery Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com> --- .../test/java/org/cipres/treebase/dao/EnvironmentTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java b/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java index 2e8f30c7c..eb225f19a 100644 --- a/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java +++ b/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java @@ -91,10 +91,10 @@ public void testHibernateQueryStatement() throws Exception { // assertTrue(false); StringBuffer query = new StringBuffer( - "delete from RowSegment r where r in (select r2 from RowSegment r2 join r2.matrixRow row " + +// "delete from RowSegment r where r in (select r2 from RowSegment r2 join r2.matrixRow row " + +// "where row.matrix = :matrixId and r2.startIndex between :start and :endIndex and r2.endIndex between :start and :endIndex)"); + "delete from RowSegment where id in (select r2.id from RowSegment r2 join r2.matrixRow row " + "where row.matrix = :matrixId and r2.startIndex between :start and :endIndex and r2.endIndex between :start and :endIndex)"); -// "delete from RowSegment where id in (select id from RowSegment r2 join r2.matrixRow row " + -// "where row.matrix = :matrixId and r2.startIndex between :start and :endIndex and r2.endIndex between :start and :endIndex)"); Query q = hibernateTemplate.getSessionFactory().getCurrentSession().createQuery(query.toString()); From 6e6646be3568a58fd2f5ec1dfef222f7884f8be9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:41:00 +0000 Subject: [PATCH 4/4] Add explanatory comments for SessionImpl usage Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com> --- .../test/java/org/cipres/treebase/dao/EnvironmentTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java b/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java index eb225f19a..51fcb15c4 100644 --- a/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java +++ b/treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java @@ -127,6 +127,9 @@ public void testGetGeneratedKey() throws Exception { StringBuffer query = new StringBuffer( "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"); + // Note: Session.connection() is deprecated in Hibernate 3.x. We cast to SessionImpl + // to access the connection() method. While Session.doReturningWork() would be better, + // it would require restructuring the test. For test code, this is acceptable. Connection con = ((SessionImpl)hibernateTemplate.getSessionFactory().getCurrentSession()).connection(); String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"; // String idQuery = "identity_val_local()"; @@ -198,6 +201,9 @@ public void testSelectFromInsert() throws Exception { StringBuffer query = new StringBuffer( "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?) RETURNING phylochar_id"); + // Note: Session.connection() is deprecated in Hibernate 3.x. We cast to SessionImpl + // to access the connection() method. While Session.doReturningWork() would be better, + // it would require restructuring the test. For test code, this is acceptable. Connection con = ((SessionImpl)hibernateTemplate.getSessionFactory().getCurrentSession()).connection(); //String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"; // String idQuery = "identity_val_local()";