google-code-export / slim3

Automatically exported from code.google.com/p/slim3
1 stars 1 forks source link

ModelQuery doesn't obtain entity property values #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run keyFieldInvalidValueTest() JUnit4 test.
   It reaches to the last Assert.fail() statement since chapterQuery.asList() does not fetch the properties' values of the Chapter entity.
2. In keyFieldInvalidValueTest, comment out the following statements:
 ModelQuery<Chapter> chapterQuery = Datastore.query( Chapter.class);
 Assert.assertEquals( 4, chapterQuery.count());
 for( Chapter storedChapter : chapterQuery.asList()) {
3. In keyFieldInvalidValueTest, change the following statements from as 
comments to as statement:
// List<Chapter> chapters = Datastore.query( Chapter.class).asList();
// Assert.assertEquals( 4, chapters.size());
// for( Chapter storedChapter : chapters) {
4. Run keyFieldInvalidValueTest test again. This time, it will pass.

What is the expected output? What do you see instead?
not-inline statement of asList method of ModelQuery object would obtain entity 
property value.

What version of the product are you using? On what operating system?
slim3-1.0.5.jar
AppEngine ver 1.3.6 (Not production environment; test environment by 
LocalServiceTestHelper. Haven't tried on production environment.)
Eclipse Galileo Build id: 20100218-1602 on English Windows XP Sp3

Please provide any additional information below.

Original issue reported on code.google.com by art...@gmail.com on 24 Aug 2010 at 6:56

Attachments:

GoogleCodeExporter commented 9 years ago
You cannot reuse com.google.appengine.api.datastore.PreparedQueryImpl.
ModelQuery uses PreparedQueryImpl internally, so you cannot reuse ModelQuery().

Original comment by higaya...@gmail.com on 24 Aug 2010 at 8:22