#I have a problem with this error and I don't understand what is this.

30 messages · Page 1 of 1 (latest)

kindred dagger
#

Hibernate: select t1_0.id,t1_0.amount,t1_0.category_id,t1_0.date,t1_0.description,t1_0.created_at,t1_0.type from transactions t1_0 where t1_0.id=?
2026-05-06T15:32:16.210+07:00 WARN 29612 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [com.example.newfinancetracker.Exception.RecordNotFound: Id Not Found 2]

I tried to test my controller in Postman but it's always resulted in 404. I have the data and there's no issue with the controller or the url

devout heraldBOT
#

This post has been reserved for your question.

Hey @kindred dagger! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 720 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

median sleet
#

show repository / entity code, show factual db layout

kindred dagger
# median sleet show repository / entity code, show factual db layout

package com.example.newfinancetracker.Transaction;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.math.BigDecimal;
import java.time.LocalDate;

public interface TransactionRepository extends JpaRepository<Transaction, Long> {

Page<Transaction> findByType(TransactionType type, Pageable pageable);
Page<Transaction> findByCategoryId(Long categoryId, Pageable pageable);

@Query("SELECT t FROM Transaction t WHERE t.type = :type AND t.date BETWEEN :startDate" +
        " AND :endDate")
Page<Transaction> findByDateBetween(
        @Param("type")TransactionType type,
        @Param("startDate")LocalDate startDate,
        @Param("endDate")LocalDate endDate,
        Pageable pageable);

@Query("SELECT SUM(t.amount) FROM Transaction t WHERE t.type = :type " +
        "AND YEAR(t.date) = :year AND MONTH(t.date) = :month")
BigDecimal monthlySummary(
        @Param("type")TransactionType type,
        @Param("year")int year,
        @Param("month")int month
);

}

devout heraldBOT
kindred dagger
#

this is my repo

#

INSERT INTO transactions
(id, amount, description, type, date, created_at, category_id)
VALUES
(1,13363900,'Monthly salary','INCOME','2026-04-21','2026-04-21 20:25:12',8),
(2,57098,'Grocery Alfamart','EXPENSE','2026-04-17','2026-03-29 20:25:12',1),
(3,38434,'Supermarket','EXPENSE','2026-03-29','2026-03-24 20:25:12',1),
(4,96482,'Lunch at warung Padang','EXPENSE','2026-04-03','2026-04-08 20:25:12',1),
(5,30622,'Grab ride to office','EXPENSE','2026-04-15','2026-04-14 20:25:12',2),
(6,279951,'GoJek trip','EXPENSE','2026-04-21','2026-04-04 20:25:12',2),
(7,185363,'YouTube premium','EXPENSE','2026-04-08','2026-04-14 20:25:12',3),

#

this is the db

kindred dagger
honest archBOT
#

package com.example.newfinancetracker.Transaction;

import com.example.newfinancetracker.Category.Category;
import jakarta.persistence.*;
import jakarta.validation.constraints.Positive;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Entity
@Data
@Table(name = "transactions") ```java

public class Transaction {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Positive
private BigDecimal amount;

private String description;

@Enumerated(EnumType.STRING)
private TransactionType type;

private LocalDate date;

@Column(name = "created_at")
private LocalDateTime timeStamp;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id")
private Category category;

} ```

This message has been formatted automatically. You can disable this using /preferences.

kindred dagger
median sleet
#

looks ok at glance

median sleet
#

and more pointedly, are you sure you've done commit afterwards

kindred dagger
median sleet
kindred dagger
median sleet
kindred dagger
kindred dagger
#

I have the entities but no data

median sleet
#

imo just run the insert from db client or alternatively complete rest api for saving data, and test once you have full crud in place

kindred dagger
devout heraldBOT
kindred dagger
#

@median sleet Thank you for your help it is fixed. The issue here my data.sql is actually in src/main/resources/db/data.sql by default spring boot only look for the data.sql inside resources folder so i need to move it to resources and and add the spring.sql.init.mode=always

devout heraldBOT