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

Convert Sql query to Mongo db json query #1018

Open
devanshusharma19 opened this issue Jun 19, 2018 · 2 comments
Open

Convert Sql query to Mongo db json query #1018

devanshusharma19 opened this issue Jun 19, 2018 · 2 comments

Comments

@devanshusharma19
Copy link

devanshusharma19 commented Jun 19, 2018

Hi
I need to convert sql query to mongo query. It is possible using Kundera jar. Please tell me...
Example :- Select Name,Class,Marks from Student where Class = 10 and Marks > 74 Order by Name.
Or many complex query will happen. can you tell me how to convert in mongo query using java

@devender-yadav
Copy link
Contributor

Hi @devanshusharma19,

Kundera does convert JPA query to MongoDB query but doesn't expose it to the user as Kundera's motive is to abstract database specific details.

You can modify the code as per you need. For MongoDB query specific part, check - https://github.com/Impetus/Kundera/blob/trunk/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java#L442

@devender-yadav
Copy link
Contributor

Additionally, You need to use JPA query not SQL query.

This sample query will work -

Select s.name, s.class, s.marks from Student s where s.class = 10 and s.marks > 74 Order by s.name

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

2 participants