I have an Entity with few @Lob fields which contains some images. And when I execute following method,
entityManager.persist(myEnity);
This method produces following query which takes long time to execute as my table is large.
SELECT id, img_1, img_2 FROM my_entity WHERE (ID = :1) FOR UPDATE;
I don’t want this query to execute because I want to INSERT a row only.
FYI, I have following Application Environment.
EJB 3.0
EclipseLink 2.3.0
JDK 1.6
WebLogic 10.3
Oracle 11g
Oracle JDBC drivers before Oracle 11 had a 4k LOB size limit, so the only way to write lobs is to insert and empty lob, and the select the lobs back and writing into them. This is what you are seeing.
This is configurable, it is only done if your “eclipselink.target-database” is “Oracle8i”, “Oracle9i”, “Oracle10g”.
For Oracle 11g you should use “Oracle11”, this platform will not use the locator, as it should no longer be required in Oracle 11g. You may need to be on the latest version (2.4) for this. Using “Oracle” as your target will also not use the locator.
You can also disable the locator usage in your platform with a customizer,