Cannot read property '$type' of null - breeze

I'm using the default JsonResultsAdapter after after doing a saveChanges call to the server, the entity that got saved is returned and parsed through the adapter and for some reason a null node is being passed into the visitNode method, causing the whole thing to throw an error. Any help would be appreciated, thanks.
Edit: I should note that this only started happening when I updated to 1.3.1. I was running on 1.2.8 fine.

Related

Grails, findBy don't work with national characters like 'å','ä','ö'

For instance, Supplier.findByName('Röde Orm') returns null even though this name exists in the field "SearchName" in table "Supplier".
Is this correct or do I have to do some reconfiguration of grails?
Well, now the problem disappeared. I don't know why I got the problem in the beginning but I know that the URLEncoder.encode was completely wrong to use here but I never thought about that and after doing some corrections in the database, still using varchar, things started to work but not until I removed the URLEncoder call.

TFS API - Object not set to reference of an object Error

I'm using the TFS api to pull data on some projects into a localized database. Recently this stopped working. and gave us this error.
Object Not Set to Reference of an Object
AND
Null reference exception at the Domain level (this fails the moment it connects)
We are pulling down the hierarchy.
Domain - Collection - Project - Requirements... etc.
Debugging I find that I the code can see the domains but not grab them or anything under them. I am perplexed as to what might have caused this. Our dlls are all up to date with the version of TFS being used (Version 12). Thought it might be a credential issue, but this occurs with any credentials used. I've read that it could be a cache issue with the server side credentials somehow. But I do not have access to this.
I would post code, but I am unsure which part would be the most helpful as the connector method works... just fails when it connects so the problem appears to be elsewhere.
Thoughts?
UPDATE:
I have detected the line of code where we have a failure... but walking through it the code detects all TFS items. Domains, test cases, projects. Everything.
But will always return the Null Reference Exception. Keep in mind this has worked seemlessly for months.
Domain dbDomain = server.Domains.DefaultIfEmpty(null).FirstOrDefault(a => a.DomainId.Equals(domain.DomainId));
Okay so the stupid mistake was in the Lambda expression. It was returning null because it was trying to calculate before a value was assigned. Silly me.
Domain dbDomain = server.Domains.DefaultIfEmpty(null).FirstOrDefault(a => a.DomainId.Equals(domain.DomainId));
Should be:
Domain dbDomain = server.Domains.Where(a => a.DomainId.Equals(domain.DomainId))DefaultIfEmpty(null).FirstOrDefault();

In py2neo, how do I know if a push() worked?

I'm updating a node and pushing it:
remote_graph.push(node)
push() seems to return nothing. How can I tell if the push works? In my test code, I ought to be violating a unique constraint in Neo4J.
How can I tell using py2neo? I expected an exception.
When I enter the equivalent cypher into the Neo4J web tool, I get the following exception:
Node 322184 already exists with label VERSION and property "version"=[1.436818928448956E9]
which is what I expected.
Edit -
What I expected to get back was an indicator of whether the operation worked or not. I think push() accepts an array of nodes, so an array of results would be sensible. I don't know what the indicator would have within it since I don't know what is available. An array of strings would be fine, with each string being a failure reason, or "OK".
Generally speaking, the design of this API is: if it returns OK, you can assume everything has worked as expected, if an error is raised, that error will contain details of what went wrong. Therefore, absence of error should usually be interpreted as a signal of success.
That said, if you believe that your push has failed and no error has been raised, there is a bug in py2neo. For debugging, you can check the state of the database after your push by using the browser and then if you're able to recreate this scenario in a standalone piece of code, please raise an issue on GitHub and I will be happy to fix it.

Metadata bug in Breeze 1.3.1? (Inheritence)

Trying out Breeze 1.3.1 and we've hit a problem. When trying to load the metadata, we get this error:
"Error: Metadata import failed for api/securitychart/Metadata; Unable to process returned metadata:Unable to locate a 'Type' by the name: Vehicle:#Project.Model.Entities"
Just for clarification, the entity "Vehicle" is the base type from which two other entities "Motorbike" and "Car" inherit.
We've digged up a bit through Breeze's code and found that the JSON returned from the ContextProvider.Metadata() method returns the array of entityTypes in the following order:
And the error pops out when trying to parse then entity data for Motorbike.
Without having much idea what was going on, we guessed that the base class Vehicle was not available when trying to parse the metadata for Motorbike, so we manipulated the array to let it process first the base class Vehicle. After doing this, this error no longer appears, but there's a different one: "bad navigation properties".
Can you guys please give us a clue about how to proceed from here?
Edit: As of v 1.3.2, this bug should be fixed. Please post back here to either confirm that it works or that you still have an issue.
Edit: Ok, this is a bug and will be fixed in the next release. And thanks for the repro metadata, it really helped.
Can you send me an email with the "broken" metadata ( the json returned from the server) at breeze.ideablade.com ( with Attn: Jay Traband somewhere in the email). and I'll try to get back to you as soon as possible.

Issue using executeQueryLocally without server metadata

I'm not using EF, so have followed the NoDb sample to successfully load data from my WebApi without using the server side metadata. After the initial load, I was hoping to use the local data cache in the EntityManager while the user interacts with the page. The problem is when I call executeQueryLocally, the cached data set is empty. I stepped through the code to see why the data wasn't being saved to the cache, and there were two issues:
in _getEntityType, metadataStore.isEmpty() was returning true.
in _getEntityType, metadataStore._getEntityTypeNameForResourceName was returning nothing
To get around the this, I added calls in my code to metadataStore.addDataService and metadataStore._setEntityTypeForResourceName. After adding these, the cache was saved properly and executeQueryLocally worked. I'm assuming this was not the intended way to get this to work... Is there something else I am doing wrong? Or is this a bug that can be fixed?
Sorry for taking so long getting back to this one.
We just made the metadataStore.setEntityTypeForResourceName public in breeze v.1.1.3. ( we renamed the method to remove the first '_".
Otherwise, you did exactly the right thing. Good catch.

Resources