I guess that it's ok because when you are using annotations and named queries there is not need to generate something. Named queries in annotations are completely fixed and static and they are supposed to be read only once by Jboss. If you really want to generate where expression you can always use EntityManager.createQuery.
Actually I have never tried to generate where expressions for namedQueries because they should have been created before an application is deployed to an application server.
i understoot your argumentation, but i believe (definitivly not sure)
this shall not be correct, because JAVA does not know anymodifier
called "completly fixed and static".
You may assign the annoation a final static String attribute, that is
composed of other String using concenation using the +-operator.
There is no reason, why +-operator works but a static method not!
IMHO Because a static field(like "a" + "b") is calculated when java code is compiled but a static function is a runtime thing. So that Jboss may read this annotations before this functions is run.
iff your +-composition resides in another class, then you
habe a class-loader job between. And then ???
I still think that "a class-loader job" does not mean executing any javacode.
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.
> A named query is a statically defined query with a predefined unchangeable query string.
i agree to this, bit Dbean1.JPQL_COMPOSITION is definitivly static and
unachnageable. For that reason i use final-static modifier. But
Jboss still think, it is not.
public class Dbean1. implements Serializable
/* some code */
final public static String GET_COMPOSITION = ".... composition " ;
final public static String JPQL_COMPOSITION = "SELECT dbean FROM ..... " + Dbean1.dummyClass() ;