|
7 | 7 | import java.sql.Statement; |
8 | 8 |
|
9 | 9 | import org.hibernate.Query; |
| 10 | +import org.hibernate.impl.SessionImpl; |
10 | 11 |
|
11 | 12 | import com.mchange.v2.c3p0.ComboPooledDataSource; |
12 | 13 |
|
@@ -90,10 +91,10 @@ public void testHibernateQueryStatement() throws Exception { |
90 | 91 |
|
91 | 92 | // assertTrue(false); |
92 | 93 | StringBuffer query = new StringBuffer( |
93 | | - "delete from RowSegment r where r in (select r2 from RowSegment r2 join r2.matrixRow row " + |
| 94 | +// "delete from RowSegment r where r in (select r2 from RowSegment r2 join r2.matrixRow row " + |
| 95 | +// "where row.matrix = :matrixId and r2.startIndex between :start and :endIndex and r2.endIndex between :start and :endIndex)"); |
| 96 | + "delete from RowSegment where id in (select r2.id from RowSegment r2 join r2.matrixRow row " + |
94 | 97 | "where row.matrix = :matrixId and r2.startIndex between :start and :endIndex and r2.endIndex between :start and :endIndex)"); |
95 | | -// "delete from RowSegment where id in (select id from RowSegment r2 join r2.matrixRow row " + |
96 | | -// "where row.matrix = :matrixId and r2.startIndex between :start and :endIndex and r2.endIndex between :start and :endIndex)"); |
97 | 98 |
|
98 | 99 | Query q = hibernateTemplate.getSessionFactory().getCurrentSession().createQuery(query.toString()); |
99 | 100 |
|
@@ -126,7 +127,10 @@ public void testGetGeneratedKey() throws Exception { |
126 | 127 | StringBuffer query = new StringBuffer( |
127 | 128 | "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"); |
128 | 129 |
|
129 | | - Connection con = hibernateTemplate.getSessionFactory().getCurrentSession().connection(); |
| 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. |
| 133 | + Connection con = ((SessionImpl)hibernateTemplate.getSessionFactory().getCurrentSession()).connection(); |
130 | 134 | String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"; |
131 | 135 | // String idQuery = "identity_val_local()"; |
132 | 136 |
|
@@ -197,7 +201,10 @@ public void testSelectFromInsert() throws Exception { |
197 | 201 | StringBuffer query = new StringBuffer( |
198 | 202 | "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?) RETURNING phylochar_id"); |
199 | 203 |
|
200 | | - Connection con = hibernateTemplate.getSessionFactory().getCurrentSession().connection(); |
| 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. |
| 207 | + Connection con = ((SessionImpl)hibernateTemplate.getSessionFactory().getCurrentSession()).connection(); |
201 | 208 | //String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?)"; |
202 | 209 | // String idQuery = "identity_val_local()"; |
203 | 210 |
|
|
0 commit comments