Making changes to usernames directly in Openfire database?

We’re implementing an Openfire installation using a standard Openfire database for main operation, and a secondary database (Enterprise) for user authentication.

i.e. we have the following parameters populated, in the Openfire database:

jdbcUserProvider.allUsersSQL = SELECT username FROM jabberusers_full

jdbcUserProvider.loadUserSQL = … etc.

jdbcUserProvider.searchSQL

jdbcUserProvider.userCountSQL

jdbcAuthProvider.passwordSQL

… and naturally the connection string, etc.

We’re also using a cron job to populate the roster groups in the Openfire database with stuff from another database.

The issue is what happens when a user in our central database changes their username. The basic authentication is no problem, since that’s queried directly, however…

I see in a number of the Openfire tables, that information is stored about particular users, by username. e.g. in ofpresence, ofoffline, ofpubsubaffiliation (not just userids, but userid@jabber.domain.com), ofroster, and plenty of others.

What I want to do is to update all the records in the database that mention a particular username, when I know that that username is changing to another one.

However, I don’t know to what extent all this data is being cached in Openfire, and whether any changes that I make may end up being overwritten by the server.

Questions:

1 - Is there any API for OpenFire to get it to change the contents of the database to update usernames?

2 - If I do this manually in the database, then will these changes be noticed by Openfire at all?

3 - Is there any way, beyond restarting Openfire, to get it to re-read the database tables if I have made changes to them?

4 - If I did nothing when a user changed their username, what’s the worst that can happen if “orphaned” data is left in the database that was supposed to related to that user?

5 - Am I simply going about all this the wrong way, missing some other official way to handle the situation of changing usernames?

Many thanks,

Stephen Brandon