Class DbConnectionImpl

java.lang.Object
com.atlassian.jira.database.DbConnectionImpl
All Implemented Interfaces:
DbConnection

public class DbConnectionImpl extends Object implements DbConnection
Since:
v6.4
  • Method Details

    • getJdbcConnection

      public Connection getJdbcConnection()
      Description copied from interface: DbConnection
      Returns the JDBC connection wrapped by this object.
      Specified by:
      getJdbcConnection in interface DbConnection
      Returns:
      the JDBC connection wrapped by this object.
    • newSqlQuery

      public com.querydsl.sql.SQLQuery newSqlQuery()
      Description copied from interface: DbConnection
      Starts a SELECT statement on this connection.

      Example usage:

           QVersion v = new QVersion("v");
      
           final List versions =
                   dbConnection.newSqlQuery()
                           .select(v)
                           .from(v)
                           .where(v.project.eq(projectId))
                           .orderBy(v.sequence.asc())
                           .fetch();
       
      Specified by:
      newSqlQuery in interface DbConnection
      Returns:
      the new Query builder.
    • update

      public com.querydsl.sql.dml.SQLUpdateClause update(com.querydsl.sql.RelationalPath<?> entity)
      Description copied from interface: DbConnection
      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();
       
      Specified by:
      update in interface DbConnection
      Parameters:
      entity - The DB entity you want to update eg QIssue.ISSUE
      Returns:
      a builder to create your update statement.
    • insert

      Description copied from interface: DbConnection
      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();
       
      Specified by:
      insert in interface DbConnection
      Parameters:
      entity - The DB entity you want to insert into eg QIssue.ISSUE
      Returns:
      a builder to create your insert statement.
    • delete

      public com.querydsl.sql.dml.SQLDeleteClause delete(com.querydsl.sql.RelationalPath<?> entity)
      Description copied from interface: DbConnection
      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();
       
      Specified by:
      delete in interface DbConnection
      Parameters:
      entity - The DB entity you want to delete from eg QIssue.ISSUE
      Returns:
      a builder to create your delete statement.
    • setAutoCommit

      public void setAutoCommit(boolean autoCommit)
      Specified by:
      setAutoCommit in interface DbConnection
    • commit

      public void commit()
      Specified by:
      commit in interface DbConnection
    • rollback

      public void rollback()
      Specified by:
      rollback in interface DbConnection