New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sql repository #67

Closed
pszymczyk opened this Issue Dec 5, 2014 · 20 comments

Comments

Projects
None yet
4 participants
@pszymczyk
Member

pszymczyk commented Dec 5, 2014

As a relational database user i want to persists changes in Sql reposioty.

pszymczyk added a commit that referenced this issue Jan 19, 2015

pszymczyk added a commit that referenced this issue Jan 19, 2015

pszymczyk added a commit that referenced this issue Jan 20, 2015

pszymczyk added a commit that referenced this issue Jan 20, 2015

pszymczyk added a commit that referenced this issue Jan 21, 2015

pszymczyk added a commit that referenced this issue Jan 21, 2015

pszymczyk added a commit that referenced this issue Jan 21, 2015

pszymczyk added a commit that referenced this issue Jan 22, 2015

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 1, 2015

what about read ? :)

@pszymczyk

This comment has been minimized.

Member

pszymczyk commented Feb 2, 2015

Still some problems with H2 in mem

@pszymczyk

This comment has been minimized.

Member

pszymczyk commented Feb 2, 2015

def maxSnapshotPk = SELECT MAX(snapshot_pk) FROM jv_snapshot, jv_global_id, jv_cdo_class WHERE qualified_name = 'org.javers.core.model.SnapshotEntity' LIMIT 2 OFFSET 0

SELECT "jv_commit"."author", "jv_commit"."commit_date", "jv_commit"."commit_id", ""jv_snapshot"."type" FROM "public"."jv_snapshot", "public"."jv_commit" where "jv_commit"."commit_pk" = "jv_snapshot"."commit_fk" AND "jv_snapshot"."snapshot_pk" = maxSnapshotPk

SELECT "public"."jv_snapshot_property"."name", "public"."jv_snapshot_property"."value" FROM "public"."jv_snapshot_property" where "public"."jv_snapshot_property"."snapshot_fk" = $fk

smth like this ^^

@pszymczyk

This comment has been minimized.

Member

pszymczyk commented Feb 2, 2015

btw MAX works fine, it was my mistake ;)

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 3, 2015

  • trzeba usunąc limit z zapytań z MAX
  • dodać joiny :)

może
Snapshot snapshotRepository getById(int snapshoId)
?

i wtedy Snapshot powinien mieć zbudowany commit i propertisy

pszymczyk added a commit that referenced this issue Feb 3, 2015

pszymczyk added a commit that referenced this issue Feb 4, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

@efreet007

This comment has been minimized.

efreet007 commented Feb 10, 2015

Hi
When do you plan to implement this feature? Will it work with MS SQL Server?

@pszymczyk

This comment has been minimized.

Member

pszymczyk commented Feb 10, 2015

Hi
We use https://github.com/polyjdbc/polyjdbc as wrapper under standard JDBC driver, in current version Poly supperts only:

  • H2
  • PostgreSQL
  • MySQL
  • Oracle (without limit/offset in SELECT)

if you want to use MS SQL Server it should be implemented in Poly.

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 10, 2015

Pawel wanted to say, that we'll add MS SQL support to PolyJDBC after we finished
work with this issue. Now we are focused on open databases. Adding support for commercial databases (Oracle, MS SQL) is the next step. Rough estimate for this is 2015.03.

efreet007, would you like to contribute to JaVars and help us with SQL stuff?

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 10, 2015

efreet007 please put new issue for MS SQL support

pszymczyk added a commit that referenced this issue Feb 10, 2015

pszymczyk added a commit that referenced this issue Feb 10, 2015

@efreet007

This comment has been minimized.

efreet007 commented Feb 11, 2015

Done: polyjdbc/polyjdbc#9
Regarding contribution, I do not promise but I will take a look around

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 11, 2015

efreet007
I've created separeted JaVeres issue for that
#100
please put a comment there to receive notifications

pszymczyk added a commit that referenced this issue Feb 11, 2015

pszymczyk added a commit that referenced this issue Feb 11, 2015

pszymczyk added a commit that referenced this issue Feb 11, 2015

pszymczyk added a commit that referenced this issue Feb 11, 2015

bartoszwalacik added a commit that referenced this issue Feb 11, 2015

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 20, 2015

@efreet007
JaversSqlRepository beta is available for testing
see version 1.0.7-SNAPSHOT
in https://oss.sonatype.org/content/repositories/snapshots/
for now there is support for H2, MySql and Postgres

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 20, 2015

config example

        def dbConnection = DriverManager.getConnection("jdbc:h2:tcp://localhost:9092/mem:test")
        def connectionProvider = new ConnectionProvider() {
            @Override
            Connection getConnection() {
               return dbConnection
            }
        }

        def sqlRepository = SqlRepositoryBuilder
                .sqlRepository()
                .withConnectionProvider(connectionProvider)
                .withDialect(DialectName.H2).build()
        javers = javers().registerJaversRepository(sqlRepository).build()
@igler

This comment has been minimized.

igler commented Feb 20, 2015

Is it possible to use Hibernate Envers in combination with JaVers? Envers can track changes though annotating the classes with

@Audited(withModifiedFlag = true)

The idea is to pull the changes from the _AUD tables? In combination with spring-data-envers (https://github.com/spring-projects/spring-data-envers) you could get the change-revisions and the you hook on JaVers implementation calculating the difference?

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 20, 2015

@igler so envers cant calculate diffs on its own?

@igler

This comment has been minimized.

igler commented Feb 20, 2015

Unfortunately not. You only get a list of revisions by spring-data-envers. So you have to find out the deltas on your own. The idea was if I can submit a list of revisions to JaVers and get a nice JSON-history back?

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 20, 2015

@igler maybe we move this new envers thread to a new issue, titled 'javers envers integration'?

Your idea sounds good, we can think about read-only JaversRepository implementation (see https://github.com/javers/javers/blob/033fe77817052e4ec71b9014f676c5bfa478cbc8/javers-core/src/main/java/org/javers/repository/api/JaversRepository.java), which would read object snapshots from envers tables.
Are you eager to contribute to development of this new feature?

@igler

This comment has been minimized.

igler commented Feb 21, 2015

OK, moved the discussion to #112.

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 28, 2015

@efreet007, @igler, JaversSqlRepository is done and released as 1.1.0-RC1.
It would be nice if you test it and give us some feedback before final 1.1.0 release

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Mar 14, 2015

released in v. 1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment