Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can I execute SQL with my plugin?

Hi everyone,

I'm working on a plugin migration which happens to use a DAO class that extends JdbcDaoSupport.

Now that it is not available anymore (JdbcDaoSupport) I was wondering how could I execute an SQL statement without changing everything to use ActiveObjects.

If someone could give me a hint, that'd be great!

Regards,

Ripka

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted

org.ofbiz.core.entity.jdbc.SQLProcessor sqlProcessor = null;

sqlProcessor = new org.ofbiz.core.entity.jdbc.SQLProcessor("defaultDS");

ResultSet rs=sqlProcessor.executeQuery("QUERY");

How to determine the data source name (in this case defaultDS) but it might vary...

Is there any ORM framework provided by Jira as we can't know what the underlying database is.

I determined the data source name like this:

ComponentAccessor.getOfBizDelegator().getDelegatorInterface().getEntityHelperName("Issue")

Try to use org.ofbiz.core.entity.jdbc.SQLProcessor if you're looking for another way, but as Mizan said, why not just add the required dependency to your project?

How about adding this class/ package as a dependency in your plugin ? what you mean by

Now that it is not available anymore

org.ofbiz.core.entity.jdbc.SQLProcessor sqlProcessor = null;

sqlProcessor = new org.ofbiz.core.entity.jdbc.SQLProcessor("defaultDS");

ResultSet rs=sqlProcessor.executeQuery(SQL_QUERY);

Regards

Onkar Ahire

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
Community showcase
Published in Jira

Announcement: New Issue Create modal will be available to all customers starting 6th December 2021

Greetings Everyone!   I’m Arjoon, a PM in Jira Cloud. Earlier this year, we shared our current efforts to improve the Issue Create experience in Jira. One of the key improvements that we hav...

14 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you