Hi Salil
The problem might be with how you setup/populate your foreign collection in the first place.
Does your Reading class have a database field called device with foreign=true?
Then when you instantiate your Reading initially do you associate it with the device properly like this?
Reading theReading = new Reading();
… set some values …
theReading.device = … the device created with deviceDao.create(theDevice) …
readingDao.create(theReading)
I believe the relation to the device has to be set before you call readingDao.create(theReading), but don't quote me on that.
BTW you can just create an ArrayList from the foreign collection like this:
ArrayList<Reading> result = new ArrayList<Reading>(device.getReadings());
As ForeignCollection is simply a Collection.
Greetings
Moritz