简体   繁体   中英

How to load csv file which has no header, data into oracle db using hibernate springboot

Connecting and giving values were very easy,but I couldn't load the csv data into oracle db

I was able to connect db and give data into db.

But couldn't load csv file which has no header files

Think of it as two separate tasks:

1.Read the csv file:

Create a reader class that transforms lines into entities

YourEntity createEntity(String[] line)

Using the reader process all lines to get a collection of entities corresponding to the csv file

2.Save the entity collection in your JPA repository(DB):

@Repository public interface YourRepository extends JpaRepository<YourEntity, UUID>

yourRepo.saveAll(Iterable entities)

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