You used the term "constant". Do you mean something like this:
public static final String FOO = "something";
public static final int BAR = 123;
If so, feel free to use these in EJBs, as static finals (constants) of the basic data types and strings are perfectly acceptable.
Yes this is exactly how I want too use it.
Now, another question:
Because I will need this "constant" outsite the EJB and because the bean definition is not availlable outside, How can I define this constant?
I use XDoclet to generate my classes and interfaces. Is there a way to tell it to "export" this static final field in the generated class? (interfaces and dataClasses)? Should I define some function giving me the constant value? (Bhaaaaa! Sound really dirty)
I'm not sure what you are asking, so if the following doesn't answer your question, please rephrase it.
I typically have a class named Constant, and in the class I place a lot of static final fields. Then in my EJB code, I have statements like:
MyEjb ejb = (MyEjb)context.lookup(Constant.FOO);
Of course, I also often place the static final fields in the EJB itself.