Domanda

I am working on legacy code which has a number of defunct database calls in it's ibatis mapping files. I am hoping to connect the ibatis mappings back to the java class files - or more accurately find which mappings do not get called by the java.

The purpose is to remove the calls from the mapping file and the procedures from the database.

Right now I can see no other way than to parse the mapping file, pick up each procedure's java id and then do a search in the java class files for where it might be called.

Has someone had to do this before? Or can someone see a better way to tackling this problem?

È stato utile?

Soluzione

You can do the following:

Write a small java program that:

  1. Searches all the iBatis configuration files
  2. Gets all the ids and persists them in a file (or in a collection)
  3. Searches all the .java files in the persistence level (that start with the persistence level package names)
  4. Whenever it finds the id used in any persistence class removes it (from the collection/file)
  5. At the end it will print out (into a file) all the ids not found and their configuration file names

It's very easy to write a program like this, it will just take a 15 minutes max and will save you days.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top