Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I execute SQL with my plugin?

Leandro Larroulet April 22, 2013

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
Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 22, 2013

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

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

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

todor kolev May 1, 2014
How to determine the data source name (in this case defaultDS) but it might vary...
todor kolev May 10, 2014

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

Christian Vieweg December 6, 2018

I determined the data source name like this:

ComponentAccessor.getOfBizDelegator().getDelegatorInterface().getEntityHelperName("Issue")
0 votes
Florin Manaila
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 22, 2013

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?

0 votes
Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 22, 2013

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

Now that it is not available anymore

0 votes
Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 22, 2013

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
AUG Leaders

Atlassian Community Events