mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
Merge pull request #924 from querydsl/sql-spring-docs
Improve docs for sql-spring
This commit is contained in:
commit
cd494111d4
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
<artifactId>querydsl-root</artifactId>
|
||||
<version>3.4.2.BUILD-SNAPSHOT</version>
|
||||
<version>3.5.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../querydsl-root/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -1,3 +1,16 @@
|
||||
/*
|
||||
* Copyright 2014, Timo Westkämper
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mysema.query.sql.spring;
|
||||
|
||||
import javax.inject.Provider;
|
||||
@ -6,6 +19,17 @@ import java.sql.Connection;
|
||||
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
|
||||
/**
|
||||
* SpringConnectionProvider is a Provider implementation which provides a transactionally bound connection
|
||||
*
|
||||
* <p>Usage example</p>
|
||||
* <pre>
|
||||
* {@code
|
||||
* Provider<Connection> provider = new SpringConnectionProvider(dataSource());
|
||||
* SQLQueryFactory queryFactory = SQLQueryFactory(configuration, provider);
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class SpringConnectionProvider implements Provider<Connection> {
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
@ -1,3 +1,16 @@
|
||||
/*
|
||||
* Copyright 2014, Timo Westkämper
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mysema.query.sql.spring;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@ -6,6 +19,19 @@ import java.util.List;
|
||||
import org.springframework.jdbc.support.SQLExceptionTranslator;
|
||||
import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
|
||||
|
||||
/**
|
||||
* SpringExceptionTranslator is an SQLExceptionTranslator implementation which uses Spring's
|
||||
* exception translation functionality internally
|
||||
*
|
||||
* <p>>Usage example</p>
|
||||
* <pre>
|
||||
* {@code
|
||||
* Configuration configuration = new Configuration(templates);
|
||||
* configuration.setExceptionTranslator(new SpringExceptionTranslator());
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
public class SpringExceptionTranslator implements com.mysema.query.sql.SQLExceptionTranslator {
|
||||
|
||||
private final SQLExceptionTranslator translator;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user