为啥 JpaRepository.findAll() 方法从我的 Oracle 数据库中获取错误的数据?

Posted

技术标签:

【中文标题】为啥 JpaRepository.findAll() 方法从我的 Oracle 数据库中获取错误的数据?【英文标题】:Why is the JpaRepository.findAll() method fetching the wrong data from my Oracle database?为什么 JpaRepository.findAll() 方法从我的 Oracle 数据库中获取错误的数据? 【发布时间】:2019-09-15 16:49:12 【问题描述】:

我的 Spring Boot 应用程序从我的 Oracle 数据库中获取了错误的数据,例如它检索了正确数量的行但内容不正确(数据丢失,其他行 [propably] 重复)。

我是 Spring Boot 和 Oracle 数据库的新手。我阅读了很多教程并编写了代码。现在我尝试创建我的第一个 Web 服务原型,该原型从 Oracle 12c 数据库中获取数据并通过 HTTP 端点访问它们。

我使用 SQL Developer 检查我想要显示的表格的内容,然后在我的 Spring Boot 应用程序中显示不同的内容。 我使用 Spring Boot 2.1.4。

我要显示的表格包含有关日常运行的 cronjobs 的信息。

这是控制器

import de.dat.verguetung.entity.DailyJobsEntity;
import de.dat.verguetung.service.DailyJobsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@CrossOrigin(origins = "http://localhost:4200")
@RestController
@RequestMapping("/dailyjobs")
public class DailyJobsController 
    @Autowired
    DailyJobsService dailyJobsService;

    @CrossOrigin(origins = "*")
    @RequestMapping(value = "/all", method = RequestMethod.GET)
    public List<DailyJobsEntity> getAllDailyJobs() 
        return dailyJobsService.getAllDailyJobs();
    

这是我的存储库界面

import de.prototype.entity.DailyJobsEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface DailyJobsRepository extends JpaRepository<DailyJobsEntity, Integer> 


这是我的模型

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "LOG_DAILY_JOBS")
public class DailyJobsEntity 

    @Id
    @Column(name = "JOB_TITLE", nullable = false, length = 100)
    private String jobTitle;

    @Column(name = "OK", nullable = false, length = 10)
    private Integer ok;

    @Column(name = "JOB_RESULT", nullable = true, length = 1000)
    private String jobResult;

    @Column(name = "EXECUTION_DATE", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date executionDate;


    protected DailyJobsEntity() 

    public DailyJobsEntity(String jobTitle, Integer ok, String jobResult, Date executionDate) 
        this.jobTitle = jobTitle;
        this.ok = ok;
        this.jobResult = jobResult;
        this.executionDate = executionDate;
    

    public Date getExecutionDate() return executionDate;

    public void setExecutionDate(Date executionDate) this.executionDate = executionDate;

    public String getJobResult() return jobResult;

    public void setJobResult(String jobResult) this.jobResult = jobResult;

    public Integer getOk() return ok;

    public void setOk(Integer ok) this.ok = ok;

    public String getJobTitle() return jobTitle;

    public void setJobTitle(String jobTitle) this.jobTitle = jobTitle;

这是我的服务

import de.dat.verguetung.dao.DailyJobsRepository;
import de.dat.verguetung.entity.DailyJobsEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DailyJobsService 
    @Autowired
    DailyJobsRepository dailyJobsRepository;

    public List<DailyJobsEntity> getAllDailyJobs()
        return this.dailyJobsRepository.findAll();
    

这是我的主课

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class VerguetungApplication 

    public static void main(String[] args) 
        SpringApplication.run(VerguetungApplication.class, args);
    

该表有 156 行。该应用程序获取 156 行。没关系。 但是这些行中有 95% 都填充了错误的内容。 我有一个名为“EXECUTION_DATE”的列。 此列的条目范围从 2019-04-02 到 2019-04-16。 该应用程序显示执行日期为 2019-04-02 的每一行。

如果需要,我可以提供有关表格内容的更多详细信息。

我希望有人可以帮助我并指出我的错误。 在此先感谢:)

编辑: 这是表格中的内容:

58  1   58  02.04.19
58  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   58  02.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  0   ORA-01403: Keine Daten gefunden 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  0   ORA-01403: Keine Daten gefunden 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   146 03.04.19
get_vsu_movement_count  1   85  04.04.19
get_vsu_movement_count  1   76  05.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   23  15.04.19
get_vsu_movement_count  1   96  16.04.19
get_vsu_movement_count  1   96  16.04.19
get_vsu_movement_count  1   96  16.04.19
get_vsu_movement_count  1   96  16.04.19
get_vsu_movement_count  1   96  16.04.19
get_vsu_movement_count  1   96  16.04.19
get_vsu_movement_count  1   96  16.04.19
get_vsu_movement_count  1   96  16.04.19

这是应用程序显示的内容

get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
58 | 1 | 58 | 2019-04-02
58 | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02
get_vsu_movement_count | 1 | 58 | 2019-04-02

编辑 2 打印获取的行的代码

@CrossOrigin(origins = "http://localhost:4200")
@RestController
@RequestMapping("/dailyjobs")
public class DailyJobsController 
    @Autowired
    DailyJobsService dailyJobsService;

    @CrossOrigin(origins = "*")
    @RequestMapping(value = "/all", method = RequestMethod.GET)
    public List<DailyJobsEntity> getAllDailyJobs() 
        List<DailyJobsEntity> dJobs = dailyJobsService.getAllDailyJobs();

        dJobs.stream().forEach(job -> 
            System.out.println(job.getJobTitle() + " | " + job.getOk() + " | " + job.getJobResult() + " | " + job.getExecutionDate());
        );
        System.out.println(dJobs.size());
        return dJobs;
    

【问题讨论】:

我的猜测是错误在于您在应用程序中显示值的方式。 curl http://localhost:8080/dailyjobs/all 的输出是什么?或者当您在控制器服务中打印每个日期时会发生什么? 不正确的数据是否仅适用于 EXECUTION_DATE 或其他列/行? @JBNizet 如果我在控制器中打印每个获取的行,我添加了输出。 @Abhijeet 每列显示不正确的数据 那么您的应用程序和 SQL 工具中可能没有使用相同的数据库/模式/表。或者您在 SQL 工具中进行了修改,但尚未提交。或者您没有正确打印所有内容(您还没有发布代码) 【参考方案1】:

如果我没记错的话,您的 DailyJobsRepository 使用 DailyJobsRepository extends JpaRepository&lt;DailyJobsEntity, Integer&gt; 表示主键 ID 的类型为 Integer,而您的实体 DailyJobsEntity 将 ID 定义为 String 类型:

@Id
@Column(name = "JOB_TITLE", nullable = false, length = 100)
private String jobTitle;`

jobTitle 是实体的主键吗?因为我希望 PK 是整数类型。

【讨论】:

我将 DailyJobsRepository 更改为 DailyJobsRepository extends JpaRepository&lt;DailyJobsEntity, String&gt; 这并没有改变输出。该表没有主键(我没有创建此表,我的工作是显示它)。这会是个问题吗? 将 ID 类型设置为 String 并不重要,因为表转储中使用的字符串键不是唯一的。这篇文章或许能进一步帮助你:***.com/questions/29561885/… 好的,我阅读了帖子并阅读了一些后续信息。解决我的问题的一种方法是使用“所有列作为 id”。这是否意味着我必须用 @Id 注释实体类中的每个字段?

以上是关于为啥 JpaRepository.findAll() 方法从我的 Oracle 数据库中获取错误的数据?的主要内容,如果未能解决你的问题,请参考以下文章

你应该同步运行方法吗?为啥或者为啥不?

为啥使用 glTranslatef?为啥不直接更改渲染坐标?

为啥 DataGridView 上的 DoubleBuffered 属性默认为 false,为啥它受到保护?

为啥需要softmax函数?为啥不简单归一化?

为啥 g++ 需要 libstdc++.a?为啥不是默认值?

为啥或为啥不在 C++ 中使用 memset? [关闭]