Skip to content

HQL parser rejects INSERT … ON CONFLICT clause #3689

Closed
@jdupont22

Description

@jdupont22

Migrating from Spring Boot 3.3.5 to 3.4 lead to this error

The error

Caused by: org.springframework.data.jpa.repository.query.BadJpqlGrammarException: Line 4:8 mismatched input 'ON' expecting {, ','}; Bad JPQL grammar [
INSERT INTO AggregationPrice(range, price, type)
VALUES (:range, :price, :priceType)
ON CONFLICT (range) DO UPDATE
SET price = :price, type = :priceType
]

The code

@Modifying
@Query(
  """
    INSERT INTO AggregationPrice(range, price, type) 
    VALUES (:range, :price, :priceType) 
    ON CONFLICT (range) DO UPDATE 
    SET price = :price, type = :priceType 
  """
)
fun save(range: Range<LocalDateTime>, price: Double, priceType: AggregationPriceType)

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions