How to implement elasticsearch in a spring project? - mysql

I have a spring project configured to use MySql database. Is is possible to implement elasticsearch for some search queries? Does anyone has a relevant experience or can point me to a good article?

You can easily use Spring Data for Elasticsearch without having much Elasticsearch knowledge. Take a look at the toy project here.
Spring Data will help you on doing CRUD operations with an ORM approach.

Related

It's possible to integrate reactive Spring Data with mysql?

In the past, I integrated reactive spring data with mongoDb and everything gone fine.
Now I want the same non blocking access using mysql, but i didnt find any article about it.
I wish to use a mature and standard spring library, if you know one, please share it to me.
What you are looking for is R2DBC and Spring Data R2DBC.
R2DBC is a reactive alternative to JDBC.
And Spring Data R2DBC is a Spring Data module for it.
Since R2DBC is only a specification/API you also need a driver for the database of your choice. For MySql that would be https://github.com/jasync-sql/jasync-sql

I am getting error with native query when I shift from mysql to mongodb [duplicate]

After seeing this image:
http://2.bp.blogspot.com/_T-uXeKcGTnM/TIdoKBGwk9I/AAAAAAAABcs/CLW3_cRlN78/s1600/tumblr_kxovt0VLZy1qappj8.png
I wonder is exists any tool for translating SQL querys into MongoDB map/reduce query model??
Larger version of the image: http://rickosborne.org/download/SQL-to-MongoDB.pdf
Update to the question asked in Jan 2011:
A couple of sites exist now to convert sql to mongodb.
Convert MySQL Queries to MongoDB Syntax
http://www.querymongo.com/
And
Convert sql to mongodb
http://klaus.dk/sqltomongodb/
The simple anwser? No.
The slightly more complex anwser is some people have had luck translating more complex SQL to Mapreduce functions ...
http://rickosborne.org/blog/index.php/2010/02/08/playing-around-with-mongodb-and-mapreduce-functions/
http://rickosborne.org/blog/index.php/2010/02/19/yes-virginia-thats-automated-sql-to-mongodb-mapreduce/
However, that said ... generally speaking you might as well learn mapreduce properly because if the data is in MongoDB already ... you'll really need to know how to properly query MongoDB to get anything meaningful done!
MongoDB has wonderful and helpful docs http://www.mongodb.org/display/DOCS/Advanced+Queries
As well as an easy to use online tutorial: http://try.mongodb.org/
The simple answer: Yes. Hibernate OGM - JPA for NoSQL.
JPA is Java API for mapping objects to data stores.
It includes JPQL, a query language similar to SQL which adds the OOP concepts. It's not SQL, but you don't want pure SQL - that was designed for the relational paradigm.
Hibernate OGM proposes to simplify the programming model by embracing JPA/Hibernate APIs and semantics to store data in NoSQL stores like JBoss Enterprise Data Grid instead of the traditional RDBMS. (source)
Also see this Hibernate OGM: JPA for NoSQL talk by Hardy Ferentschik
Recently I happened to see this website mongoquery.com, you can try it.
You can use free sql to mongodb converter like: https://rapidapi.com/ariefsam/api/easy-sql-to-mongodb-aggregation/
Just to add to the last comment
re:The simple answer: Yes. Hibernate OGM - JPA for NoSQL.
JPA is Java API for mapping objects to data stores.
It includes JPQL, a query language similar to SQL which adds the OOP concepts. It's not SQL, but you don't want pure SQL - that was designed for the relational paradigm.
There is a company called UnityJDBC that has released a JDBC driver for Mongo that allows you to run SQL queries against mongo in any java application that supports JDBC.
you can download this driver free at
http://www.unityjdbc.com/mongojdbc/mongo_jdbc.php
hope this helps
You can also http://teiid.org which gives full range of SQL based access to MongoDB. You can use SQL through JDBC/ODBC or use REST/ODATA based access to MongoDB. Teiid uses MongoDB's aggregation framework to provide advanced SQL MongoDB query conversation.

Lucene/MySQL Integration - Play Framework (Scala)

Has anyone tried to integrate Lucene and MySQL with Play Framework through Scala?
The challenge i am finding is how to keep the lucene index in synch with the DB. This is possible using Hibernate Search, but that's not possible/advised when using Play-Scala.
Any guidance/advice is highly appreciated.
Thanks

mysql framework for node.js

Is there any mysql framework for node.js?
I found only https://github.com/felixge/node-mysql but this only allows executing "raw" mysql statements. I am looking for some tool which will provide easier way of manipulating mysql database and data.
Especially I need pagination and joining mechanisms...
I am not looking for a full framework because I am using restify to build RESTapi - just need a module to retrieve/save data to mysql db. So I need only "model" part of MVC ;).
It sounds like you may be looking for an ORM. If that's the case, you can take a look at Sequelize. It will let you define your objects, and then simply 'save' and 'fetch' them, without really having to worry about how its doing it.
You can look at db-mysql module. This module provides api for creating queries. Here is module GitHub page.

Web application using Hibernate+MySql

i was asked to do a book manager at university with hibernate and mysql. I have a simple question. If i choose to do a web application, grails already uses hibernate. GORM runns over hibernate. so to use mysql i only need to configure jdbc grails drivers and that's it?
i mean, "for the project you must use hibernate and mysql" - this are the requirements. So can i do that way?
thanks in advance,
JM
Yes, of course you can.
You'll need to get the MySQL JDBC driver from this location.
Grails? When you're new to programming? Whose idea was this?
Personally, I think that taking on all these unknowns is risky for someone who's "new to programming." Do you know anything about SQL or JDBC? Have you ever written a web project before? This could be difficult.
I don't know how to be more specific. Download the JDBC JAR from the link I gave you.
I'd recommend that you start with a JDBC tutorial first. Hibernate is not for you - yet.
Hibernate is an object-relational mapping tool (ORM). It's a technology that lets you associate information in relational database tables to objects in your middle tier. So if you have a PERSON table with columns id, first, and last Hibernate will let you associate those data with the private data members in your Person Java class.
That sounds easy, but it gets complicated quickly. Your relational and object models might have one-to-many and many-to-many relationships; Hibernate can help with those. Lazy loading, caching, etc. can be managed by Hibernate.
But it comes at a cost. And it can be difficult if you aren't familiar with it.
If you have a deadline, I'd recommend creating a Java POJO interface for your persistence classes and doing the first implementation using JDBC. If you want to swap it out for Hibernate later on you can do it without affecting clients, but you'll have a chance of making progress without Hibernate that way.