I still think that "a class-loader job" does not mean executing any javacode.
http://www.objectdb.com/java/jpa/query/named
A named query is a statically defined query with a predefined unchangeable query string.
if you have a static function it means that you can change a query through changing this function. The logic of the function lies in runtime level and you can change it by changing some function parameters. I suppose that Jboss/Hibernate reads all the annotations before you static code is executed.
P.S. I think that someone else can describe it more clearly. And what I'm saying is just my own opinion. And I'm sure that everyone can be mistaken.