question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Value Types are lost after sending data over the driver

See original GitHub issue

Value Types (Integer and Float) are lost after sending data over the driver,

If I create Node with 4 properties:

  • int : 1
  • long : 2L
  • double : 3.0
  • float : 4.0f I would expect same property types to be returned when retrieved from the server via driver.

Neo4j Version: 3.1 Operating System: Win7 API: neo4j-java-driver 1.1.0

Steps to reproduce

  1. Create Node
  2. Assign 4 properties of different types (int, long, double, float)
  3. Retrieve each value and evaluate it’s type against the initial type

Expected behavior

property creation type is equal to retrieved property type.

Actual behavior

int type is retrieved as long float type is retrieved as double

Findings

Well, I can see you’ve got ‘value adapter’ for IntegerValue which in reality combines two types - long and int, and FloatValue - both of which extend NumberValueAdapter. When I’ve created Node and am setting properties - it goes through Values.value(propertyValue) and transforms my Integer into:

    private final long val;
    public IntegerValue( long val ) {
        this.val = val;
    }

and Float into:

    private final double val;
    public FloatValue( double val ) {
        this.val = val;
    }

This makes me sad. So On the server I end up always only persisting long and double typed properties, never int or float. When I retrieve this properties from the server using Node.asMap() -> I again (not surprised) get back IntegerValue and FloatValue which are “transformed” (just returns their val) via NumberValueAdapter.asObject() -> asNumber(); respectively into Long and Double.

What is important - this is not compatible with Official Embedded DB and REST

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
technigecommented, Jul 17, 2017

Closing issue as now being dealt with separately through customer support channel.

0reactions
bHacklvcommented, Jan 19, 2017

@zhenlineo Our application acts as a ‘middleware’ between Neo4j and complex system (which has sub-systems, etc that write and expect to receive correct types). Though I gave an example of what sort of Class and its types we would have - option 1 and option 2 is a no go for us, as at our stage we don’t have class models and still operate in abstract class fashion (Nodes, Rels, etc.). So there would be nothing to map to and we still return properties as Object type (expecting them to have at-persist-time types).

I suppose we would have to stay with our own ‘driver’ solution then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Loss: Causes, Effects & Prevention Methods
Hard Drive Damage​​ The majority of data losses occur due to hardware malfunctions, with the primary perpetrator being the hard drive. Hard drives...
Read more >
Packet loss - Wikipedia
Packet loss occurs when one or more packets of data travelling across a computer network ... is measured as a percentage of packets...
Read more >
Modify or change the data type setting for a field
Convert to this type From this type Changes or restrictions Text Memo Access deletes all but the first 255 characters. Number No restrictions. Currency No restrictions....
Read more >
Snapshot Frequently Asked Questions - Progressive
Snapshot collects information about how you drive, how much you drive, and when you drive. If you're using the mobile app, details about...
Read more >
What happens after your car gets totaled
If you and your insurer cannot agree on the actual cash value of your totaled car, your insurance policy may have an appraisal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found