Invalid ejbSelect% Definitions in Entity-Beans

This query points out all the ejbSelect% methods of an entity-bean, with container managed persistence, that do not follow the specification rules.

Pre-packaged Query

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

Reports all Entity-Bean types with container managed persistence that contain ejbSelect%(..) methods that are not public or not abstract or that do not throw an exception of type javax.ejb.FinderException.

from EntityBean ebean, Method m
where m.getName().matches("ejbSelect%") and
      ebean.inherits(m) and
      (not(m.hasModifier("public")) or
not(m.hasModifier("abstract")) or not exists(Exception e | m.getAnException() = e and
e.getType().hasQualifiedName("javax.ejb","FinderException"))) select m, m.toString() + " must be public and abstract" + " and throw an exception of type" + " javax.ejb.FinderException"

References

Enterprise JavaBeans 2.1 - Specification, section 10.6.7

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

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