-4

Using Spring Boot/Hibernate/Jpa i have a model in which i defined:

@Column(name="greenRange", nullable = true)
private int[] greenRange;


public int[] getGreenRange() {
    return greenRange;
}

public void setGreenRange(int[] greenRange) {
    this.greenRange = greenRange;
}

and a simple test method that sets the range to a 2 element array containing ints 2 and 8.

Now, once the values have been persisted, the value of the column is

ACED0005757200025B494DBA602676EAB2A50200007870000000020000000100000008

What could this be?

EDIT: The datatype of the column is RAW. EDIT2: Using Oracle SQL Developer. I am able to print the value after accessing the entity again.

Array.length    array[0]  array[1]
[000000002][00000001][00000008]

?
[ACED0005757200025B494DBA602676EAB2A5020000787]
  • What is the definition of the column in the database? Without knowing that we cannot help you. – Jim Garrison Aug 10 '16 at 16:58
  • 1
    I suspect that it is a hex representation of the `int[]` object. Just for fun, try storing the array `{3,5}' or something else. Compare the results. – bradimus Aug 10 '16 at 17:05
  • 1
    what could what be? Is that what the DB says its value is? if so what DB tool says this?, what your debug says it is?, if so printed out using some method? – Neil Stockton Aug 10 '16 at 17:06
  • DBMS - Oracle Express Studio, The debug prints the values fine, not sure what you mean by what debug says, inspecting the array gives the normal representation with @ and two values. – theturrible Aug 10 '16 at 17:07
  • looks like 70 32bit integers to me. – Andreas Aug 10 '16 at 17:08
  • How much memory do you have that it could be a memory location?! – Dave Newton Aug 10 '16 at 17:09
  • @bradimus ACED0005757200025B494DBA602676EAB2A50200007870000000020000000300000005 with"greenRange": [3, 5] – theturrible Aug 10 '16 at 17:13
  • 1
    `[000000002]` is probably the length of the array. – bradimus Aug 10 '16 at 17:18
  • 1
    `[ACED0005757200025B494DBA602676EAB2A5020000787]` is probably the [java `Object` header](http://stackoverflow.com/questions/26357186/what-is-in-java-object-header) – bradimus Aug 10 '16 at 17:32

1 Answers1

-1

I think that might be the hex representation of the int[] object. Please check oracle docs: Overview of RAW and LONG RAW Datatypes

When Oracle Database automatically converts RAW or LONG RAW data to and from CHAR data, the binary data is represented in hexadecimal form with one hexadecimal character representing every four bits of RAW data. For example, one byte of RAW data with bits 11001011 is displayed and entered as 'CB'.

Ben Green
  • 3,953
  • 3
  • 29
  • 49
pobo
  • 7
  • 4
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – jmattheis Aug 10 '16 at 18:38
  • 1
    Well, indeed, it is true. I will take it into account. Thanks for advice:) – pobo Aug 10 '16 at 19:00