JBoss 4.2 has under server\lib hibernate jars (core,annotation). I want to use in different versions so, 1.Do you recommended to replace JBoss jars with my jars or to include the new versions in my ear. I don�t like the first option because it easier to me to control with version control and with maven on the application jars. 2.in case I decide to put include them in the ear , how can I make sure that the application will use them?
Its always recommended to package the libraries as part of your ear file. So yes, the second approach the recommended one. For more details about how to make the ear pick up these libraries, go through the following articles:
Those libraries in the JBoss lib folder are going to change whenever there is a new version of JBoss. So, if you are using those 3rd party libraries in your application then its recommended to bundle the appropriate version of those libraries in your ear. This will reduce the impact of version changes whenever you upgrade to a new version of JBoss or even whenever your application wants to upgrade to a recent version of the 3rd party library.