Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:

Home Page:http://groups.google.com/group/kundera-discuss/subscribe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convert Sql query to Mongo db json query

devanshusharma19 opened this issue · comments

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

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

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