users@glassfish.java.net

Re: BULK INSERTS EJB3

From: <glassfish_at_javadesktop.org>
Date: Tue, 27 Nov 2007 11:20:59 PST

If you insert something new in to the database, you're not corrupting the cache because there's nothing for the data row in the cache yet.

Typical cache corruption happens when you update the DB behind the back of the cache, i.e. changing a row so that the DB has different data than the cached row. But an insert doesn't have this problem, because the row doesn't exist in the cache yet. So, using JDBC for bulk inserts is no problem.

Updates are best managed through the JPA, specifically because of the caching issue.

But bulk updates are readily applied using the JPA and EQL, as EQL is cache sensitive and will "do the right thing" when you use EQL for updates.

But if you are bulk loading a lot of data, direct JDBC inserts are simply far more efficient.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=247408