ORMLite自身的一对多关系(ORMLite one-to-many relationship of itself)
我有一个与自身有一对多关系的模型。 每次我运行我的Android应用程序时,我都会收到一个
SQLException
,它声明我的外部集合类Route
为我的字段childRoutes
column-name不包含类Route
的外部字段。 我觉得我已经在我的模型中指定了这个,但我可能会遗漏一些东西?这是我的模型,不包括getter / setter:
public class Route implements Serializable{ @DatabaseField(id = true, canBeNull = false, columnName = "id") private long id; @DatabaseField(columnName = "parent", foreign = true) private Route parent; @ForeignCollectionField private ForeignCollection<Route> childRoutes; }
我在这里遵循了这个问题,但我似乎仍然无法做到正确。 ORMLITE一对多递归关系
I have a model that has a one-to-many relationship of itself. Every time I run my android application, I keep getting an
SQLException
that states that my Foreign Collection classRoute
for my fieldchildRoutes
column-name does not contain a foreign field of classRoute
. I feel like I specified this already in my Model but I may be missing something?Here is my model excluding the getters/setters:
public class Route implements Serializable{ @DatabaseField(id = true, canBeNull = false, columnName = "id") private long id; @DatabaseField(columnName = "parent", foreign = true) private Route parent; @ForeignCollectionField private ForeignCollection<Route> childRoutes; }
I followed this question here but I still can't seem to be getting it right. ORMLITE one-to-many recursive relationship
原文:https://stackoverflow.com/questions/31375916
最满意答案
var map; var geocoder; var address;
function initialize() { map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(40.730885,-73.997383), 15); map.addControl(new GLargeMapControl); GEvent.addListener(map, "click", getAddress); geocoder = new GClientGeocoder(); }
function getAddress(overlay, latlng) { if (latlng != null) { address = latlng; geocoder.getLocations(latlng, showAddress); } }
function showAddress(response) { map.clearOverlays(); if (!response || response.Status.code != 200) { alert("Status Code:" + response.Status.code); } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]); marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml( '>b<orig latlng:>/b<' + response.name + '>br/<' + '>b<latlng:>/b<' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '>br<' + '>b<Status Code:>/b<' + response.Status.code + '>br<' + '>b<Status Request:>/b<' + response.Status.request + '>br<' + '>b<Address:>/b<' + place.address + '>br<' + '>b<Accuracy:>/b<' + place.AddressDetails.Accuracy + '>br>' + '>b>Country code:>/b< ' + place.AddressDetails.Country.CountryNameCode); } }
var map; var geocoder; var address;
function initialize() { map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(40.730885,-73.997383), 15); map.addControl(new GLargeMapControl); GEvent.addListener(map, "click", getAddress); geocoder = new GClientGeocoder(); }
function getAddress(overlay, latlng) { if (latlng != null) { address = latlng; geocoder.getLocations(latlng, showAddress); } }
function showAddress(response) { map.clearOverlays(); if (!response || response.Status.code != 200) { alert("Status Code:" + response.Status.code); } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]); marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml( '>b<orig latlng:>/b<' + response.name + '>br/<' + '>b<latlng:>/b<' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '>br<' + '>b<Status Code:>/b<' + response.Status.code + '>br<' + '>b<Status Request:>/b<' + response.Status.request + '>br<' + '>b<Address:>/b<' + place.address + '>br<' + '>b<Accuracy:>/b<' + place.AddressDetails.Accuracy + '>br>' + '>b>Country code:>/b< ' + place.AddressDetails.Country.CountryNameCode); } }
相关问答
更多-
Google Geocoding API(V3)是否支持批量地理编码?(Does Google Geocoding API (V3) supports batch geocoding?)[2022-05-02]
没有。现在您可以批量地对一堆地址进行地理编码,但您可以使用方向api对最多8个地址进行地理编码。 在商务舱中,它最多允许24个地址。 了解它: https : //developers.google.com/maps/documentation/javascript/directions 。 您也可以尝试http://code.google.com/p/google-maps-tsp-solver/ 。 No. There is no way you can batch geocode a bunch of ... -
Google Maps API v3地理编码网络服务,带有监控使用情况的密钥(Google Maps API v3 geocoding web service with key to monitor usage)[2022-07-22]
目前,地理编码请求中不支持api密钥,而且每个api文档似乎都是有意的。 当前参数是来自V2的遗留物,并且在api控制台中没有可用于地理编码api的服务。 https://developers.google.com/maps/documentation/geocoding/?hl=en#Limits 因此,坚持无密钥请求,如果您想监控您的使用情况,您应该记录自己并观察OVER_QUERY_LIMIT响应。 At this time, there's no support for api key in geo ... -
我不确定为什么地理编码响应在将完整地址作为参数传递时不会返回UK的administrative_area_level_1。 但是,在您的情况下,我要做的是将城镇名称(而不是完整的地址)发送到地理编码器,地理编码器将返回您需要的数据。 这里有一些例子: 曼彻斯特 加的夫 格拉斯哥 请注意,我已将Region Biasing参数添加到查询中,因此如果要在英国境外使用它,则需要更改它。 I'm not sure why the geocoding response does not return the admi ...
-
我在下面的代码中将“this”更改为“that”,并解决了我的问题。 还不确定逻辑。 之前: var marker = new google.maps.Marker({ map: this.map, title: salon.title, position: results[0].geometry.location }); 后: var marker = new google.maps.Marker( ...
-
不, 地理编码专门针对邮政地址。 地理编码是将地址(如“1600 Amphitheatre Parkway,Mountain View,CA”)转换为地理坐标(如北纬37.423021和经度-122.083739)的过程, 要对地理位置进行地理定位,您需要使用Places API之类的内容 Google Places JavaScript库的功能使您的应用程序可以搜索定义区域中包含的位置(在此API中定义为场所,地理位置或突出的兴趣点),例如地图的边界或固定点周围。 No, Geocoding is spe ...
-
Google Maps API v3提供了更多批量地理编码问题(More batch geocoding questions with the Google Maps API v3)[2023-08-28]
实现某种速率限制提交的最佳选择是使用计时器对象和队列。 计时器以固定速率安排无限期运行(jQuery有一些非常好的计时器实现),并且在该计时器的主体中,你从队列中弹出一些东西并提交它然后完成。 您可以根据需要将其他代码添加到该队列中。 Your best bet to implement some sort of rate-limited submissions would be to use a timer object and a queue. The timer is scheduled at a f ... -
var map; var geocoder; var address; function initialize() { map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(40.730885,-73.997383), 15); map.addControl(new GLargeMapControl); GEvent.addListener(map, "click", getAddress); ...
-
Google Maps v3 API地理编码和地点不一致的视口(Google Maps v3 APIs Geocoding and Places Inconsistent Viewport)[2022-04-03]
您是否希望搜索后地图缩放级别保持一致? 我用谷歌地图做android。 只需查看上面提供的链接中的代码即可。 将map.setZoom()方法更改为您想要的级别可能会有所帮助。 我还没有完成javascript google map api。 只是广泛猜测。 如果我回答错误的问题,请纠正我。 Are you wanting the map zoom level to be consistent after the search ? I do android with google map. And just ... -
Google Maps Geocoder与Google Maps Javascript API V3(Google Maps Geocoder vs Google Maps Javascript API V3)[2023-05-05]
Geocoding API文档说明 使用Google地理编码API每天的查询限制为2,500个地理定位请求。 常见问题解答中提到了25000,但是指的是地图加载 ,而不是对地理编码器服务的调用。 地理编码器文档说 Google Maps API提供了一个地理编码器类,用于根据用户输入动态地对地址进行地理编码。 这些请求的速率受到限制,以阻止滥用服务。 我无法找到Javascript地理编码器的公布费率,但谷歌集团也提到2500。 突发速率是可变的,因为它受服务器负载和其他因素的影响,但总体速率是2500 / ... -
当您通过Javascript-API的方法使用这两种服务时,限制适用于使用地图访问该页面的用户,您的帐户配额不会受到影响(因此您的帐户/项目无需计算/报告) 它仅在您请求Web服务时 (通常通过服务器端脚本)应用于您的帐户。 When you use both services via the methods of the Javascript-API the limits apply to the user that visits the page with the map, the quota of y ...