greenDao多表关联To-Many踩过的坑

    xiaoxiao2021-04-03  32

    在greenDao中使用一对多关联关系表时,如一个用户user对应多个订单orders,user中的getOrders(),在实体orders更新后,user应该调用reset方法,才能获得更新后的orders列表这是因为orders在第一次加载时,会缓存在一个list表中,以后查询时,直接从表中取。增加新的order实体后,getOrders()获得的仍是原来缓存的List表,并没有自动更新,因此需要调用reset方法,再getOrders()获得更新后的list表

    转载请注明原文地址: https://ju.6miu.com/read-665999.html

    最新回复(0)