Bug in JPA persistence for dimmer items?

Hi,
I tried to use JPA with postgresql for persistence. The use case in question was to persist the brightness of a LED controller an restore it on restart. The item is defined as a dimmer type implicating an integer value between 0 and 100.

Unlike JDBC persistance JPA uses just one table for storage. The value is stored in a varchar (32672) column and the brightness value in the row looks like a number value in the format “xy.z” (eg. 70.0 for a brightness of 70). As a consequence the system failes to restore the value to the item, e.g. on definition change. In this case the following exception is thrown.

2018-02-20 09:37:51.049 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'LEDController.items'
2018-02-20 09:37:51.074 [ERROR] [e.jpa.internal.JpaPersistenceService] - Error on querying database!
2018-02-20 09:37:51.077 [ERROR] [e.jpa.internal.JpaPersistenceService] - For input string: "0.0"
        java.lang.NumberFormatException: For input string: "0.0"
                at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
                at java.lang.Integer.parseInt(Integer.java:580) [?:?]
                at java.lang.Integer.valueOf(Integer.java:766) [?:?]
                at org.openhab.persistence.jpa.internal.JpaHistoricItem.fromPersistedItem(JpaHistoricItem.java:107) [240:org.openhab.persistence.jpa:1.11.0]
                at org.openhab.persistence.jpa.internal.JpaHistoricItem.fromResultList(JpaHistoricItem.java:89) [240:org.openhab.persistence.jpa:1.11.0]
                at org.openhab.persistence.jpa.internal.JpaPersistenceService.query(JpaPersistenceService.java:200) [240:org.openhab.persistence.jpa:1.11.0]
                at org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate.query(QueryablePersistenceServiceDelegate.java:47) [223:org.openhab.core.compat1x:2.2.0]
                at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.initialize(PersistenceManagerImpl.java:262) [114:org.eclipse.smarthome.core.persistence:0.10.0.b1]
                at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.added(PersistenceManagerImpl.java:406) [114:org.eclipse.smarthome.core.persistence:0.10.0.b1]
                at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.added(PersistenceManagerImpl.java:1) [114:org.eclipse.smarthome.core.persistence:0.10.0.b1]
                at org.eclipse.smarthome.core.common.registry.AbstractRegistry.notifyListeners(AbstractRegistry.java:240) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.common.registry.AbstractRegistry.notifyListeners(AbstractRegistry.java:259) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.common.registry.AbstractRegistry.notifyListenersAboutAddedElement(AbstractRegistry.java:263) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.notifyListenersAboutAddedElement(ItemRegistryImpl.java:321) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.notifyListenersAboutAddedElement(ItemRegistryImpl.java:1) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.common.registry.AbstractRegistry.added(AbstractRegistry.java:136) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.added(ItemRegistryImpl.java:342) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.added(ItemRegistryImpl.java:1) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.common.registry.AbstractRegistry.added(AbstractRegistry.java:1) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:56) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:74) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListenersAboutAddedElement(AbstractProvider.java:78) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:374) [135:org.eclipse.smarthome.model.item:0.10.0.b1]
                at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:314) [134:org.eclipse.smarthome.model.core:0.10.0.b1]
                at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:127) [134:org.eclipse.smarthome.model.core:0.10.0.b1]
                at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:247) [134:org.eclipse.smarthome.model.core:0.10.0.b1]
                at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:311) [134:org.eclipse.smarthome.model.core:0.10.0.b1]
                at org.eclipse.smarthome.core.service.WatchQueueReader.run(WatchQueueReader.java:209) [109:org.eclipse.smarthome.core:0.10.0.b1]
                at java.lang.Thread.run(Thread.java:748) [?:?]

When using the JDBC persistence with the same strategy the exception does not occour and the value is saved in its own table as integer.

I didn’t find where to post this therefore I used the forum.