Skip to content

Commit

Permalink
Transaction API fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonali Shakya authored and Sonali Shakya committed Jan 13, 2025
1 parent ee79981 commit 3b5cb35
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ public void deletePayload(@PathVariable Long id) {
service.deletePayload(id);
}

@GetMapping("/{transactionId}")
public Payload getPayloadFromTransactionId(@PathVariable String transactionId) {
Optional<Payload> payload = service.getPayloadByTransactionId(transactionId);
return payload.orElse(null);
@GetMapping("/transaction/{transactionId}")
public List<Payload> getPayloadFromTransactionId(@PathVariable String transactionId) {
return service.getPayloadByTransactionId(transactionId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Payload {
private Timestamp createdAt;
private Timestamp updatedAt;

@ManyToOne(fetch = FetchType.LAZY)
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "session_id", referencedColumnName = "sessionId")
@JsonIgnoreProperties({"payloads", "npType", "npId", "domain", "version", "sessionType", "sessionActive"})
private SessionDetails sessionDetails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Repository
public interface PayloadRepository extends JpaRepository<Payload, Long> {

Optional<Payload> findByTransactionId(String transactionId);
List<Payload> findByTransactionId(String transactionId);
List<Payload> findBySessionDetailsSessionId(String sessionId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public Payload getPayloadById(Long id) {
return repository.findById(id).orElse(null);
}

public Optional<Payload> getPayloadByTransactionId(String transactionId) {
@Transactional
public List<Payload> getPayloadByTransactionId(String transactionId) {
Log.info("transactionId - {}", transactionId);
return repository.findByTransactionId(transactionId);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
spring.application.name=yugabyte-integration
spring.datasource.url=${DB_URL}
#spring.datasource.url=jdbc:postgresql://127.0.0.1:5433/my_app
#spring.datasource.url=${DB_URL}
spring.datasource.url=jdbc:postgresql://127.0.0.1:5433/my_app
spring.datasource.username=yugabyte
#spring.datasource.password=
spring.datasource.password=${DB_PASSWORD}
#spring.datasource.password=${DB_PASSWORD}
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
Expand Down
6 changes: 3 additions & 3 deletions yugabyte-integration/target/classes/application.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
spring.application.name=yugabyte-integration
spring.datasource.url=${DB_URL}
#spring.datasource.url=jdbc:postgresql://127.0.0.1:5433/my_app
#spring.datasource.url=${DB_URL}
spring.datasource.url=jdbc:postgresql://127.0.0.1:5433/my_app
spring.datasource.username=yugabyte
#spring.datasource.password=
spring.datasource.password=${DB_PASSWORD}
#spring.datasource.password=${DB_PASSWORD}
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 3b5cb35

Please sign in to comment.