SQL Support in OGM


As I m new to hibernate. So sorry for the stupid question.

Can we use SQL database with hibernate OGM bei just changing the configuration or I need to change the complete code.

Thanks in advance

In theory yes, in practice, it depends what features you are using.

If you are using Hibernate OGM and want to switch to Hibernate ORM, yes, it should work unless you are using native queries.

If you want to switch from ORM to OGM, it will work if you are not using any of the unsupported features. In particular the support for HQL/JPQL has some limitations: https://docs.jboss.org/hibernate/stable/ogm/reference/en-US/html_single/#ogm-neo4j-queries

i have to perform the crud opereations and doing this with transactions in NoSQL(Mongodb). can i just change the database credentials and the connections path in persistance.xml?

Hibernate OGM does not support ACID transactions with MongoDB.
Changing the configuration in the persistence.xml is enough to make the application use MongoDB instead of the other SQL db but don’t expect to be able to rollback if you need to.
This is explained in this section of the documentation: https://docs.jboss.org/hibernate/stable/ogm/reference/en-US/html_single/#_transactions