-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
56 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
src/main/java/com/testcontainers/catalog/domain/internal/ProductRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
package com.testcontainers.catalog.domain.internal; | ||
|
||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import com.azure.spring.data.cosmos.repository.CosmosRepository; | ||
interface ProductRepository extends JpaRepository<ProductEntity, Long> { | ||
Optional<ProductEntity> findByCode(String code); | ||
|
||
public interface ProductRepository extends CosmosRepository<ProductEntity, String> { | ||
@Modifying | ||
@Query("update ProductEntity p set p.image = :image where p.code = :code") | ||
void updateProductImage(@Param("code") String code, @Param("image") String image); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
create table products | ||
( | ||
id bigserial primary key, | ||
code varchar not null unique, | ||
name varchar not null, | ||
description varchar, | ||
image varchar, | ||
price numeric not null | ||
); | ||
|
||
insert into products(code, name, description, image, price) values | ||
('P101','Product P101','Product P101 description', null, 34.0), | ||
('P102','Product P102','Product P102 description', null, 25.0), | ||
('P103','Product P103','Product P103 description', null, 15.0) | ||
; |