hi I am trying to update and delete the data in my application in spring boot and I came to know that postgresql is quite different from normal SQL can you provide the correct syntax for the update and delete operations in postgresql for spring boot application please I couldn't find it in internet.
If you use Spring Boot you actually could use Spring Data for creating queries and you'll not need to write queries by yourself.
Related
I am having a need where in a same spring boot application I need to use repo of Spring Data Mongo and Spring data jpa (postgres), during my initial testing I got runtime errors. While I debug more just wanted to check in same Spring Data Application can it have both repos for Postgres and MongoDB ?
Yes, you can have, make sure to add all dependency and create separate repositories for each data connection. I used MongoDB and MySql database it is working fine.
is there a way to access Amazon QLDB as a repository in spring boot applications like MongoDB?
There isn't a library yet that integrates QLDB with spring boot.
I started to look at building exactly what you suggest, I even contacted the lead of spring data to look at adding this (I haven’t raised the ticket yet), however the CrudRepository interface provided enough integration for the demo applications that we have built with Spring Boot. One of the issues that i had when trying to create the Repository was the mapping of fields from the java objects into the partiql fields without explicit knowledge of what was changing.
QLDB does not have a jdbc driver anymore so it is now a proprietary driver which also uses partiql over sql, there could be some further issues getting this to work as a full blown repository in spring boot due to the inner reliance on sql in spring data .
I started with Teiid Spring Boot simple example from the following url:
https://github.com/teiid/teiid-spring-boot/blob/master/docs/UserGuide.adoc
It uses two different data source to demonstrate Teiid Spring Boot's capability to interact and fetch data from multiple data sources. However, when I deployed my Teiid Spring Boot component it threw exceptions related to entityManagerFactory.
One of the sites that I came across related to Spring Boot says that in order to define and use multiple data sources I need to assign one as Primary and others as Secondary Data Source, as provide on this page:
https://springframework.guru/how-to-configure-multiple-data-sources-in-a-spring-boot-application/
Can someone please confirm if my understanding is correct? If i am required to define Primary and Secondary Data Source?
I am using Spring Boot 2.2.4 and Teiid 1.3.0
Thank you!
Purnima Das
Have you seen this working example here with a single database? https://github.com/teiid/teiid-spring-boot/tree/master/samples/rdbms Teiid 1.3.0 This can be easily extended to have two databases. It only works with Spring Boot 2.1.6.RELEASE right now. No need to define the primary and secondary with this framework. Follow the example.
I'm trying to replace some projects to use Spring Data JDBC
instead of using JdbcTemplate.
Now, I'd like to use it for multiple DataSources, how can I configure it in Spring Data JDBC?
There is currently no support for working with two or more DataSources. You'd have to manually redo what the JdbcRepositoryFactoryBean does.
I would like to use Flyway as preferred way of database migration handling in my Spring Boot project (using current V1.2.1.RELEASE).
This is working fine so far however the integration with Spring Security using a JDBC DataSource seems to override the Flyway mechanism.
Following simple scenario:
Spring Boot 1.2.1
PostgreSQL 9.4.1
Flyway migration scripts for users, groups and authorities according to Spring Security documentation
Problem:
The Flyway migration scripts are not executed at startup as expected.
Maybe cause: It seems that Flyway is only executed at startup if the using Spring Boot project is also using JPA at least. Since Spring Security is based on plain JDBC, I've tried to temporary use the JDBC based database initialization scheme as described in Spring Boot docs (Chapter 68.3) which works, but (as documented) this way is like the 'poor man approach' and I'd really like to use Flyway also for these tables containing the User/Group/Authorities information.
Ok, after some further investigation I've found the problem:
Indeed, in a standard Spring Boot project the security context is initialized before any Flyway based migration takes place.
Normally this is not a big issue, but I've also used the AuthenticationManagerBuilder for creating a default admin user. This seems to be the wrong approach for creating such an initial user account.