Skip to content

Commit 6e6646b

Browse files
Copilotrvosa
andcommitted
Add explanatory comments for SessionImpl usage
Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
1 parent 68431f6 commit 6e6646b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

treebase-core/src/test/java/org/cipres/treebase/dao/EnvironmentTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ public void testGetGeneratedKey() throws Exception {
127127
StringBuffer query = new StringBuffer(
128128
"INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)");
129129

130+
// Note: Session.connection() is deprecated in Hibernate 3.x. We cast to SessionImpl
131+
// to access the connection() method. While Session.doReturningWork() would be better,
132+
// it would require restructuring the test. For test code, this is acceptable.
130133
Connection con = ((SessionImpl)hibernateTemplate.getSessionFactory().getCurrentSession()).connection();
131134
String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)";
132135
// String idQuery = "identity_val_local()";
@@ -198,6 +201,9 @@ public void testSelectFromInsert() throws Exception {
198201
StringBuffer query = new StringBuffer(
199202
"INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?) RETURNING phylochar_id");
200203

204+
// Note: Session.connection() is deprecated in Hibernate 3.x. We cast to SessionImpl
205+
// to access the connection() method. While Session.doReturningWork() would be better,
206+
// it would require restructuring the test. For test code, this is acceptable.
201207
Connection con = ((SessionImpl)hibernateTemplate.getSessionFactory().getCurrentSession()).connection();
202208
//String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)";
203209
// String idQuery = "identity_val_local()";

0 commit comments

Comments
 (0)