Done! http://team.ops4j.org/browse/QI-349
Will there be a patch release? /Dag 2011/9/14 Niclas Hedhman <[email protected]> > Good catch!! Can you create an jira issue on that? As in 2.0 it needs > to be re-implemented :-( > > > Thanks > Niclas > > On Wed, Sep 14, 2011 at 2:36 AM, Dag Blakstad <[email protected]> > wrote: > > Hi! > > > > I had some problems migrating the entitystore fra 1.3 to 1.4. I > discovered > > that populating entities with namedassociations failed: > > org.json.JSONException: > > JSONObject"namedassociations"< > https://wiki.cantara.no/pages/createpage.action?spaceKey=retrade&title=%22namedassociations%22&linkCreation=true&fromPageId=24184572 > > > > not > > found. > > at org.json.JSONObject.get(JSONObject.java:617) > > at org.json.JSONObject.getJSONObject(JSONObject.java:733) > > at > > > org.qi4j.entitystore.map.MapEntityStoreMixin.createNamedAssociations(MapEntityStoreMixin.java:495) > > at > > > org.qi4j.entitystore.map.MapEntityStoreMixin.readEntityState(MapEntityStoreMixin.java:438) > > at > > > org.qi4j.entitystore.map.MapEntityStoreMixin.getEntityState(MapEntityStoreMixin.java:122) > > at $Proxy119.getEntityState(Unknown Source) > > at > > > org.qi4j.spi.entitystore.DefaultEntityStoreUnitOfWork.getEntityState(DefaultEntityStoreUnitOfWork.java:83) > > at > > > org.qi4j.spi.entitystore.ConcurrentModificationCheckConcern$ConcurrentCheckingEntityStoreUnitOfWork.getEntityState(ConcurrentModificationCheckConcern.java:129) > > > > The code in MapEntityStoreMixin.createNamedAssociations gave me a clue: > > > > private Map<QualifiedName, Map<String,EntityReference>> > > createNamedAssociations( JSONObject jsonObject, > > > > EntityDescriptor entityDescriptor > > ) > > throws JSONException > > { > > Map<QualifiedName, Map<String,EntityReference>> > > namedAssociations = new HashMap<QualifiedName, > > Map<String,EntityReference>>(); > > JSONObject namedAssocs = jsonObject.getJSONObject( > > "namedassociations" ); > > for( AssociationDescriptor namedAssociationType : > > entityDescriptor.state().namedAssociations() ) > > { > > Map<String, EntityReference> references = new > > HashMap<String,EntityReference>(); > > try > > { > > JSONObject jsonValues = namedAssocs.getJSONObject( > > namedAssociationType.qualifiedName().name() ); > > for( String name : jsonValues ) > > { > > Object jsonValue = jsonValues.getString( name ); > > EntityReference value = jsonValue == > > JSONObject.NULL ? null : EntityReference.parseEntityReference( > > (String) jsonValue ); > > references.put( name, value ); > > } > > namedAssociations.put( > > namedAssociationType.qualifiedName(), references ); > > } > > catch( JSONException e ) > > { > > // NamedAssociation not found, default to empty one > > namedAssociations.put( > > namedAssociationType.qualifiedName(), references ); > > } > > } > > return namedAssociations; > > } > > > > > > I moved JSONObject namedAssocs = jsonObject.getJSONObject( > > "namedassociations" ); > > into the try-block, and that seems to eliminate the problem. > > > > I guess this is a bug. > > > > Best Regards, > > > > Dag > > > > -- > > ------------------------------------ > > Dag Blakstad > > http://no.linkedin.com/in/dagblakstad > > http://webstep.no/ansatte/dag-blakstad/ > > Senior Konsulent Webstep AS > > Mobil : +47 95 22 69 22 > > Lysaker Torg 2, 1366 Oslo > > > > Pb 66, 1324 Lysaker > > > > http://www.webstep.no > > Oslo - Bergen - Stavanger - Trondheim > > ------------------------------------ > > _______________________________________________ > > qi4j-dev mailing list > > [email protected] > > http://lists.ops4j.org/mailman/listinfo/qi4j-dev > > > > > > -- > Niclas Hedhman, Software Developer > http://www.qi4j.org - New Energy for Java > > I live here; http://tinyurl.com/3xugrbk > I work here; http://tinyurl.com/24svnvk > I relax here; http://tinyurl.com/2cgsug > > _______________________________________________ > qi4j-dev mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/qi4j-dev > -- ------------------------------------ Dag Blakstad http://no.linkedin.com/in/dagblakstad http://webstep.no/ansatte/dag-blakstad/ Senior Konsulent Webstep AS Mobil : +47 95 22 69 22 Lysaker Torg 2, 1366 Oslo Pb 66, 1324 Lysaker http://www.webstep.no Oslo - Bergen - Stavanger - Trondheim ------------------------------------ _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

