Skip to content

Commit

Permalink
NodeStore in Neo4JAdaptor ignores and warns on situation when a row p…
Browse files Browse the repository at this point in the history
…rovided for insertion has no primary key (it seems to be not correct EOF behaviour)
  • Loading branch information
Jedrzej Sobanski committed Dec 13, 2012
1 parent 35e605e commit 9532c76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public Cursor<Neo4JErsatz> query(EOQualifier qualifier) {
public Neo4JErsatz insert(Ersatz row) {
Neo4JErsatz newNeo = neoStore.insert(row);

luceneStore.insert(newNeo);
if (newNeo != null) {
luceneStore.insert(newNeo);
}

return newNeo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ public Neo4JErsatz insert(Ersatz row) {
if (pkValue == null) {
// it happens in case of inserts of rows with attributes like "NeededByEOF0" which seem not to be real rows.
log.warn("Primary key value is null for " + row + ". Ignoring it (not sure if it's correct behaviour)");
return null;
}
if (pkValue != null && false == pkValue instanceof NodeNumber) {
throw new IllegalStateException("Value for primary key " + entity.name() + "." + pk.name() + " was set manually. This adaptor only supports inserts where primary keys aren't set on insert time.");
}

long id = ((NodeNumber) row.get(pk)).longValue();
long id = ((NodeNumber) pkValue).longValue();
final Node node = db.getNodeById(id);

if (spaceManager.isPermanent(node)) {
Expand Down

0 comments on commit 9532c76

Please sign in to comment.