Package com.atlassian.jira.database
Interface DbConnection
- All Known Implementing Classes:
DbConnectionImpl
public interface DbConnection
A handle to a Database Connection obtained from JIRA's connection pool.
- Since:
- v6.4
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
commit()
com.querydsl.sql.dml.SQLDeleteClause
delete
(com.querydsl.sql.RelationalPath<?> entity) Starts an delete statement on the given DB Table.Returns the JDBC connection wrapped by this object.insert
(JiraRelationalPathBase<?> entity) Starts an insert statement on the given DB Table.com.querydsl.sql.SQLQuery<?>
Starts a SELECT statement on this connection.void
rollback()
void
setAutoCommit
(boolean autoCommit) com.querydsl.sql.dml.SQLUpdateClause
update
(com.querydsl.sql.RelationalPath<?> entity) Starts an update statement on the given DB Table.
-
Method Details
-
getJdbcConnection
Connection getJdbcConnection()Returns the JDBC connection wrapped by this object.- Returns:
- the JDBC connection wrapped by this object.
-
newSqlQuery
com.querydsl.sql.SQLQuery<?> newSqlQuery()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(); - Returns:
- the new Query builder.
-
insert
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 egQIssue.ISSUE
- Returns:
- a builder to create your insert statement.
-
update
com.querydsl.sql.dml.SQLUpdateClause update(com.querydsl.sql.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 egQIssue.ISSUE
- Returns:
- a builder to create your update statement.
-
delete
com.querydsl.sql.dml.SQLDeleteClause delete(com.querydsl.sql.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 egQIssue.ISSUE
- Returns:
- a builder to create your delete statement.
-
setAutoCommit
void setAutoCommit(boolean autoCommit) -
commit
void commit() -
rollback
void rollback()
-