Issue with persistence?

69 views
Skip to first unread message

Chris Jackson

unread,
Mar 5, 2015, 6:47:56 PM3/5/15
to open...@googlegroups.com
Hi Kai,
I'm seeing data returned from a persistence query from mySQL always returned as a String type. I've not tried to chase this through in the debugger, but I'm wondering if there's a type issue with ESH item types, and OH item types?

In the query, we get the item type with -:

item = itemRegistry.getItem(itemName);

then later down, there's some conversion based on item type into states -:



if (item instanceof NumberItem)

   state = new DecimalType(rs.getDouble(2));
...
    ...
} else
    state = new StringType(rs.getString(2));


As I always see a string, I'm wondering if there's an issue with the item class comparison. Is this something you expect with the compatibility layer? Of course I might be interpreting this wrong, but I thought I'd pass it by you in case you had any thoughts...

Chris


Kai Kreuzer

unread,
Mar 20, 2015, 1:15:12 PM3/20/15
to open...@googlegroups.com
Hi Chris,

Sorry for not having answered this any earlier.

In general, the compat layer should work with openHAB1 classes for 1.x extensions and with ESH classes for anything else.
So what you describe might be a bug here - if you could investigate with the debugger, that might help a lot!

Cheers,
Kai

--
You received this message because you are subscribed to the Google Groups "openhab2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab2+u...@googlegroups.com.
To post to this group, send email to open...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openhab2/20348d60-9e2e-463a-8b1c-5d930b723f68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages