You need to change the <jndi-name> mappings in jboss.xml to bind the different versions under different names. Also you need to declare separate classloader repositories in your jboss-app.xml file, see the <loader-repository> tag in jboss-app_3_0.dtd (any valid object name string will do).
Thank you for your reply.
But what if I really needed to deploy two different versions of the same application (i.e. production and test version)?
Of course I'd like to mantain the same JNDI name; should I use two different JBoss installation?
you can't bind two versions under the same global name in one server (how would the client know which version to invoke?), also you'd probably want to configure two different datasources for your entity beans (test and production databases). Setting up two servers is the best thing to do.