Merge pull request #924 from querydsl/sql-spring-docs

Improve docs for sql-spring
This commit is contained in:
Timo Westkämper 2014-09-04 21:14:43 +03:00
commit cd494111d4
3 changed files with 51 additions and 1 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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;