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