Invalid ejbFind% Definitions in Entity-Beans

This query finds all the ejbFind% methods of an entity-bean, with bean managed persistence, that do not follow the specification rules.

Pre-packaged Query

Query name="Semmle/StyleChecks/J2EE/Entity-Bean/with Bean-Managed Persistence/Check ejbFind%(..) methods' definition"

Reports all Entity-Bean types with bean managed persistence that contain ejbFind%(..) methods that are not public, or are final or static or have a return type void.

from EntityBean ebean, Method m
where m.getName().matches("ejbFind%") and
      ebean.inherits(m) and
      (not(m.hasModifier("public")) or 
       m.hasModifier("final") or 
       m.hasModifier("static") or
       m.getType().hasName("void"))
select m, m.toString() + " must be public, not final, not static"
                       + " and not have return type void"

References

Enterprise JavaBeans 2.1 - Specification, section 12.2.5

Digg!Reddit!Del.icio.us!Facebook!Slashdot!Technorati!StumbleUpon!Ma.gnolia!

Comments
Only registered users can write comments!
 
< Prev   Next >