I'd like to replace the direct destination reference "test.QueueIn" with the "java:comp/env/jms/TestQueueIn" notation. This should allow me to specify the MDB destination in the deployment descriptor instead of in the java code. That is, I want to determine the MDB destination in the deployment time, not in the compile time.

Is this possible? Or, is there a better way of creating the reference indirection?

Do you want to configure it through deployment descriptor
–
Nayan WadekarMar 28 '12 at 18:55

Yes, I want to have in the code only a resource reference, and to have the resource specified in the deployment descriptor. This question has two parts: Which annotation to use in the code instead of destinationJndiName. And what to write into the deployment descriptor.
–
xarxMar 28 '12 at 19:24

The jndiName in @ResourceEnvRef is an optional attribute, so you don't need to specify it in the code. However, even if you do, it serves merely as a default value, you can always change it in the (generated) deployment descriptor.