简体   繁体   中英

Fetch data using JPA and write in txt file, using java

I need to fetch around 5 million rows from database and write it to txt file. I am planning to write data in chunks. Also need to process one column. In my case, Is it better to use JDBC then hibernate, If yes, why?

It depends.

If you are reading from one table that closely matches your output, and odds are there will be no changes after this is done, the simplicity of JDBC might be appreciated (even if it has a clunky API).

If you need to modify your solution a few times the flexibility of JPA might be appreciated.

In short, it's hard to know the answer without looking at a possible solution first; and, even then, some of the "right" answer will be based on the opinion of the person judging it to be "right" or "wrong."

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