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

JaversException SQL_EXCEPTION: ORA-00920: invalid relational operator #801

Closed
dkrogulec opened this issue Mar 11, 2019 · 8 comments
Closed

JaversException SQL_EXCEPTION: ORA-00920: invalid relational operator #801

dkrogulec opened this issue Mar 11, 2019 · 8 comments

Comments

@dkrogulec
Copy link

@dkrogulec dkrogulec commented Mar 11, 2019

Following to this stackoverflow topic I have the same isse when try to use JaVers with SpringBoot v2.0.1.RELEASE and Oracle XE 11g.

It'll be very nice if somebody can fix this.

Thanks!

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Mar 11, 2019

This is duplicate to #796

Here are the facts:

  • The fix is not hard do code, but
  • Oracle is a paid and closed database, there is no easy way for me to test the fix on a real database server. I have spent some time yesterday trying to install Oracle Database on my Mac, but I failed. I'm not going to install VirtualBox + Vagrant + Docker and then download and configure almost 3GB of fully blown distribution of Oracle 11g. It's too complicated.

If you, Oracle guys, have some hints for me, how to write integration test for Javers running on Oracle, please share.

Otherwise, since only you have access to the holly Oracle, please contrubute a PR. I will merge.

@Pinellus
Copy link

@Pinellus Pinellus commented Mar 12, 2019

Hi Bart,
considering that the problem is essentially of non-standard SQL code, and considering that the problem is also present on MS SQL Server, if it is easier you might think of downloading the Docker instance of SQL Server (much lighter than Oracle).
You can find references here:

https://database.guide/how-to-install-sql-server-on-a-mac/

In the meantime I've bypassed the problem using the shadow feature that does not present problems of SQL code.

javers.findShadows(QueryBuilder.byInstance(object).limit(1).build())

bartoszwalacik added a commit that referenced this issue Mar 12, 2019
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Mar 12, 2019

@Pinellus , thanks for the hint with MS SQL Server, I will try it.
I have removed this obsolete clause ( false ). I will release the fix and than, you guys could give me feedback.

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Mar 12, 2019

fix is released
5.2.6
https://search.maven.org/search?q=javers-core
check it out

@dkrogulec
Copy link
Author

@dkrogulec dkrogulec commented Mar 13, 2019

@bartoszwalacik tested with Oracle XE 11g, everything is OK now.

Thanks for this really quick fix 🥇

@IlyaNerd
Copy link
Contributor

@IlyaNerd IlyaNerd commented May 16, 2019

@bartoszwalacik hey. having the same problem for this kind in oracle of query in 5.4.0:
javers.findChanges(QueryBuilder.byClass(class) .withSnapshotType(SnapshotType.UPDATE) .withNewObjectChanges() .build());
result query looks like this:
SELECT a.*, rownum FROM ( SELECT state, type, version, changed_properties, managed_type, commit_pk, author, commit_date, commit_date_instant, commit_id, g.local_id, g.fragment, g.owner_id_fk, o.local_id owner_local_id, o.fragment owner_fragment, o.type_name owner_type_name FROM INFR.jv_snapshot INNER JOIN INFR.jv_commit ON commit_pk = commit_fk INNER JOIN INFR.jv_global_id g ON g.global_id_pk = global_id_fk LEFT OUTER JOIN INFR.jv_global_id o ON o.global_id_pk = g.owner_id_fk WHERE 1 = 1 and ( (global_id_fk = ? AND version = ?) OR (global_id_fk = ? AND version = ?) OR (global_id_fk = ? AND version = ?) OR (global_id_fk = ? AND version = ?) OR (global_id_fk = ? AND version = ?) OR (global_id_fk = ? AND version = ?) OR false) ORDER BY snapshot_pk DESC ) a WHERE rownum <= ?

mb replace false with 1 != 1, which should work in all dbs.
example above with shadows works fine

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented May 16, 2019

Guys, I don't have access to Oracle database, so I can't test javers' code against it. I don't know the easy way how install it on my machine. So if you found a bug, contribute a PR with a fix, I will merge it.

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

Successfully merging a pull request may close this issue.

None yet
4 participants