public class

DbConnectionImpl

extends Object
implements DbConnection
java.lang.Object
   ↳ com.atlassian.jira.database.DbConnectionImpl

Summary

Public Constructors
DbConnectionImpl(Connection con, SQLTemplates dialect, DelegatorInterface genericDelegator)
Public Methods
void commit()
SQLDeleteClause delete(RelationalPath<?> entity)
Starts an delete statement on the given DB Table.
Connection getJdbcConnection()
Returns the JDBC connection wrapped by this object.
IdGeneratingSQLInsertClause insert(JiraRelationalPathBase<?> entity)
Starts an insert statement on the given DB Table.
SQLQuery newSqlQuery()
Starts a SELECT statement on this connection.
void rollback()
void setAutoCommit(boolean autoCommit)
SQLUpdateClause update(RelationalPath<?> entity)
Starts an update statement on the given DB Table.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.database.DbConnection

Public Constructors

public DbConnectionImpl (Connection con, SQLTemplates dialect, DelegatorInterface genericDelegator)

Public Methods

public void commit ()

public SQLDeleteClause delete (RelationalPath<?> entity)

Starts an delete statement on the given DB Table.

Example usage:

        dbConnection.delete(QIssueLink.ISSUE_LINK)
                .where(QIssueLink.ISSUE_LINK.id.eq(issueLink.getId()))
                .execute();
 

Parameters
entity The DB entity you want to delete from eg ISSUE
Returns
  • a builder to create your delete statement.

public Connection getJdbcConnection ()

Returns the JDBC connection wrapped by this object.

Returns
  • the JDBC connection wrapped by this object.

public IdGeneratingSQLInsertClause insert (JiraRelationalPathBase<?> entity)

Starts an insert statement on the given DB Table.

Example 1 usage:

        dbConnection.insert(QIssueLink.ISSUE_LINK)
                .set(QIssueLink.ISSUE_LINK.linktype, newIssueLinkTypeId)
                .set(QIssueLink.ISSUE_LINK.sequence, sequence)
                .execute();
 

Example 2 usage:

        dbConnection.insert(QIssueLink.ISSUE_LINK)
                .populate(issueLinkDTO)
                .execute();
 

Parameters
entity The DB entity you want to insert into eg ISSUE
Returns
  • a builder to create your insert statement.

public SQLQuery newSqlQuery ()

Starts a SELECT statement on this connection.

Example usage:

     QVersion v = new QVersion("v");

     final List versions =
             dbConnection.newSqlQuery()
                     .from(v)
                     .where(v.project.eq(projectId))
                     .orderBy(v.sequence.asc())
                     .list(v);
 

Returns
  • the new Query builder.

public void rollback ()

public void setAutoCommit (boolean autoCommit)

public SQLUpdateClause update (RelationalPath<?> entity)

Starts an update statement on the given DB Table.

Example usage:

        dbConnection.update(QIssueLink.ISSUE_LINK)
                .set(QIssueLink.ISSUE_LINK.linktype, newIssueLinkTypeId)
                .where(QIssueLink.ISSUE_LINK.id.eq(issueLink.getId()))
                .execute();
 

Parameters
entity The DB entity you want to update eg ISSUE
Returns
  • a builder to create your update statement.