Вопрос

May be the best way is doing it manually. But in a large project you need some tool to assist you. It was the idea that led me to search a tool.

Are there any EJB migration tools available for migrating EJB 2.0 to 3.x.

Это было полезно?

Решение

It was only under development for a short time, but for a period we did have an eclipse plugin that would read in ejb-jar.xml files and then update the source and insert the annotations.

It's been used a handful of times by the person who wrote it (Jonathan Gallimore) and maybe one or two more after. It did at least work then and if you're not afraid of possibly having to roll your sleeves up, it could save you weeks of time.

While I haven't personally used it, I did oversee its development. Long story short is there are xml versions of all the annotations (100% lineup). An EJB container has to effectively read in xml and then fill in the gaps with the annotation data. The xml data wins over annotation data, so this processing is basically an act of turning annotations into xml. We took OpenEJB's annotation/xml processing code and flipped it around so that instead of turning annotations into xml in turned xml into annotations -- annotations which can then be easily inserted back into the source code via the eclipse APIs.

If it runs, it should run great and shouldn't change the logic of your app. Simply an xml->annotation transformation for your descriptor data.

You'll still have EJB 2.x views, but they'll be configured in annotation form in your code.

Before doing anything like that though, I'd get unit tests setup against the EJB 2.x code using the EJBContainer API as mentioned in the other question. Then use the conversion tool. Then refactor out the EJB 2.x views now that you don't have to always be messing with xml.

So basically:

  • Add tests for the existing code
  • Convert using the xml->annotation Eclipse plugin (run tests)
  • Refactor EJB 2.x views to EJB 3.x @Local or @LocalBean views (run tests)

Follow that path and you should have a blissful transition from EJB 2.x to 3.x. Well, as blissful as that job can be at least :)

Другие советы

Yes, IntelliJ EJB refactoring tools: http://www.jetbrains.com/idea/webhelp/migrating-to-ejb-3-0.html

But I'm sure this is not the only solution.

Nothing as such, following link provides insight over potential changes to code base. EJB2-EJB3 Migration

Java.net Article

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top