Hi everyone,
we are uprgrading soon to the lastest Jira version. For this reason we're also adapting a few Java plugins we developed for Jira 6.x.
One of those plugins required importing 3 external tables into the Jira database and I need to query them via SQL. In the current version of my plugin, I create a java.sql.Connection in this way:
protected static Connection getDatabaseConnection() {
try {
GenericHelper helper = CoreFactory.getGenericDelegator().getEntityHelper("User");
DatabaseUtil utils = new DatabaseUtil(helper.getHelperName());
return utils.getConnection();
} catch (SQLException e) {
throw new DataAccessException("Unable to obtain a DB connection", e);
} catch (GenericEntityException e) {
throw new DataAccessException("Unable to obtain a DB connection", e);
}
}
and then use the prepareStatement() method on what it returns. Unfortunately, CoreFactory.getGenericDelegator() is now deprecated. What replaces it? How can I achieve the same goal in another way? Any hints?
Thank you.
I eventually used
final OfBizConnectionFactory connectionFactory = new DefaultOfBizConnectionFactory();
return connectionFactory.getConnection();
to get a java.sql.Connection object, hopefully it works the same way
Hello @gfinesch
As API documentation says use OfBizDelegator instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.