How to dynamically discover referenced resources in an EJB


EJB programming & troubleshooting: How to dynamically discover referenced resources in an EJB

  1. Hi, I have an EJB acting as a JMS client. It has to send messages to a remote application that is listening in 1 to n possible queues. My question is how the EJB can dynamically discover the number and the names of those queues. In all the examples I have seen so far, if an EJB is going to use a queue, the queue name has to be statically configured as a referenced resource in the resource-ref section of the ejb-jar.xml file. So using my own properties or xml file to inform the EJB about the queue names is useless if it finally depends on what was declared in the ejb-jar.xml. Also, a change in the number and/or names of the queues in my remote application would force me to redeploy the entire EJB module. Is there a way to avoid this static dependency? If not, is it possible at least for an EJB to programatically read what resources were configured in the ejb-jar file? Thanks in advance...

    Threaded Messages (3)

  2. You could get the destination queue by calling getJMSDestination() which returns a Destination object.
    I hope this will help.
  3. CMP Updating data to DB[ Go to top ]

      When does the CMP issue UPDATE statement to DB? Suppose I have 10 fields in a table and I am modifing a record. I will issue the set methods for each column. Will the CMP issue UPDATE statement for each set method or 1 single UPDATE statement to update all the fields?
     If it is separate UPDATE statements for each set method, is there any way that I tell the CMP to update all the fields in one single UPDATE statement? Please let me know.

    Thanks in advance,
    Prasanna Kumar
  4. CMP Updating data to DB[ Go to top ]

    isModified() is no longer required for 2.0 CMP entity EJBs based on the EJB 2.0 specification However, it still applies to BMP and 1.1 CMP EJBs. When you deploy EJB 2.0 entity beans with container-managed persistence, WebLogic Server automatically detects which EJB fields have been modified, and writes only those fields to the underlying datastore.

    this is an extract from bea docs 7.0.

    hope this helps you to clear u r doubt.