-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Map<String,embedded> breaks with Neo4j/Bolt
PostPosted: Tue Feb 14, 2017 3:45 pm 
Beginner
Beginner

Joined: Thu Jan 05, 2017 1:47 pm
Posts: 27
This seems to be broken with Bolt. It works fine with an embedded Neo4j connection.

We have a field defined as:

@ElementCollection(fetch = FetchType.EAGER)
private java.util.Map<String,MockEmbedded> mapOfEmbedded;

MockEmbedded is annotated with @Embeddable, and contains two fields of types int (value1) and String (value2). The latter was left null for this test.

The data seems to be written to the database, though the result seems suspect (not sure what it's suppose to look like though):
- itcreates an edge, with label 'mapOfEmbedded', from entity with property mapOfEmbedded_KEY=<key>
- to a node, with label '<entityname>_mapOfEmbedded' and no properties
- another edge, with label 'value', and no properties
- to a node, with only the label 'EMBEDDED', and a property value1=<value>

Seems like that intermediate node might be superfluous, or maybe there's a good reason for it.

And I don't know what it looks like in the db when I use an embedded Neo4j connection. I'm not sure of an easy way to extract that information.

Plain embedded, and List<embedded>, fields work fine with both connection types.


Top
 Profile  
 
 Post subject: Re: Map<String,embedded> breaks with Neo4j/Bolt
PostPosted: Wed Feb 15, 2017 9:50 am 
Beginner
Beginner

Joined: Thu Jan 05, 2017 1:47 pm
Posts: 27
In case it's useful, here's the relevant part of the trace logs while using Bolt:

08:25:23.100 [Test worker] DEBUG o.h.o.p.impl.OgmCollectionPersister - Inserting collection: [com.nokia.nspos.model.domain.mock.entities.MockEntity.mapOfEmbedded#262]
08:25:23.100 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [262] to parameter(s) [mock_MockEntity_dbId]
08:25:23.100 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [equip] to parameter(s) [mapOfEmbedded_KEY]
08:25:23.100 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [2] to parameter(s) [mapOfEmbedded.value.value1]
08:25:23.100 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [null] to parameter [mapOfEmbedded.value.value2]
08:25:23.101 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [262] to parameter(s) [mock_MockEntity_dbId]
08:25:23.101 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [262] to parameter(s) [dbId]
08:25:23.103 [Test worker] TRACE org.hibernate.ogm.datastore.access - Reading association with key AssociationKey(mock_MockEntity_mapOfEmbedded) [mock_MockEntity_dbId=262] from datastore and context AssociationContextImpl [associationTypeContext=AssociationContext [optionsContext=OptionsContextImpl [entityType=class com.nokia.nspos.model.domain.mock.entities.MockEntity, propertyName=mapOfEmbedded]], operationsQueue=null, entityTuple=TuplePointer[Tuple[mockFloat=0.0, mockString=mock, mockEnum2=1, mockEnum=0, mockTimestamp=1459399611000, mockLong2=0, _modelVersion=1.0.1, mockEnum3=0, mockLong=1, mockBoolean2=false, anotherSource.namespace=sam, mockInt=1, anotherSource.fdn=abc:def, dbId=262, mockFloat2=0.0, singleEmbedded.value1=3, DTYPE=mock_MockEntity, singleEmbedded.value2=hello, _version=0, myFloat=0.0, superValue1=0, mockBoolean=false, nativeMockInt=1, mockBigInt=10, mockTimestamp2=0, anotherSource.scheme=1, mockBigInt2=10]]]
08:25:23.197 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [262] to parameter(s) [mock_MockEntity_dbId]
08:25:23.197 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [fm] to parameter(s) [mapOfEmbedded_KEY]
08:25:23.197 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [1] to parameter(s) [mapOfEmbedded.value.value1]
08:25:23.197 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [null] to parameter [mapOfEmbedded.value.value2]
08:25:23.197 [Test worker] TRACE org.hibernate.ogm.datastore.access - Creating association with key AssociationKey(mock_MockEntity_mapOfEmbedded) [mock_MockEntity_dbId=262] in datastore
08:25:23.202 [Test worker] TRACE org.hibernate.ogm.datastore.access - Determining whether association DefaultAssociationKeyMetadata [table=mock_MockEntity_mapOfEmbedded, columnNames=[mock_MockEntity_dbId], isInverse=false, collectionRole=mapOfEmbedded, associationKind=EMBEDDED_COLLECTION, rowKeyColumnNames=[mock_MockEntity_dbId, mapOfEmbedded_KEY], rowKeyIndexColumnNames=[mapOfEmbedded_KEY], associatedEntityKeyMetadata=DefaultAssociatedEntityKeyMetadata [associationKeyColumns=[mapOfEmbedded.value.value1, mapOfEmbedded.value.value2], entityKeyMetadata=DefaultEntityKeyMetadata{table='mock_MockEntity_mapOfEmbedded', columnNames=[mapOfEmbedded.value.value1, mapOfEmbedded.value.value2]}]] is stored in an entity structure
08:25:23.203 [Test worker] DEBUG o.h.o.p.impl.OgmCollectionPersister - done inserting collection: 2 rows inserted


And here it is for Embedded Neo4j:

08:39:47.234 [Test worker] DEBUG o.h.o.p.impl.OgmCollectionPersister - Inserting collection: [com.nokia.nspos.model.domain.mock.entities.MockEntity.mapOfEmbedded#1]
08:39:47.234 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [1] to parameter(s) [mock_MockEntity_dbId]
08:39:47.234 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [equip] to parameter(s) [mapOfEmbedded_KEY]
08:39:47.234 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [2] to parameter(s) [mapOfEmbedded.value.value1]
08:39:47.234 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [null] to parameter [mapOfEmbedded.value.value2]
08:39:47.234 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [1] to parameter(s) [mock_MockEntity_dbId]
08:39:47.235 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [1] to parameter(s) [dbId]
08:39:47.238 [Test worker] TRACE org.hibernate.ogm.datastore.access - Reading association with key AssociationKey(mock_MockEntity_mapOfEmbedded) [mock_MockEntity_dbId=1] from datastore and context AssociationContextImpl [associationTypeContext=AssociationContext [optionsContext=OptionsContextImpl [entityType=class com.nokia.nspos.model.domain.mock.entities.MockEntity, propertyName=mapOfEmbedded]], operationsQueue=null, entityTuple=TuplePointer[Tuple[mockFloat=0.0, mockString=mock, mockEnum2=1, mockEnum=0, mockTimestamp=1459399611000, mockLong2=0, _modelVersion=1.0.1, mockEnum3=0, mockLong=1, mockBoolean2=false, anotherSource.namespace=sam, mockInt=1, anotherSource.fdn=abc:def, dbId=1, mockFloat2=0.0, singleEmbedded.value1=3, DTYPE=mock_MockEntity, singleEmbedded.value2=hello, _version=0, myFloat=0.0, mockBoolean=false, superValue1=0, nativeMockInt=1, mockBigInt=10, mockTimestamp2=0, anotherSource.scheme=1, mockBigInt2=10]]]
08:39:47.260 [Test worker] TRACE o.h.o.d.n.logging.impl.GraphLogger - Found owner node: (:`MOCK_MOCKENTITY`:ENTITY{dbId:1, mockFloat:0.0, mockString:"mock", mockEnum2:1, mockEnum:0, mockTimestamp:1459399611000, mockLong2:0, `_modelVersion`:"1.0.1", mockEnum3:0, mockLong:1, mockBoolean2:false, mockInt:1, mockFloat2:0.0, DTYPE:"mock_MockEntity", myFloat:0.0, `_version`:0, mockBoolean:false, superValue1:0, mockBigInt:"10", nativeMockInt:1, mockTimestamp2:0, mockBigInt2:"10"})
08:39:47.364 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [1] to parameter(s) [mock_MockEntity_dbId]
08:39:47.364 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [fm] to parameter(s) [mapOfEmbedded_KEY]
08:39:47.364 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [1] to parameter(s) [mapOfEmbedded.value.value1]
08:39:47.364 [Test worker] TRACE o.h.o.t.d.impl.BasicGridBinder - binding [null] to parameter [mapOfEmbedded.value.value2]
08:39:47.365 [Test worker] TRACE org.hibernate.ogm.datastore.access - Creating association with key AssociationKey(mock_MockEntity_mapOfEmbedded) [mock_MockEntity_dbId=1] in datastore
08:39:47.422 [Test worker] TRACE o.h.o.d.n.logging.impl.GraphLogger - Created relationship: (:`MOCK_MOCKENTITY`:ENTITY{dbId:1, mockFloat:0.0, mockString:"mock", mockEnum2:1, mockEnum:0, mockTimestamp:1459399611000, mockLong2:0, `_modelVersion`:"1.0.1", mockEnum3:0, mockLong:1, mockBoolean2:false, mockInt:1, mockFloat2:0.0, DTYPE:"mock_MockEntity", myFloat:0.0, `_version`:0, mockBoolean:false, superValue1:0, mockBigInt:"10", nativeMockInt:1, mockTimestamp2:0, mockBigInt2:"10"}) - [mapOfEmbedded{`mapOfEmbedded_KEY`:"equip"}] - (:EMBEDDED:`mock_MockEntity_mapOfEmbedded`)
08:39:47.424 [Test worker] TRACE o.h.o.d.n.logging.impl.GraphLogger - Created relationship: (:`MOCK_MOCKENTITY`:ENTITY{dbId:1, mockFloat:0.0, mockString:"mock", mockEnum2:1, mockEnum:0, mockTimestamp:1459399611000, mockLong2:0, `_modelVersion`:"1.0.1", mockEnum3:0, mockLong:1, mockBoolean2:false, mockInt:1, mockFloat2:0.0, DTYPE:"mock_MockEntity", myFloat:0.0, `_version`:0, mockBoolean:false, superValue1:0, mockBigInt:"10", nativeMockInt:1, mockTimestamp2:0, mockBigInt2:"10"}) - [mapOfEmbedded{`mapOfEmbedded_KEY`:"fm"}] - (:EMBEDDED:`mock_MockEntity_mapOfEmbedded`)

08:39:47.424 [Test worker] TRACE org.hibernate.ogm.datastore.access - Determining whether association DefaultAssociationKeyMetadata [table=mock_MockEntity_mapOfEmbedded, columnNames=[mock_MockEntity_dbId], isInverse=false, collectionRole=mapOfEmbedded, associationKind=EMBEDDED_COLLECTION, rowKeyColumnNames=[mock_MockEntity_dbId, mapOfEmbedded_KEY], rowKeyIndexColumnNames=[mapOfEmbedded_KEY], associatedEntityKeyMetadata=DefaultAssociatedEntityKeyMetadata [associationKeyColumns=[mapOfEmbedded.value.value1, mapOfEmbedded.value.value2], entityKeyMetadata=DefaultEntityKeyMetadata{table='mock_MockEntity_mapOfEmbedded', columnNames=[mapOfEmbedded.value.value1, mapOfEmbedded.value.value2]}]] is stored in an entity structure
08:39:47.424 [Test worker] DEBUG o.h.o.p.impl.OgmCollectionPersister - done inserting collection: 2 rows inserted

I've highlighted the differences.


Top
 Profile  
 
 Post subject: Re: Map<String,embedded> breaks with Neo4j/Bolt
PostPosted: Wed Feb 15, 2017 12:56 pm 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Thanks for the feedback, I'll look into this


Top
 Profile  
 
 Post subject: Re: Map<String,embedded> breaks with Neo4j/Bolt
PostPosted: Wed Feb 22, 2017 5:54 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
There is definitly something odd about mapping of embedded in Neo4j, I'll fix it for the 5.2 release.

I haven't found any easy way to check the content of an embedded Neo4j db. You can use the Neo4j server and update the configuration to point to the location of the embedded db.
The problem is that only one process at the time can access the embedded db, so. if your application is running the server won't be able to read it and if the server is using it your application won't be able to access it.
I don't think there is a solution for this at the moment but please, let me know if you can find one.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.