1. 程式人生 > >jpa @query註解使用時的 xxx is not mapped

jpa @query註解使用時的 xxx is not mapped

@Modifying
@Query(value = "UPDATE MANUAL_FILE SET FILE_INFO = ?2 , USER_ID = ?3 WHERE ID = ?1 ", nativeQuery = true)
void updateById1(String id, String fileInfo, String userId);

nativeQuery = true 證明不使用物件對映 如果不開啟 使用sql查詢資料庫表就會報錯 – 表名 is not mapped jpa預設@query(select * from entityName) 這種方式使用物件對映表 針對使用物件中的屬性去查詢

@Modifying//基於表查詢
    @Query(value = "UPDATE MANUAL_FILE SET FILE_INFO = ?2 WHERE ID = ?1  ", nativeQuery = true)
    void updateById(String id, String fileInfo);
    @Modifying//基於物件查詢
    @Query(value = "UPDATE Manual SET fileInfo = ?2 WHERE id = ?1  ")
    void updateById1(String id, String fileInfo);