简体   繁体   中英

spring boot, jpa, custom query(LOAD), upload csv to mysql

is it possible?? that

public interface TestRepository extends JpaRepository<Test, Long> {
    @Query("LOAD DATA LOCAL FILE ?1 INTO ......")
    public void loadCsv(String filePath);
}

because I have to move a lot of data(1M~ rows) to mysql table.

I found some ways for moving data and I am sure LOAD query is fastest. if any guys have any way for solving this problem, please give me advice!

thanks. :)

We need to pass the location of the file on DB server for below query, not the application server. @Query("LOAD DATA LOCAL FILE ?1 INTO ......")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM