EJB规范和Java版本 - 向后兼容性 [英] EJB specifications and Java versions - backwards compatibility

查看:170
本文介绍了EJB规范和Java版本 - 向后兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我对EJB规范和Java版本之间的关系的理解

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


  • EJB 2.0是J2EE 1.3平台的一部分,顶级J2SE 1.3
    或JDK 1.3.x

  • EJB 2.1是J2EE 1.4平台的一部分,它是J2SE 1.4或JDK 1.4.x

EJB 2.1规范要求EJB 2.0的向后兼容性,因此支持EJB 2.1并在JDK 1.4.x中运行的容器将能够运行EJB 2.0 bean。

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.


  • EJB 3.0是Java EE 5平台的一部分,它需要Java SE 5(JDK 5)注释等

EJB 3规范要求较早版本的规范具有向后兼容性。

我的问题是这个。如果我升级了用于实现EJB 2.0 bean的Java代码,以编译较新版本的Java(比如说Java 5),那么我仍然可以保留相同版本的EJB规范,或者我还需要迁移这个。 / strong>

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.

推荐答案

您甚至不必升级Java代码,因为我认为较旧的代码只能由于与新引入的关键字相冲突的标识符,在源级别不兼容,但这不是字节码级别的问题。

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.

所以你旧的Java 1.3 / EJB 2.0 EAR应该还是在Java 5 / EJB 3应用服务器上运行不变,甚至可以在代码中进行修正,并在现代JDK中使用 -target 1.3 进行编译,而无需修复冲突标识符(当然你也不能使用新的源级功能)。

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).

这篇关于EJB规范和Java版本 - 向后兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆