{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/2081","repository_url":"https://api.github.com/repos/eclipse/smarthome","labels_url":"https://api.github.com/repos/eclipse/smarthome/issues/2081/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/smarthome/issues/2081/comments","events_url":"https://api.github.com/repos/eclipse/smarthome/issues/2081/events","html_url":"https://github.com/eclipse/smarthome/pull/2081","id":174064401,"number":2081,"title":"H2 persistence","user":{"login":"maggu2810","id":204670,"avatar_url":"https://avatars.githubusercontent.com/u/204670?v=3","gravatar_id":"","url":"https://api.github.com/users/maggu2810","html_url":"https://github.com/maggu2810","followers_url":"https://api.github.com/users/maggu2810/followers","following_url":"https://api.github.com/users/maggu2810/following{/other_user}","gists_url":"https://api.github.com/users/maggu2810/gists{/gist_id}","starred_url":"https://api.github.com/users/maggu2810/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maggu2810/subscriptions","organizations_url":"https://api.github.com/users/maggu2810/orgs","repos_url":"https://api.github.com/users/maggu2810/repos","events_url":"https://api.github.com/users/maggu2810/events{/privacy}","received_events_url":"https://api.github.com/users/maggu2810/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":26,"created_at":"2016-08-30T16:25:14Z","updated_at":"2016-09-03T10:59:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eclipse/smarthome/pulls/2081","html_url":"https://github.com/eclipse/smarthome/pull/2081","diff_url":"https://github.com/eclipse/smarthome/pull/2081.diff","patch_url":"https://github.com/eclipse/smarthome/pull/2081.patch"},"body":"Replaces #1956\r\n\r\nThe first commit adds the code base as it has been implemented by @cdjackson \r\n\r\nI changed some further stuff:\r\n* remove bundle activator (it only contained log messages without any usage)\r\n* run `mvn license:format` to fix headers\r\n* change naming from \"h2sql\" to \"h2\" (the name of the database is h2)\r\n* clean pom files (e.g. there has been stuff present from openhab)\r\n* drop bundled h2 jar\r\n* apply formatter\r\n* drop static keyword from logger (it is not used in any static context)\r\n* add a karaf feature\r\n* use service (drop usage of Class.forName)\r\n* add jdbc OSGi spec and h2 to the target platform\r\n\r\nThere is one interesting part:\r\nUsing OSGi services we don't rely on h2 at compile time.\r\nSo, if I move the \"add jdbc OSGi spec and h2 to the target platform\" (which depends on #2078) to another PR, the code base could (IMHO) already be merged. Then further code improvements and fixes could be done more easily as the code base is already in the ESH repo.\r\nThe only dependency to a h2 driver is at runtime here: https://github.com/eclipse/smarthome/compare/master...maggu2810:h2-persistence#diff-9ac38d0ba0e87f12bb74bd4a74250736R18\r\n"},"comment":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/comments/244540210","html_url":"https://github.com/eclipse/smarthome/pull/2081#issuecomment-244540210","issue_url":"https://api.github.com/repos/eclipse/smarthome/issues/2081","id":244540210,"user":{"login":"watou","id":3008217,"avatar_url":"https://avatars.githubusercontent.com/u/3008217?v=3","gravatar_id":"","url":"https://api.github.com/users/watou","html_url":"https://github.com/watou","followers_url":"https://api.github.com/users/watou/followers","following_url":"https://api.github.com/users/watou/following{/other_user}","gists_url":"https://api.github.com/users/watou/gists{/gist_id}","starred_url":"https://api.github.com/users/watou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watou/subscriptions","organizations_url":"https://api.github.com/users/watou/orgs","repos_url":"https://api.github.com/users/watou/repos","events_url":"https://api.github.com/users/watou/events{/privacy}","received_events_url":"https://api.github.com/users/watou/received_events","type":"User","site_admin":false},"created_at":"2016-09-03T10:59:20Z","updated_at":"2016-09-03T10:59:20Z","body":"> I'm not sure I follow this. By IDENTITY do you mean the names of the state tables? If so, this is what I did in the original SQL binding (and I think is still done in most SQL bindings) where there is an index table to link items to tables. When I originally implemented H2 I decided to remove this extra level of abstraction and just use the item name as the table name. Since the item name is already a UID, and it avoided the extra lookup. I don't see that this will decrease storage though since the item name isn't stored anywhere - it's only used as the table name.\r\n\r\n@cdjackson: I was continuing to discuss my suggestion of using one table per state type (DecimalStates, StringStates, OnOffStates, UnDefStates, etc.) instead of one table per item, so that all possible states could be stored.  IDENTITY refers to a further refinement to the suggestion, to add an Items table containing the item name and an IDENTITY column being the [H2 data type used to generate unique ID values to use as a key](http://www.h2database.com/html/datatypes.html#identity_type).  So each per-state-type table would contain the timestamp, the IDENTITY key into the Items table, and the most \"natural\" H2 data type that corresponds to the state type.  This would result, at least theoretically, in the smallest amount of storage needed for each row, stored in the most appropriate H2 data types available to store those states, and allowing all states to be stored."}}
{"actor":{"display_login":"watou"}}