Hi - I'm having an issue getting to-many lists to populate correctly. I'm
guessing I'm just misunderstanding something so I appreciate any help I can
I have an entity named "Product" that has a list of Images (1 product has
many images). The relationship seems to be setup properly.
After I create a new Product entity, insert, then add all the Images to the
list of Images on the Product entity everything seems fine. The first time
I query for the newly created Product, the call to getImages returns a list
with the expected number of images in it.
However, the next time I try to query for the Product the call to getImages
on the resulting Product entity returns an empty list (all other properties
on the Product entity that aren't lists are populated correctly). If I
perform a query to get the list of images separately for images by product
id, the expected images are returned...it just seems like the link between
Product -> Images has been broken somehow.
I've read there is some caching that greenDao does, but I'm not sure it
applies in this case - or if it does, how can I make it populate the to
many lists when I query for a Product?
I'm not sure if it matters, but to query for the Product I have to use a
"StringCondition" because to get the right list of products I need to join
to another table. Here is the query to get the list of Products back just
in case you're curious (CAT_PROD is the join table linking Product and
Category together, which is necessary to get the list of Products in a
List<Product> prod = productDao.queryBuilder().where(
new StringCondition("PRODUCT_ID IN (SELECT CAT_PROD.P_ID from CAT_PROD
WHERE CAT_PROD.C_ID = " + catId + " AND CAT_PROD.P_ID = " +
item.getItemId() + ")")).list();
Like I said before, the first time this query runs after inserting the
product, product.getImages() returns the expected list of images.
Subsequent runs of the query result in empty lists when you call
Thanks in advance for any help, I'm really stuck.