本文整理了Java中javax.jdo.Query.setClass
方法的一些代码示例,展示了Query.setClass
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setClass
方法的具体详情如下:
包路径:javax.jdo.Query
类名称:Query
方法名:setClass
[英]Set the class of the candidate instances of the query.
The class specifies the class of the candidates of the query. Elements of the candidate collection that are of the specified class are filtered before being put into the result Collection
.
[中]设置查询的候选实例的类。
该类指定查询的候选类。候选集合中属于指定类的元素在放入结果Collection
之前会被过滤。
代码示例来源:origin: apache/hive
private void dropPartitionsNoTxn(String catName, String dbName, String tblName, List<String> partNames) {
ObjectPair<Query, Map<String, String>> queryWithParams =
getPartQueryWithParams(catName, dbName, tblName, partNames);
Query query = queryWithParams.getFirst();
query.setClass(MPartition.class);
long deleted = query.deletePersistentAll(queryWithParams.getSecond());
LOG.debug("Deleted {} partition from store", deleted);
query.closeAll();
}
代码示例来源:origin: apache/hive
query.setClass(MSchemaVersion.class);
List<MSchemaVersion> mSchemaVersions = query.setNamedParameters(parameters).executeList();
if (mSchemaVersions == null || mSchemaVersions.isEmpty()) {
代码示例来源:origin: apache/hive
/**
* Gets partition names from the table via ORM (JDOQL) name filter.
* @param dbName Database name.
* @param tblName Table name.
* @param partNames Partition names to get the objects for.
* @return Resulting partitions.
*/
private List<Partition> getPartitionsViaOrmFilter(String catName,
String dbName, String tblName, List<String> partNames) throws MetaException {
if (partNames.isEmpty()) {
return new ArrayList<>();
}
ObjectPair<Query, Map<String, String>> queryWithParams =
getPartQueryWithParams(catName, dbName, tblName, partNames);
Query query = queryWithParams.getFirst();
query.setResultClass(MPartition.class);
query.setClass(MPartition.class);
query.setOrdering("partitionName ascending");
@SuppressWarnings("unchecked")
List<MPartition> mparts = (List<MPartition>)query.executeWithMap(queryWithParams.getSecond());
List<Partition> partitions = convertToParts(catName, dbName, tblName, mparts);
if (query != null) {
query.closeAll();
}
return partitions;
}
代码示例来源:origin: apache/hive
/**
* Detaches column descriptors from storage descriptors; returns the set of unique CDs
* thus detached. This is done before dropping partitions because CDs are reused between
* SDs; so, we remove the links to delete SDs and then check the returned CDs to see if
* they are referenced by other SDs.
*/
private HashSet<MColumnDescriptor> detachCdsFromSdsNoTxn(
String catName, String dbName, String tblName, List<String> partNames) {
ObjectPair<Query, Map<String, String>> queryWithParams =
getPartQueryWithParams(catName, dbName, tblName, partNames);
Query query = queryWithParams.getFirst();
query.setClass(MPartition.class);
query.setResult("sd");
@SuppressWarnings("unchecked")
List<MStorageDescriptor> sds = (List<MStorageDescriptor>)query.executeWithMap(
queryWithParams.getSecond());
HashSet<MColumnDescriptor> candidateCds = new HashSet<>();
for (MStorageDescriptor sd : sds) {
if (sd != null && sd.getCD() != null) {
candidateCds.add(sd.getCD());
sd.setCD(null);
}
}
if (query != null) {
query.closeAll();
}
return candidateCds;
}
代码示例来源:origin: jpox/jpox
/**
* Construct a query instance with the candidate class specified.
* @param cls The class to query
* @return The query
*/
public synchronized Query newQuery(Class cls)
{
Query query = newQuery();
query.setClass(cls);
return query;
}
代码示例来源:origin: org.datanucleus/datanucleus-api-jdo
/**
* Construct a query instance with the candidate class specified.
* @param cls The class to query
* @return The query
* @param <T> Candidate type for the query
*/
public <T> Query<T> newQuery(Class<T> cls)
{
Query query = newQuery();
query.setClass(cls);
return query;
}
代码示例来源:origin: jpox/jpox
/**
* Construct a query instance with the candidate class and filter specified.
* @param cls The class to query
* @param filter A filter to apply
* @return The query
*/
public synchronized Query newQuery(Class cls, String filter)
{
Query query = newQuery();
query.setClass(cls);
query.setFilter(filter);
return query;
}
代码示例来源:origin: jpox/jpox
/**
* Construct a query instance with the candidate class and candidate
* Collection specified.
* @param cls The class to query
* @param cln The collection
* @return The query
*/
public synchronized Query newQuery(Class cls, Collection cln)
{
Query query = newQuery();
query.setClass(cls);
query.setCandidates(cln);
return query;
}
代码示例来源:origin: org.datanucleus/datanucleus-api-jdo
/**
* Construct a query instance with the candidate class and filter specified.
* @param cls The class to query
* @param filter A filter to apply
* @return The query
* @param <T> Candidate type for the query
*/
public <T> Query<T> newQuery(Class<T> cls, String filter)
{
Query query = newQuery();
query.setClass(cls);
query.setFilter(filter);
return query;
}
代码示例来源:origin: org.datanucleus/datanucleus-api-jdo
/**
* Construct a query instance with the candidate class and candidate
* Collection specified.
* @param cls The class to query
* @param cln The collection
* @return The query
* @param <T> Candidate type for the query
*/
public <T> Query<T> newQuery(Class<T> cls, Collection<T> cln)
{
Query query = newQuery();
query.setClass(cls);
query.setCandidates(cln);
return query;
}
代码示例来源:origin: jpox/jpox
/**
* Construct a query instance with the candidate Extent specified; the
* candidate class is taken from the Extent.
* @param cln The extent to query
* @return The query
*/
public synchronized Query newQuery(Extent cln)
{
Query query = newQuery();
query.setClass(cln.getCandidateClass());
query.setCandidates(cln);
return query;
}
代码示例来源:origin: org.datanucleus/datanucleus-api-jdo
/**
* Construct a query instance with the candidate Extent specified; the
* candidate class is taken from the Extent.
* @param cln The extent to query
* @return The query
* @param <T> Candidate type for the query
*/
public <T> Query<T> newQuery(Extent<T> cln)
{
Query query = newQuery();
query.setClass(cln.getCandidateClass());
query.setCandidates(cln);
return query;
}
代码示例来源:origin: org.spark-project.hive/hive-metastore
private void dropPartitionsNoTxn(String dbName, String tblName, List<String> partNames) {
ObjectPair<Query, Map<String, String>> queryWithParams =
getPartQueryWithParams(dbName, tblName, partNames);
Query query = queryWithParams.getFirst();
query.setClass(MPartition.class);
long deleted = query.deletePersistentAll(queryWithParams.getSecond());
LOG.debug("Deleted " + deleted + " partition from store");
query.closeAll();
}
代码示例来源:origin: org.apache.hive/hive-standalone-metastore
private void dropPartitionsNoTxn(String catName, String dbName, String tblName, List<String> partNames) {
ObjectPair<Query, Map<String, String>> queryWithParams =
getPartQueryWithParams(catName, dbName, tblName, partNames);
Query query = queryWithParams.getFirst();
query.setClass(MPartition.class);
long deleted = query.deletePersistentAll(queryWithParams.getSecond());
LOG.debug("Deleted {} partition from store", deleted);
query.closeAll();
}
代码示例来源:origin: jpox/jpox
/**
* Construct a query instance with the candidate Extent and filter
* specified. The candidate class is taken from the Extent.
* @param cln The extent to query
* @param filter A filter to apply
* @return The query
*/
public synchronized Query newQuery(Extent cln, String filter)
{
Query query = newQuery();
query.setClass(cln.getCandidateClass());
query.setCandidates(cln);
query.setFilter(filter);
return query;
}
代码示例来源:origin: org.datanucleus/datanucleus-api-jdo
/**
* Construct a query instance with the candidate Extent and filter
* specified. The candidate class is taken from the Extent.
* @param cln The extent to query
* @param filter A filter to apply
* @return The query
* @param <T> Candidate type for the query
*/
public <T> Query<T> newQuery(Extent<T> cln, String filter)
{
Query query = newQuery();
query.setClass(cln.getCandidateClass());
query.setCandidates(cln);
query.setFilter(filter);
return query;
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private void dropPartitionsNoTxn(String dbName, String tblName, List<String> partNames) {
ObjectPair<Query, Map<String, String>> queryWithParams =
getPartQueryWithParams(dbName, tblName, partNames);
Query query = queryWithParams.getFirst();
query.setClass(MPartition.class);
long deleted = query.deletePersistentAll(queryWithParams.getSecond());
LOG.debug("Deleted " + deleted + " partition from store");
query.closeAll();
}
代码示例来源:origin: org.spark-project.hive/hive-metastore
private List<MPartition> getMPartitionsViaOrmFilter(String dbName,
String tblName, List<String> partNames, Out<Query> out) {
ObjectPair<Query, Map<String, String>> queryWithParams =
getPartQueryWithParams(dbName, tblName, partNames);
Query query = out.val = queryWithParams.getFirst();
query.setResultClass(MPartition.class);
query.setClass(MPartition.class);
query.setOrdering("partitionName ascending");
@SuppressWarnings("unchecked")
List<MPartition> result = (List<MPartition>)query.executeWithMap(queryWithParams.getSecond());
return result;
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private List<MPartition> getMPartitionsViaOrmFilter(String dbName,
String tblName, List<String> partNames, Out<Query> out) {
ObjectPair<Query, Map<String, String>> queryWithParams =
getPartQueryWithParams(dbName, tblName, partNames);
Query query = out.val = queryWithParams.getFirst();
query.setResultClass(MPartition.class);
query.setClass(MPartition.class);
query.setOrdering("partitionName ascending");
@SuppressWarnings("unchecked")
List<MPartition> result = (List<MPartition>)query.executeWithMap(queryWithParams.getSecond());
return result;
}
代码示例来源:origin: tzaeschke/zoodb
@Test
public void testQuery() {
PersistenceManager pm = TestTools.openPM();
pm.currentTransaction().begin();
Query q = pm.newQuery();
assertEquals(pm, q.getPersistenceManager());
assertFalse(q.isUnmodifiable());
q.setClass(TestClass.class);
testDeclarative(q);
testString(q);
TestTools.closePM(pm);
}
内容来源于网络,如有侵权,请联系作者删除!