Skip to content
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
Closed

Sql repository #67

pszymczyk opened this issue Dec 5, 2014 · 20 comments

Comments

@pszymczyk
Copy link
Contributor

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

pszymczyk pushed a commit that referenced this issue Jan 19, 2015
pszymczyk pushed a commit that referenced this issue Jan 19, 2015
pszymczyk pushed a commit that referenced this issue Jan 20, 2015
pszymczyk added a commit that referenced this issue Jan 20, 2015
pszymczyk pushed a commit that referenced this issue Jan 21, 2015
pszymczyk pushed a commit that referenced this issue Jan 21, 2015
pszymczyk pushed a commit that referenced this issue Jan 21, 2015
pszymczyk pushed a commit that referenced this issue Jan 22, 2015
@bartoszwalacik
Copy link
Member

what about read ? :)

@pszymczyk
Copy link
Contributor Author

Still some problems with H2 in mem

@pszymczyk
Copy link
Contributor Author

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
Copy link
Contributor Author

btw MAX works fine, it was my mistake ;)

@bartoszwalacik
Copy link
Member

  • 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 pushed a commit that referenced this issue Feb 3, 2015
pszymczyk pushed a commit that referenced this issue Feb 4, 2015
pszymczyk pushed a commit that referenced this issue Feb 10, 2015
pszymczyk pushed a commit that referenced this issue Feb 10, 2015
pszymczyk pushed a commit that referenced this issue Feb 10, 2015
@efreet007
Copy link

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

@pszymczyk
Copy link
Contributor Author

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
Copy link
Member

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 pushed a commit that referenced this issue Feb 10, 2015
pszymczyk pushed a commit that referenced this issue Feb 10, 2015
pszymczyk pushed a commit that referenced this issue Feb 10, 2015
pszymczyk pushed a commit that referenced this issue Feb 10, 2015
@bartoszwalacik
Copy link
Member

efreet007 please put new issue for MS SQL support

pszymczyk pushed a commit that referenced this issue Feb 10, 2015
pszymczyk pushed a commit that referenced this issue Feb 10, 2015
@efreet007
Copy link

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

@bartoszwalacik
Copy link
Member

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

pszymczyk pushed a commit that referenced this issue Feb 11, 2015
pszymczyk pushed a commit that referenced this issue Feb 11, 2015
pszymczyk pushed a commit that referenced this issue Feb 11, 2015
pszymczyk pushed a commit that referenced this issue Feb 11, 2015
bartoszwalacik added a commit that referenced this issue Feb 11, 2015
@bartoszwalacik
Copy link
Member

@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
Copy link
Member

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
Copy link

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
Copy link
Member

@igler so envers cant calculate diffs on its own?

@igler
Copy link

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
Copy link
Member

@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
Copy link

igler commented Feb 21, 2015

OK, moved the discussion to #112.

@bartoszwalacik
Copy link
Member

@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
Copy link
Member

released in v. 1.1.0

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

No branches or pull requests

4 participants