asolfre / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
0 stars 0 forks source link

Embedded string maps (expando) failing #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an entity with an embedded <String,String> map
2. Save it
3. Load it

Exception log:
Caused by: java.lang.NullPointerException
    at com.googlecode.objectify.impl.Transmog.loadSingleValue(Transmog.java:364)
    at com.googlecode.objectify.impl.load.EmbeddedMapSetter.safeSet(EmbeddedMapSetter.java:65)
    at com.googlecode.objectify.impl.load.CollisionDetectingSetter.set(CollisionDetectingSetter.java:37)
    at com.googlecode.objectify.impl.Transmog.loadSingleValue(Transmog.java:359)
    at com.googlecode.objectify.impl.Transmog.load(Transmog.java:340)
    at com.googlecode.objectify.impl.ConcreteEntityMetadata.toObject(ConcreteEntityMetadata.java:203)
    at com.googlecode.objectify.impl.QueryImpl$ToObjectIterator.translate(QueryImpl.java:668)
    at com.googlecode.objectify.impl.QueryImpl$ToObjectIterator.translate(QueryImpl.java:657)
    at com.googlecode.objectify.util.TranslatingIterator.next(TranslatingIterator.java:35)
[...] 

What version of the product are you using? On what operating system?
V3.1

Please provide any additional information below.

@Entity
@Cached
public class WebWidgetInst extends BaseTrackInfo implements Serializable {
    private static final long serialVersionUID = -792309319093394643L;

    @Id
    private Long id;
    @Parent
    private Key<Site> site;
    private String name;
    @Embedded
    Map<String, String> parameters = new HashMap<String, String>();
    @Embedded
    private Key<WebWidget> webWidget;

    public WebWidgetInst() {
    }
 [... setters and getters...]
}

Link in stackoverflow: 
http://stackoverflow.com/questions/9098002/objectify-embedded-maps-fail-to-retri
eve

Original issue reported on code.google.com by planad...@gmail.com on 1 Feb 2012 at 3:00

GoogleCodeExporter commented 9 years ago
Software versions
- GAE SDK 1.6.1
- Objectify v3.1
- Windows 7
- Eclipse Indigo

Original comment by planad...@gmail.com on 1 Feb 2012 at 3:05

GoogleCodeExporter commented 9 years ago
The Ofy 3.x version of embedded Map doesn't support primitives as a target 
type.  Sorry... this feature has caused a lot of problems, and unfortunately it 
isn't practical to fix in v3.  I have removed mention of it from the Ofy3 
documentation.

Map<String, String> (and to any other type supported by Objectify) works fine 
in Ofy4.  The code is ready for use in production but the documentation has not 
been written yet.  If you're willing to migrate, you'll get a lot of 
hand-holding on the mailing list and there are many discussions in the mailing 
list archives.

Once again, sorry for the misfeature.

Original comment by lhori...@gmail.com on 5 Feb 2012 at 10:02