I have following setup: Eclipse 3.1, MyEclipse 4.1, JBoss 4.0.4, Patch 1.
I have a medium sized application with about 50 Entities with relations. Some data in the application (roughly 500 records in total from the database of about 3 different types of entities) is requested very frequently as a result a customised catching is developed. This has increased the quering peformance considerably (from 4.5 sec to 1.5 secs) but the update and merge of entities is far too slow (about 10 secs on average).
After reading other threads and adding some attributes in hibernate setting to show SQL queries i found that upon merge, almost every entity in the memory gets flushed even when non of these entities state have changed.
Some of the queries were also slow but this has improved after adding setFlushMode(FlushModeType.COMMIT).
I very confused and need help on what should be the ideal setting for FlushMode in Stateless Session Bean.
If I change the EntityManager FlushMode to COMMIT, i have to control the commit (flush) in my code. I doubt this will resolve the problem or not as what i understand (correct me if i am wrong), the COMMIT will flush the data to database, that is all the entities in memory resulting in same performance.
Is there any way we can control or prevent the flushing of all the entities except for the one that is being merged or persisted.
I'll appreciate if anyone can enlighten on this.