criteria

How can I get location without internet in android, using only GPS

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I want to get location using GPS only. I don't want to use internet and GPRS in this application. My code is below; tell me where I'm wrong in this. code: package com . getlocation ; import android . app . Activity ; import android . content . Context ; import android . location . Criteria ; import android . location . Location ; import android . location . LocationListener ; import android . location . LocationManager ; import android . os . Bundle ; import android . util . Log ; import android . widget . Toast ; public class

Hibernate Criteria and multiple join

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: is possible with Hibernate criteria do it? select A.something, B.something, C.something, D.something from A JOIN B on A.id = B.id_fk JOIN C ON B.id = C.id_fk JOIN D ON C.id = D.id_fk; 回答1: I have got exactly the same problem, and was able to resolve it like this: return criteria.createCriteria(A.class) .createCriteria("b", "join_between_a_b") .createCriteria("c", "join_between_b_c") .createCriteria("d", "join_between_c_d") .add(Restrictions.eq("some_field_of_D", someValue)); Note: "b" , "c" and "d" in code above refer to attribute names in A

IllegalArgumentException: provider doesn't exisit: null on Maps V1

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Google Maps API V1. I have this error : java.lang.IllegalArgumentException: provider doesn't exisit: null This is my code : locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); String provider = locationManager.getBestProvider(criteria, true); if (provider != null) { startTime = System.currentTimeMillis(); geoLocTimeOutTask = new GeoLocTimeOutTask(); geoLocTimeOutTask.execute(); locationManager.requestLocationUpdates

JPA/Criteria API - Like & equal problem

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use Criteria API in my new project: public List findEmps(String name) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery c = cb.createQuery(Employee.class); Root emp = c.from(Employee.class); c.select(emp); c.distinct(emp); List criteria = new ArrayList (); if (name != null) { ParameterExpression p = cb.parameter(String.class, "name"); criteria.add(cb.equal(emp.get("name"), p)); } /* ... */ if (criteria.size() == 0) { throw new RuntimeException("no criteria"); } else if (criteria.size() == 1) { c.where(criteria.get(0

How to paginate a JPA Query

霸气de小男生 提交于 2019-12-03 02:03:14
问题 I have a submission table with columns like ID , Name , Code among other properties. My requirement is to search for records based on the mentioned properties and return a paginated set. This is the pseudocode for what I am looking for: searchSubmission(searchFilter sf,pageIndex,noOfRecords) { query = 'from submisssion where code=sf.code or id=sf.id order by id start_from (pageIndex*noOfRecords) limit noOfRecords' return result(); } There seem to be many options like CriteriaBuilder ,

HOW to use HAVING COUNT(*) with hibernate

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I need to create a query and I need COUNT(*) and HAVING COUNT(*) = x . I'm using a work around that uses the CustomProjection class, that I downloaded somewhere. This is the SQL that I try to achieve: select count (*) as y0_ , this_ . ensayo_id as y1_ from Repeticiones this_ inner join Lineas linea1_ on this_ . linea_id = linea1_ . id where this_ . pesoKGHA > 0.0 and this_ . nroRepeticion = 1 and linea1_ . id in ( 18 , 24 ) group by this_ . ensayo_id having count (*) = 2 This is the code, where I use the Projection Hibernate class:

'list' object has no attribute 'method'

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a list with measurements, like: [[ Measurements ( 100 , 0.3 )], [ Measurements ( 33 , 0.5 )]] Then , I have a list with some criteria which contains list of measurements: [ Criteria ( 999 , [[ Measurements ( 100 , 0.3 )], [ Measurements ( 33 , 0.5 )]])], [ Criteria ( 999 , [[ Measurements ( 150 , 0.3 )], [ Measurements ( 35 , 0.5 )]])] Finally, I want to supply the above list as input and execute the code: class Measurements (): def __init__ ( self , value , other ): self . value = value self . other = other class Criteria (

Criteria.DISTINCT_ROOT_ENTITY vs Projections.distinct

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am pretty new to Hibernate. I found out that we can get distinct result using following two different ways. Could any one tell me what is the difference between them? When to use one over other? Projections.distinct(Projections.property("id")); vs criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); 回答1: While similar names, the usage is different. I. Projections.distinct(Projections.property("id")); this statement would be translated into SQL Statement. It will be passed to DB Engine and executed as a SQL DISTINCT . See: 17.9.

Wrong fieldname in query with Criteria and Many-To-Many-Relation

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I try to use a simple Criteria on a property with a different columnname in Many-To-Many-Relation, Doctrine uses the propertyname as the field and not the columnname. Person ORM Definition ... manyToMany: attributes: targetEntity: Attributes cascade: ['persist'] joinTable: name: person_attribute joinColumns: person_id: referencedColumnName: id inverseJoinColumns: attribute_id: referencedColumnName: id ... Attribute ORM Definition with differing columnname ... name: type: string nullable: false length: 50 options: fixed: false column: '

Grails…Mocking criteria that returns PagedResultList

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my controller, i have an action which uses criteria to hit db and fetch results. params.max = Math.min(params.max ? params.int('max') : 20, 100) def c = DomainObj.createCriteria() def result =[] result = c.list(params) { 'eq'("employerid", id) } I have mocked this call in my testcase this way: def result=[DomainObj1] def mycriteria =[ list: {Object params=null,Closure cls -> result} ] DomainObj.metaClass.static.createCriteria = {mycriteria} Works fine so far. But in the controller, there is a line where the code says result.totalCount