CRITICAL
Rule Definition
Triggers and object-relational mapping often create issues due to the difficulties of synchronizing the effect of a trigger with the representation of data in memory.
To enhance performances, it is a best practice to use the attribute select-before-update for the persistent class associated to a table that have the UPDATE trigger.
But if the table is not associated to an UPDATE trigger, then it will affect your performance since the application will perform unnecessary SELECT.
Remediation
Remove the attribute select-before-update for the persistent class that is not associated to a table that have the UPDATE trigger.
Violation Code Sample
SAMPLE is a table not managed by an UPDATE trigger
---> sample.hbm.xml
// VIOLATION
<class name="Sample" table="SAMPLE" select-before-update="true">
...
</class>
Fixed Code Sample
---> sample.hbm.xml
// FIXED
<class name="Sample" table="SAMPLE">
...
</class>
Reference
Hibernate in Action (ISBN 1932394-15-X) p 339
Related Technologies
JEE
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.