Skip to content

Commit 2c1621e

Browse files
authored
Merge pull request #8 from mybatis/master
pull
2 parents bf5db14 + b598a27 commit 2c1621e

File tree

5 files changed

+76
-61
lines changed

5 files changed

+76
-61
lines changed

src/main/java/org/apache/ibatis/datasource/unpooled/UnpooledDataSource.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void setDriverProperties(Properties driverProperties) {
136136
this.driverProperties = driverProperties;
137137
}
138138

139-
public String getDriver() {
139+
public synchronized String getDriver() {
140140
return driver;
141141
}
142142

src/main/java/org/apache/ibatis/mapping/SqlCommandType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2015 the original author or authors.
2+
* Copyright 2009-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

src/site/xdoc/configuration.xml

+32-22
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ SqlSessionFactory factory =
151151
</properties>]]></source>
152152

153153
<p>
154-
<span class="label important">NOTE</span> Also If you are used already the <code>":"</code> as property key(e.g. <code>db:username</code>)
155-
or you are used already the ternary operator of OGNL expression(e.g. <code>${tableName != null ? tableName : 'global_constants'}</code>) on your sql definition,
156-
you should be change the character that separate key and default value by adding a special property as follow:
154+
<span class="label important">NOTE</span> This will conflict with the <code>":"</code> character in property keys (e.g. <code>db:username</code>)
155+
or the ternary operator of OGNL expressions (e.g. <code>${tableName != null ? tableName : 'global_constants'}</code>) on a SQL definition.
156+
If you use either and want default property values, you must change the default value separator by adding this special property:
157157
</p>
158158

159159
<source><![CDATA[
@@ -209,7 +209,7 @@ SqlSessionFactory factory =
209209
</td>
210210
<td>
211211
Globally enables or disables lazy loading. When enabled, all relations will be lazily loaded.
212-
This value can be superseded for an specific relation by using the <code>fetchType</code> attribute on it.
212+
This value can be superseded for a specific relation by using the <code>fetchType</code> attribute on it.
213213
</td>
214214
<td>
215215
true | false
@@ -957,7 +957,7 @@ public class Author {
957957
</p>
958958
<p>
959959
<span class="label important">NOTE</span>
960-
Since version 3.4.5, The MyBatis has been supported JSR-310(Date and Time API) by default.
960+
Since version 3.4.5, MyBatis supports JSR-310 (Date and Time API) by default.
961961
</p>
962962
<table>
963963
<thead>
@@ -1437,7 +1437,7 @@ public class ExampleTypeHandler extends BaseTypeHandler<String> {
14371437
data type until the statement is executed.
14381438
</p>
14391439
<p>
1440-
MyBatis will know the the Java type that you want to handle with
1440+
MyBatis will know the Java type that you want to handle with
14411441
this TypeHandler by introspecting its generic type, but
14421442
you can override this behavior by two means:
14431443
</p>
@@ -1450,7 +1450,7 @@ public class ExampleTypeHandler extends BaseTypeHandler<String> {
14501450
</li>
14511451
</ul>
14521452

1453-
<p>Associated JDBC type can be specified by two means:</p>
1453+
<p>The associated JDBC type can be specified by two means:</p>
14541454
<ul>
14551455
<li>
14561456
Adding a <code>jdbcType</code> attribute to the typeHandler element (for example: <code>jdbcType="VARCHAR"</code>).
@@ -1608,15 +1608,22 @@ public class GenericTypeHandler<E extends MyObject> extends BaseTypeHandler<E> {
16081608
</p>
16091609
<source><![CDATA[// ExampleObjectFactory.java
16101610
public class ExampleObjectFactory extends DefaultObjectFactory {
1611-
public Object create(Class type) {
1611+
@Override
1612+
public <T> T create(Class<T> type) {
16121613
return super.create(type);
16131614
}
1614-
public Object create(Class type, List<Class> constructorArgTypes, List<Object> constructorArgs) {
1615+
1616+
@Override
1617+
public <T> T create(Class<T> type, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
16151618
return super.create(type, constructorArgTypes, constructorArgs);
16161619
}
1620+
1621+
@Override
16171622
public void setProperties(Properties properties) {
16181623
super.setProperties(properties);
16191624
}
1625+
1626+
@Override
16201627
public <T> boolean isCollection(Class<T> type) {
16211628
return Collection.class.isAssignableFrom(type);
16221629
}}
@@ -1690,12 +1697,16 @@ public class ExampleObjectFactory extends DefaultObjectFactory {
16901697
args = {MappedStatement.class,Object.class})})
16911698
public class ExamplePlugin implements Interceptor {
16921699
private Properties properties = new Properties();
1700+
1701+
@Override
16931702
public Object intercept(Invocation invocation) throws Throwable {
1694-
// implement pre processing if need
1703+
// implement pre-processing if needed
16951704
Object returnObject = invocation.proceed();
1696-
// implement post processing if need
1705+
// implement post-processing if needed
16971706
return returnObject;
16981707
}
1708+
1709+
@Override
16991710
public void setProperties(Properties properties) {
17001711
this.properties = properties;
17011712
}
@@ -1711,7 +1722,7 @@ public class ExamplePlugin implements Interceptor {
17111722
The plug-in above will intercept all calls to the "update" method
17121723
on
17131724
the Executor instance, which is an internal object responsible for
1714-
the low level execution of mapped statements.
1725+
the low-level execution of mapped statements.
17151726
</p>
17161727
<p><span class="label important">NOTE</span>
17171728
<strong>Overriding the Configuration Class
@@ -1720,9 +1731,9 @@ public class ExamplePlugin implements Interceptor {
17201731
<p>
17211732
In addition to modifying core MyBatis behaviour with plugins, you
17221733
can
1723-
also override the Configuration class entirely. Simply extend it
1734+
also override the <code>Configuration</code> class entirely. Simply extend it
17241735
and override any methods inside, and pass it into the call to the
1725-
SqlSessionFactoryBuilder.build(myConfig) method. Again though, this
1736+
<code>SqlSessionFactoryBuilder.build(myConfig)</code> method. Again though, this
17261737
could have a severe impact on the behaviour of MyBatis, so use
17271738
caution.
17281739
</p>
@@ -1893,13 +1904,12 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, propert
18931904
The dataSource element configures the source of JDBC Connection
18941905
objects using the standard JDBC DataSource interface.
18951906
</p>
1896-
<ul>
1897-
<li>Most MyBatis applications will configure a dataSource as in the
1898-
example. However, it’s not required. Realize though, that to
1899-
facilitate Lazy Loading, this dataSource is required.
1900-
</li>
1901-
</ul>
1902-
<p>There are three build-in dataSource types (i.e. type="[UNPOOLED|POOLED|JNDI]"):
1907+
<p>
1908+
Most MyBatis applications will configure a dataSource as in the
1909+
example. However, it’s not required. Realize though, that to
1910+
facilitate Lazy Loading, this dataSource is required.
1911+
</p>
1912+
<p>There are three built-in dataSource types (i.e. type="[UNPOOLED|POOLED|JNDI]"):
19031913
</p>
19041914
<p>
19051915
<strong>UNPOOLED</strong>
@@ -2117,7 +2127,7 @@ public class C3P0DataSourceFactory extends UnpooledDataSourceFactory {
21172127
</p>
21182128

21192129
<source><![CDATA[public interface DatabaseIdProvider {
2120-
default void setProperties(Properties p) { // Since 3.5.2, change to default method
2130+
default void setProperties(Properties p) { // Since 3.5.2, changed to default method
21212131
// NOP
21222132
}
21232133
String getDatabaseId(DataSource dataSource) throws SQLException;

0 commit comments

Comments
 (0)