skip to Main Content

Placeholder in PostgreSQL query with double colon :: cast

I have this SQL query: select date_trunc('month',created_at-'6d 18:06:56'::interval) +'6d 18:06:56'::interval as created_at, count(*)filter(where status='ACTIVE') as active, count(*)filter(where status='BLOCKED') as blocked from companies where now()-'12 months'::interval < created_at group by 1 order by 1; I tried to use it into Spring…

VIEW QUESTION

How to change for Postgresql the string value for json in jpa repository @Query using springboot

Maven pom dependency: <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>runtime</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.json/json --> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20230227</version> </dependency> Configuration Dialect: spring: jpa: properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect show-sql: 'true' hibernate: ddl-auto: update I have the following Entity: @Entity @Data @Getter @AllArgsConstructor @NoArgsConstructor @Builder…

VIEW QUESTION

Table is not creating in MySQL server from Spring JPA

I have written the code. It goes like - Here is my GitHub Repo - https://github.com/SuvamNaskar/spring-learn.git spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:2023/student?createDatabaseIfNotExist=true&useSSL=false spring.datasource.username=root spring.datasource.password=system32 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.data.jpa.repositories.enabled=true spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true spring.thymeleaf.check-template-location=false spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.defer-datasource-initialization= true spring.jpa.open-in-view=false logging.level.org.hibernate.SQL=DEBUG logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl This is my application.properties file. I have tried…

VIEW QUESTION

Postgresql – DATA/JPA Entity with String key – but replace data when try to save object with same key

I have this Entity class with nickname String as a key. @Data @Entity @Table(name="players") public class Player { @Id private String nickname; @Column(name="name") private String name; @Column(name="surname") private String surname; ... ... ... } Controller @PostMapping(value="/addPlayer", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces…

VIEW QUESTION
Back To Top
Search