mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
#634764 : removed throws IOException from JDOQLQuery.close and JDOSQLQuery.close
This commit is contained in:
parent
6e61cd4b50
commit
c19139e967
@ -39,8 +39,15 @@ import com.mysema.query.types.expr.QTuple;
|
||||
*
|
||||
* @param <Q>
|
||||
*/
|
||||
public abstract class AbstractJDOQLQuery<Q extends AbstractJDOQLQuery<Q>> extends ProjectableQuery<Q> implements Closeable{
|
||||
public abstract class AbstractJDOQLQuery<Q extends AbstractJDOQLQuery<Q>> extends ProjectableQuery<Q>{
|
||||
|
||||
private final Closeable closeable = new Closeable(){
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
AbstractJDOQLQuery.this.close();
|
||||
}
|
||||
};
|
||||
|
||||
private final boolean detach;
|
||||
|
||||
private List<Object> orderedConstants = new ArrayList<Object>();
|
||||
@ -79,7 +86,7 @@ public abstract class AbstractJDOQLQuery<Q extends AbstractJDOQLQuery<Q>> extend
|
||||
return (Q)this;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
for (Query query : queries){
|
||||
query.closeAll();
|
||||
}
|
||||
@ -168,11 +175,11 @@ public abstract class AbstractJDOQLQuery<Q extends AbstractJDOQLQuery<Q>> extend
|
||||
}
|
||||
|
||||
public CloseableIterator<Object[]> iterate(Expr<?>[] args) {
|
||||
return new IteratorAdapter<Object[]>(list(args).iterator(), this);
|
||||
return new IteratorAdapter<Object[]>(list(args).iterator(), closeable);
|
||||
}
|
||||
|
||||
public <RT> CloseableIterator<RT> iterate(Expr<RT> projection) {
|
||||
return new IteratorAdapter<RT>(list(projection).iterator(), this);
|
||||
return new IteratorAdapter<RT>(list(projection).iterator(), closeable);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@ -5,8 +5,6 @@
|
||||
*/
|
||||
package com.mysema.query.jdoql;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
import javax.jdo.PersistenceManager;
|
||||
|
||||
import com.mysema.query.Projectable;
|
||||
@ -17,7 +15,7 @@ import com.mysema.query.Projectable;
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
public interface JDOQLQuery extends JDOQLCommonQuery<JDOQLQuery>, Projectable, Closeable {
|
||||
public interface JDOQLQuery extends JDOQLCommonQuery<JDOQLQuery>, Projectable {
|
||||
|
||||
/**
|
||||
* Clone the state of the query for the given PersistenceManager
|
||||
@ -46,5 +44,10 @@ public interface JDOQLQuery extends JDOQLCommonQuery<JDOQLQuery>, Projectable, C
|
||||
* @return
|
||||
*/
|
||||
JDOQLQuery setMaxFetchDepth(int maxFetchDepth);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void close();
|
||||
|
||||
}
|
||||
|
||||
@ -41,9 +41,16 @@ import com.mysema.query.types.expr.QTuple;
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
public final class JDOSQLQuery extends AbstractSQLQuery<JDOSQLQuery> implements SQLCommonQuery<JDOSQLQuery>, Closeable{
|
||||
public final class JDOSQLQuery extends AbstractSQLQuery<JDOSQLQuery> implements SQLCommonQuery<JDOSQLQuery>{
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JDOSQLQuery.class);
|
||||
|
||||
private final Closeable closeable = new Closeable(){
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
JDOSQLQuery.this.close();
|
||||
}
|
||||
};
|
||||
|
||||
private final boolean detach;
|
||||
|
||||
@ -70,7 +77,7 @@ public final class JDOSQLQuery extends AbstractSQLQuery<JDOSQLQuery> implements
|
||||
this.detach = detach;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
for (Query query : queries){
|
||||
query.closeAll();
|
||||
}
|
||||
@ -146,11 +153,11 @@ public final class JDOSQLQuery extends AbstractSQLQuery<JDOSQLQuery> implements
|
||||
}
|
||||
|
||||
public CloseableIterator<Object[]> iterate(Expr<?>[] args) {
|
||||
return new IteratorAdapter<Object[]>(list(args).iterator(), this);
|
||||
return new IteratorAdapter<Object[]>(list(args).iterator(), closeable);
|
||||
}
|
||||
|
||||
public <RT> CloseableIterator<RT> iterate(Expr<RT> projection) {
|
||||
return new IteratorAdapter<RT>(list(projection).iterator(), this);
|
||||
return new IteratorAdapter<RT>(list(projection).iterator(), closeable);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@ -2,7 +2,6 @@ package com.mysema.query.jdoql;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@ -27,11 +26,7 @@ public class FetchPlanTest extends AbstractJDOTest{
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (query != null){
|
||||
try {
|
||||
query.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
query.close();
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user