Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

PostgreSQL: Initial new PostgreSQL Persistence Service. #2804 #2805

Closed
wants to merge 7 commits into from

Conversation

lewie
Copy link
Contributor

@lewie lewie commented Jun 26, 2015

No description provided.

org.openhab.core.library.types,
org.openhab.core.persistence,
org.openhab.core.types,
org.openhab.io.net.http,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that import really used in your code?

@teichsta
Copy link
Member

teichsta commented Jul 1, 2015

Hi @lewie,

i had a quick look through the code. Please find my comments inline and some general comments below:

  • move code to src/main/java
  • add license header to each file (or update to 2015) - use ‘''mvn -Dyear=2015 license:format’'' to accomplish that easily
  • finally squash your commits into one

Since this binding seem to be a merely a copy of the mysql binding this leads to tremendous code duplication which i am not very keen on. Have you had a look into the JPA binding? Would that work for you as well?

Best, Thomas E.-E.

@lewie
Copy link
Contributor Author

lewie commented Jul 1, 2015

Absolutely, I agree! But JPA is saving Item values all in one Table as Strings, for me this is not a good solution (limited scalability).

As you can see, I have build in a Function for Table renaming (Prefix as Itemnames or simple "item", Suffix as ID with zeros filled).
Thought about to extend this idea for JPA, so that it can work with to Database models:
Model1: one Table with Strings
OR
Model2: every Item a Table with typical datatypes for each Item (only for SQL-Drivers).

In short, this would be a Merge of Mysql-, PostgreSql-, JPA-Service to one Extended-JPA-Service.

But it takes Time, we all don't have, isn't it.
I would like to implement, but rather facing to OpenHab2.

Rgds
Helmut

@lewie
Copy link
Contributor Author

lewie commented Jul 1, 2015

OK, STOP!
I hate code duplication too much.
Will do the light solution:
Model3: Merging Mysql- and PostgreSql-Service for now and OpenHab1.

What do you think of this solution?

What would be a good name:
"MyPostreSQL"?

Rgds
Helmut

@watou
Copy link
Contributor

watou commented Jul 1, 2015

Just to add one voice as a user of MySQL persistence: I would not like to see the existing MySQL persistence code changed to accommodate an additional database engine, since this will cause issues. Perhaps either evolve the JPA persistence bundle, or make a new, generic JDBC persistence bundle that works with PostgresSQL and possibly other configurable JDBC drivers (but knowing that driver-swappable JDBC under OSGi is a configuration headache, along the lines of this, for example).

@lewie
Copy link
Contributor Author

lewie commented Jul 1, 2015

@watou: Then a generic JDBC persistence bundle would be the best Choice, isn't it.
Externalize the Driver (jar) and SQL Part from Service Logic.
I will do some Tests... stay tuned.

Either way, it would, however, be an additional Bundle.
The Naming would be more generally. (not PostgreSql as this PR)

Rgds
Helmut

@watou
Copy link
Contributor

watou commented Jul 1, 2015

Based on a quick read through the MySQL and JPA code, I agree that a more generic JDBC persistence bundle would make sense, with the goal that it would support as many JDBC drivers as users expressed interest in using. Eventually, it could obsolete the MySQL persistence bundle and yet be fully compatible with existing MySQL databases that were created by the MySQL persistence bundle. That way, you get PostgresSQL support but without creating "yet another" database-specific persistence bundle, and without disturbing the existing MySQL bundle. I'm sure Kai, Thomas and others have thoughts and know the history better, but this is my take for now.

@lewie
Copy link
Contributor Author

lewie commented Jul 1, 2015

@watou: That sounds great for me.

The only Thing I want to say:
I'm not a SQL Guru for several Databases and its peculiarities.
I would begin to program it for MySql and PSql at first, based on the ideas in JPA, MySql and PostgreSql services.
True specialists could then do improvements for SQL and the program structure. But a start to bring together all JDBC persistence services would be made.

My name proposal for the new Service would be: "JDBC" ;-)

@teichsta: In the meantime, I withdraw my PR

Rgds
Helmut

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants