javajakarta-eeejb-3.0ejbejb-2.x

EJB specifications and Java versions - backwards compatibility


This is my understanding of relationship between the EJB spec and Java versions

The EJB 2.1 specification requires backward compatibility for EJB 2.0, so containers supporting EJB 2.1 and running in JDK 1.4.x will be able to run EJB 2.0 beans as well.

The EJB 3 spec requires backward compatibility for earlier version of the specifications.

My question is this. If I upgrade the java code for the implementation of the EJB 2.0 beans to compile against a later version of Java (say Java 5), can I still keep the same version of the EJB spec or do I need to migrate this as well.


Solution

  • You shouldn't even have to "upgrade" the Java code, since I think older code can only be incompatible at source level due to identifiers that collide with newly introduced keywords, but that's not a problem at the bytecode level.

    So your old Java 1.3/EJB 2.0 EARs should still run unchanged on a Java 5/EJB 3 appserver, and you could even do bugfixes in code and compile it with -target 1.3 on a modern JDK without having to fix the colliding identifiers (of course you then also cannot use the new source-level features).