Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 不带联接关系的Spring数据jpa find()_Java_Mysql_Spring_Spring Data Jpa - Fatal编程技术网

Java 不带联接关系的Spring数据jpa find()

Java 不带联接关系的Spring数据jpa find(),java,mysql,spring,spring-data-jpa,Java,Mysql,Spring,Spring Data Jpa,我写了下面的查询,在“设备”和“帐户”之间有一个m:n关系,但是对于本机查询,它仍然返回带有内部联接的结果 public interface DeviceRepository extends JpaRepository<Device, Long> { @Query(value = "select device.* from device #pageable", countQuery = "select count(*) from dev

我写了下面的查询,在“设备”和“帐户”之间有一个m:n关系,但是对于本机查询,它仍然返回带有内部联接的结果

public interface DeviceRepository extends JpaRepository<Device, Long> {
        @Query(value = "select device.* from device #pageable",
                countQuery = "select count(*) from device",
                nativeQuery = true)
        Page<Device> findByNative(Pageable peagble);
}

实际上,我需要这个,因为我不想让findAll中的帐户[]仅在findById中

用@SqlResultSetMapping解决

这是什么意思?它仍然使用内部联接返回结果?返回两个表中的所有字段,更新的问题…这是hibernate如何翻译您的问题,那么问题在哪里?问题是本机查询,而不是本机查询!那么我怎样才能阻止加入呢?
SELECT 
    accounts0_.device_id AS device_i1_2_0_,
    accounts0_.account_id AS account_2_2_0_,
    account1_.id AS id1_0_1_,
    account1_.broker_id AS broker_i2_0_1_,
    account1_.is_deleted AS is_delet3_0_1_,
    account1_.user_id AS user_id4_0_1_
FROM
    device_account accounts0_
        INNER JOIN
    account account1_ ON accounts0_.account_id = account1_.id
WHERE
    accounts0_.device_id = ?