Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Luciano Curioni
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Store HBase

Cannot retrieve Integer fields since changes on plugin.xml in datanucleus-core with commit r16924 (

Created: 29/Aug/13 08:49 PM   Updated: 19/Nov/13 10:29 AM   Resolved: 01/Sep/13 02:54 PM
Component/s: Persistence
Affects Version/s: 3.2.2
Fix Version/s: 3.2.3

Environment: Teste on OSX and HBase 0.94.11

Datastore: HBase
Severity: Production

 Description  « Hide
After storing an Integer field on HBase it is not possible to retrieve it. Datanucleus find that the stored field is a Strng while it is already a Integer object. The Exception and partial stack is:
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at org.datanucleus.state.JDOStateManager.replacingObjectField(
at org.datanucleus.samples.jdo.tutorial.Book.jdoReplaceField(
at org.datanucleus.samples.jdo.tutorial.Product.jdoReplaceFields(
at org.datanucleus.state.JDOStateManager.replaceFields(
at org.datanucleus.state.JDOStateManager.replaceFields(

This test was done with datanucleus-core and datanucleus-hbase on the SVN trunk and also the latest releases versions.
The issue sounds very similar to NUCMONGODB-122, but with HBase

Please let me know how I can help.

This can be easily reproduced with a patch to the jdo-sample against a HBase database. The patch is:

diff --git a/src/main/java/org/datanucleus/samples/jdo/tutorial/ b/src/main/java/org/datanucleus/samples/jdo/tutorial/
index 2e60c84..0546239 100644
--- a/src/main/java/org/datanucleus/samples/jdo/tutorial/
+++ b/src/main/java/org/datanucleus/samples/jdo/tutorial/
@@ -18,6 +18,7 @@
 package org.datanucleus.samples.jdo.tutorial;
 import javax.jdo.annotations.PersistenceCapable;
+import javax.jdo.annotations.Persistent;
  * Definition of a Book. Extends basic Product class.
@@ -30,6 +31,17 @@
     protected String isbn=null;
     protected String publisher=null;
+ @Persistent
+ protected Integer pages;
+ public Integer getPages() {
+ return pages;
+ }
+ public void setPages(Integer pages) {
+ this.pages = pages;
+ }
     public Book(String name, String description, double price, String author, String isbn, String publisher)
@@ -71,6 +83,6 @@
     public String toString()
- return "Book : " + author + " - " + name;
+ return "Book : " + author + " - " + name + " - " + pages;
\ No newline at end of file
diff --git a/src/main/java/org/datanucleus/samples/jdo/tutorial/ b/src/main/java/org/datanucleus/samples/jdo/tutorial/
index 778fa4e..0b89362 100644
--- a/src/main/java/org/datanucleus/samples/jdo/tutorial/
+++ b/src/main/java/org/datanucleus/samples/jdo/tutorial/
@@ -53,6 +53,7 @@
             Inventory inv = new Inventory("My Inventory");
             Product product = new Product("Sony Discman","A standard discman from Sony",200.00);
             Book book = new Book("Lord of the Rings by Tolkien","The classic story",49.99,"JRR Tolkien", "12345678", "MyBooks Factory");
+ book.setPages(314);
diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml
index f5dbe0e..2c69c9e 100644
--- a/src/main/resources/META-INF/persistence.xml
+++ b/src/main/resources/META-INF/persistence.xml
@@ -11,11 +11,11 @@
             <!-- ENABLE THESE FOR H2 -->
- <property name="javax.jdo.option.ConnectionURL" value="jdbc:h2:mem:nucleus1"/>
+ <!-- <property name="javax.jdo.option.ConnectionURL" value="jdbc:h2:mem:nucleus1"/>
             <property name="javax.jdo.option.ConnectionDriverName" value="org.h2.Driver"/>
             <property name="javax.jdo.option.ConnectionUserName" value="sa"/>
             <property name="javax.jdo.option.ConnectionPassword" value=""/>
- <property name="javax.jdo.option.Mapping" value="h2"/>
+ <property name="javax.jdo.option.Mapping" value="h2"/> -->
             <!-- ENABLE THESE FOR HSQLDB -->
             <!--property name="javax.jdo.option.ConnectionURL" value="jdbc:hsqldb:mem:nucleus1"/>
@@ -41,7 +41,8 @@
             <!--property name="javax.jdo.option.ConnectionURL" value="mongodb:/nucleus1"/-->
             <!-- ENABLE THESE FOR HBASE -->
- <!--property name="javax.jdo.option.ConnectionURL" value="hbase:"/-->
+ <property name="javax.jdo.option.ConnectionURL" value="hbase:"/>
+ <property name="datanucleus.cache.level2.type" value="none" />
             <!-- ENABLE THESE FOR NEO4J -->
             <!--property name="javax.jdo.option.ConnectionURL" value="neo4j:testDB"/-->

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 30/Aug/13 02:37 PM
The DN tutorial is not a testcase. Please follow the standard reporting guide which offers ample flexibility. Thx

Better still, actually state what you see as the problem. MongoDB plugin was storing things incorrectly (i.e allowing things to fall back to core handling when the datastore didn't warrant that). The datastore plugin is responsible for managing such things itself; the additional feature in core provides extra capabilities, so it is up to datastore plugins to use them or not. When you've done that you could just grab the code for the plugin and contribute a patch to fix whatever you're seeing

Andy Jefferson added a comment - 01/Sep/13 02:54 PM
Since there is no provided way of seeing this, I presume it works in 3.2.3