Synchronization in EJB

Discussions

EJB programming & troubleshooting: Synchronization in EJB

  1. Synchronization in EJB (2 messages)

    We have one composite object is our EJB class.we have one method in composite object for generating primary key,that method is synchronized.Can we synchronize the method of that composite object?

    Threaded Messages (2)

  2. Synchronization in EJB[ Go to top ]

    ?... if specifying *require transaction* in the ejb method..
    why we still need synchronization in EJB?.. never heard of using the keyword *synchronize* in EJB... read the spec...
  3. Synchronization in EJB[ Go to top ]

    You can synchronize methods in a J2EE container however the Programmer restrictions in the EJB 2.0 specification say,

    "• An enterprise Bean must not use thread synchronization primitives to synchronize execution of multiple instances.

    Same reason as above. Synchronization would not work if the EJB Container distributed enterprise bean’s instances across multiple JVMs."

    J2EE systems must be designed with mutiple servers running together (maybe clustered) in mind.

    For generating primary keys I generally use sequences for Oracle or identites/GUIDs for SQLServer. Some containers support automatic PK generation

    http://e-docs.bea.com/wls/docs61/ejb/cmp.html#1066165

    David