What is the purpose of creating env variables for a session bean.
How does one configure these variables on the application server
-
EJB enviromental variables (1 messages)
- Posted by: Howard Hill
- Posted on: November 16 2005 09:40 EST
Threaded Messages (1)
- EJB enviromental variables by ranji c on November 18 2005 12:08 EST
-
EJB enviromental variables[ Go to top ]
- Posted by: ranji c
- Posted on: November 18 2005 12:08 EST
- in response to Howard Hill
Your question is not clear! developers assume a lot.
So assuming that your question is on <env-entry>,
They are used to configure certain reference values for the session bean. They are set through ejb-jar.xml entry and can be read using a JNDI look up
consider example ejb-jar.xml fragment
<session>
...
...
<env-entry>
<!-- Access in code using JNDI lookup("java:/comp/env/get_assumption_sql") -->
<env-entry-name>get_assumption_sql</env-entry-name>
<env-entry-type>String</env-entry-type>
<env-entry-value>
SELECT ASSUMPTION FROM MIND
</env-entry-value>
<description>This env entry is for ... </description>
</env-entry>
...
Now if your session bean want to get this SQL, you simply do a look up as:
initCtx.lookUp("java:/comp/env/get_assumption_sql");
HTH