Use a persistent Collection implementation. Hibernate has one. You don't want to do it yourself because it has been done and it will be a waste of time.
【在 A**o 的大作中提到】 : thanks, other than hibernate ne?
F*n
8 楼
If you have thousands of records you don't want rewrite them each time you update the DB.
【在 h****n 的大作中提到】 : : nod
B*g
9 楼
That will be depends. Based on LZ's case, I believe rewrite is much faster than checking each record exists or not.
【在 F****n 的大作中提到】 : If you have thousands of records you don't want rewrite them each time you : update the DB.
g*g
10 楼
Not necessarily, if performance is your concern, a solution like Hibernate + JBoss Cache can eliminate all unneccesary writing. In most products for most cases, you change a small portion of records every time.
【在 B*****g 的大作中提到】 : That will be depends. : Based on LZ's case, I believe rewrite is much faster than checking each : record exists or not.
B*g
11 楼
you sure check a dup will be faster than add a new one?
【在 g*****g 的大作中提到】 : Not necessarily, if performance is your concern, a solution like : Hibernate + JBoss Cache can eliminate all unneccesary writing. : In most products for most cases, you change a small portion of : records every time.
B*g
12 楼
sorry, correct it. Rename the table, the recreate same table, then load.
Depends, your record may be big. You may be able to play tricks like lazy-loading, prefetching with ORM, you'll save a ton of read with ORM caching. In any case, it's always easier and cheaper to cluster the application server and make the DB server the bottleneck. If you are really talking about highly scalable application, that's the direction you go, avoid extra DB read/write at all cost.
【在 B*****g 的大作中提到】 : you sure check a dup will be faster than add a new one?
B*g
14 楼
Still can loading by clustered application server.
【在 g*****g 的大作中提到】 : Depends, your record may be big. You may be able to play tricks like : lazy-loading, prefetching with ORM, you'll save a ton of read with ORM : caching. In any case, it's always easier and cheaper to cluster the : application server and make the DB server the bottleneck. : If you are really talking about highly scalable application, that's : the direction you go, avoid extra DB read/write at all cost.