EJB environment entires set to null

Discussions

EJB programming & troubleshooting: EJB environment entires set to null

  1. EJB environment entires set to null (3 messages)

    I need to set up several environment entries for a Session Bean using <env-entry> tags in ejb-jar.xml

    Some of this entries will affect the behaviour of the Session bean. In some cases, we would like to model a situation where an specific environment is set to null (meaning that the parameter is non-existant). So I Simply set its value to null, like in:

    <env-entry>
     <env-entry-name>creditLineLevel</env-entry-name>
       <env-entry-type>java.lang.Integer</env-entry-type>
      <env-entry-value>null</env-entry-value>
    </env-entry>

    But this raises errors while trying to get a reference to the bean.

    Is this wrong? How could I set ip the environment where there is no value assigned to the environment entry at all?

    Thanks,
    Fedro

    Threaded Messages (3)

  2. Here one thing you need to clarify. Why do you need environment variable as null?. If so wherever you use that environemnt just assume it as null. That is why they have not given support for the null values for environment variables.
  3. This is why...[ Go to top ]

    My Session bean is acting a a client for a web service which includes several optional attributes. Some of this attributes are fixed-value parameters that should be passed by the client to the web service.

    The service provided is fairly general, so some of the attributes (which are optional) in our particular client situation ahould not be sent. But this situation might change in the future.

    We did not wanted to hard-code these attributes' values and so, we modeled them as env-entries of our bean, so if their value change in the future, we simply would need to change the env-entry value. Still, some of theses attributes should not be included in the XML message sent to the web service, so it comes up the need to set this entries to null. We did not want to use a "special" value to denote this situation since it deemed impractical.

    Thanks,
    Fedro
  4. EJB environment entires set to null[ Go to top ]

    That is what i am telling currently you do not put anything in the environment variable. In the session bean where you are getting that environment variable value you just will get null value. If tommarow if you want to add some value to that environment variable you can just add that environment variable and get the value in your bean.