├── .gitattributes ├── .mvn ├── maven.config ├── extensions.xml ├── wrapper │ └── maven-wrapper.properties └── settings.xml ├── renovate.json ├── .gitignore ├── LICENSE_HEADER ├── src ├── test │ ├── resources │ │ ├── com │ │ │ └── ibatis │ │ │ │ ├── common │ │ │ │ └── resources │ │ │ │ │ └── resourcestest.properties │ │ │ │ └── sqlmap │ │ │ │ └── maps │ │ │ │ ├── OracleConfig.properties │ │ │ │ ├── SqlMapConfig.properties │ │ │ │ ├── DerbySqlMapConfig.properties │ │ │ │ ├── Complex.xml │ │ │ │ ├── PrivateBook.xml │ │ │ │ ├── DerbyProc.xml │ │ │ │ └── OracleProc.xml │ │ ├── scripts │ │ │ ├── derby-proc-init.sql │ │ │ ├── more-account-records.sql │ │ │ ├── person-init.sql │ │ │ ├── jira.sql │ │ │ └── account-init.sql │ │ └── threads │ │ │ ├── sql-map-config.xml │ │ │ └── Foo-sql-map.xml │ └── java │ │ ├── testdomain │ │ ├── DocType.java │ │ ├── SuperAccount.java │ │ ├── ISupplierKey.java │ │ ├── PrivateBook.java │ │ ├── ComplexBean.java │ │ ├── Magazine.java │ │ ├── Book.java │ │ ├── ISupplierKeyImpl.java │ │ ├── TopicDescription.java │ │ ├── ProcBean.java │ │ ├── SimpleNestedParameterObject.java │ │ ├── ISupplier.java │ │ ├── PersonDocument.java │ │ ├── Document.java │ │ ├── MyBean.java │ │ ├── ArticleIndex.java │ │ ├── Person.java │ │ ├── Topic.java │ │ ├── IItem.java │ │ ├── LineItem.java │ │ ├── FieldAccount.java │ │ ├── Product.java │ │ ├── Category.java │ │ └── ArticleIndexDenorm.java │ │ ├── com │ │ └── ibatis │ │ │ ├── sqlmap │ │ │ ├── engine │ │ │ │ ├── mapping │ │ │ │ │ └── result │ │ │ │ │ │ └── loader │ │ │ │ │ │ └── test │ │ │ │ │ │ ├── Bean1.java │ │ │ │ │ │ └── Bean2.java │ │ │ │ ├── cache │ │ │ │ │ ├── fifo │ │ │ │ │ │ └── FifoCacheControllerTest.java │ │ │ │ │ ├── memory │ │ │ │ │ │ └── MemoryCacheControllerTest.java │ │ │ │ │ └── CacheKeyTest.java │ │ │ │ └── builder │ │ │ │ │ └── xml │ │ │ │ │ └── SqlMapConfigParserTest.java │ │ │ ├── PrivateMethodAccessTest.java │ │ │ ├── DerbyParameterMapTest.java │ │ │ ├── proc │ │ │ │ └── DerbyProcs.java │ │ │ ├── ResultObjectFactoryTest.java │ │ │ ├── ComplexTypeTest.java │ │ │ └── DirectFieldMappingTest.java │ │ │ └── common │ │ │ └── beans │ │ │ └── ComplexBeanProbeTest.java │ │ ├── badbeans │ │ ├── GoodBean.java │ │ ├── BeanWithDifferentTypeGetterSetter.java │ │ ├── BeanWithOverloadedSetter.java │ │ ├── BeanWithDifferentTypeOverloadedSetter.java │ │ └── BeanWithNoGetterOverloadedSetters.java │ │ ├── xmltester │ │ └── MiniAttribute.java │ │ └── threads │ │ ├── Foo.java │ │ └── MyThread.java ├── main │ └── java │ │ └── com │ │ └── ibatis │ │ ├── sqlmap │ │ ├── client │ │ │ ├── event │ │ │ │ ├── package-info.java │ │ │ │ └── RowHandler.java │ │ │ ├── package-info.java │ │ │ └── SqlMapSession.java │ │ └── engine │ │ │ ├── type │ │ │ ├── DomTypeMarker.java │ │ │ ├── XmlTypeMarker.java │ │ │ ├── DomCollectionTypeMarker.java │ │ │ ├── XmlCollectionTypeMarker.java │ │ │ ├── BaseTypeHandler.java │ │ │ ├── SimpleDateFormatter.java │ │ │ ├── ClobTypeHandlerCallback.java │ │ │ ├── BlobTypeHandlerCallback.java │ │ │ ├── StringTypeHandler.java │ │ │ ├── ObjectTypeHandler.java │ │ │ ├── ByteArrayTypeHandler.java │ │ │ ├── ByteTypeHandler.java │ │ │ ├── LongTypeHandler.java │ │ │ ├── FloatTypeHandler.java │ │ │ ├── ShortTypeHandler.java │ │ │ └── IntegerTypeHandler.java │ │ │ ├── mapping │ │ │ ├── sql │ │ │ │ ├── SqlChild.java │ │ │ │ ├── dynamic │ │ │ │ │ └── elements │ │ │ │ │ │ ├── IsEqualTagHandler.java │ │ │ │ │ │ ├── DynamicParent.java │ │ │ │ │ │ ├── IsNotNullTagHandler.java │ │ │ │ │ │ ├── IsNotEmptyTagHandler.java │ │ │ │ │ │ ├── IsNotEqualTagHandler.java │ │ │ │ │ │ ├── IsParameterPresentTagHandler.java │ │ │ │ │ │ ├── DynamicTagHandler.java │ │ │ │ │ │ ├── IsNotParameterPresentTagHandler.java │ │ │ │ │ │ ├── IsNotPropertyAvailableTagHandler.java │ │ │ │ │ │ ├── IsLessThanTagHandler.java │ │ │ │ │ │ ├── IsLessEqualTagHandler.java │ │ │ │ │ │ ├── IsGreaterEqualTagHandler.java │ │ │ │ │ │ ├── IsGreaterThanTagHandler.java │ │ │ │ │ │ ├── IsNullTagHandler.java │ │ │ │ │ │ └── IsEmptyTagHandler.java │ │ │ │ ├── stat │ │ │ │ │ └── StaticSql.java │ │ │ │ └── raw │ │ │ │ │ └── RawSql.java │ │ │ ├── statement │ │ │ │ ├── ExecuteListener.java │ │ │ │ ├── SelectStatement.java │ │ │ │ ├── DefaultRowHandler.java │ │ │ │ ├── StatementType.java │ │ │ │ ├── DeleteStatement.java │ │ │ │ └── UpdateStatement.java │ │ │ └── parameter │ │ │ │ └── NoParameterMap.java │ │ │ ├── config │ │ │ └── SqlSource.java │ │ │ ├── datasource │ │ │ ├── SimpleDataSourceFactory.java │ │ │ ├── DataSourceFactory.java │ │ │ └── DbcpDataSourceFactory.java │ │ │ ├── accessplan │ │ │ ├── AccessPlan.java │ │ │ ├── MapAccessPlan.java │ │ │ ├── EnhancedPropertyAccessPlan.java │ │ │ └── ComplexAccessPlan.java │ │ │ ├── transaction │ │ │ ├── TransactionState.java │ │ │ ├── jdbc │ │ │ │ └── JdbcTransactionConfig.java │ │ │ ├── TransactionException.java │ │ │ └── Transaction.java │ │ │ └── exchange │ │ │ └── BaseDataExchange.java │ │ └── common │ │ ├── logging │ │ ├── nologging │ │ │ └── NoLoggingImpl.java │ │ ├── Log.java │ │ ├── log4j │ │ │ └── Log4jImpl.java │ │ ├── jakarta │ │ │ └── JakartaCommonsLoggingImpl.java │ │ └── jdk14 │ │ │ └── Jdk14LoggingImpl.java │ │ ├── beans │ │ ├── Invoker.java │ │ ├── GetFieldInvoker.java │ │ ├── SetFieldInvoker.java │ │ ├── MethodInvoker.java │ │ ├── ProbeException.java │ │ └── ProbeFactory.java │ │ └── xml │ │ ├── NodeletException.java │ │ └── Nodelet.java └── site │ └── site.xml ├── format.xml ├── .github └── workflows │ ├── sonatype.yaml │ ├── ci.yaml │ ├── sonar.yaml │ ├── site.yaml │ ├── coveralls.yaml │ └── codeql.yml ├── README.md └── bundle.xml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behaviour, in case users don't have core.autocrlf set. 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.mvn/maven.config: -------------------------------------------------------------------------------- 1 | -Daether.checksums.algorithms=SHA-512,SHA-256,SHA-1,MD5 2 | -Daether.connector.smartChecksums=false 3 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .factorypath 3 | .project 4 | .settings 5 | /target/ 6 | .github/keys/ 7 | .mvn/wrapper/maven-wrapper.jar 8 | pom.xml.releaseBackup 9 | release.properties 10 | ibderby/ 11 | derby.log 12 | -------------------------------------------------------------------------------- /LICENSE_HEADER: -------------------------------------------------------------------------------- 1 | Copyright ${license.git.copyrightYears} the original author or authors. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | https://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /src/test/resources/com/ibatis/common/resources/resourcestest.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2004-2022 the original author or authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | name=value 18 | name2=value2 19 | -------------------------------------------------------------------------------- /src/test/java/testdomain/DocType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | public enum DocType { 19 | BOOK, NEWSPAPER, BROADSHEET, MONOGRAPH 20 | } 21 | -------------------------------------------------------------------------------- /format.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/client/event/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * This package contains event handler interfaces. 18 | */ 19 | package com.ibatis.sqlmap.client.event; 20 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/client/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * This package contains the core library client interface. 18 | */ 19 | package com.ibatis.sqlmap.client; 20 | -------------------------------------------------------------------------------- /src/test/resources/com/ibatis/sqlmap/maps/OracleConfig.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2004-2022 the original author or authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | driver=oracle.jdbc.driver.OracleDriver 18 | url=jdbc:oracle:thin:@192.168.1.101:1521:oracle1 19 | username=jpetstore 20 | password=test 21 | -------------------------------------------------------------------------------- /.github/workflows/sonatype.yaml: -------------------------------------------------------------------------------- 1 | name: Sonatype 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | permissions: read-all 9 | 10 | jobs: 11 | build: 12 | if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]') 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v6 16 | - name: Set up JDK 17 | uses: actions/setup-java@v5 18 | with: 19 | cache: maven 20 | distribution: temurin 21 | java-version: 21 22 | - name: Deploy to Sonatype 23 | run: ./mvnw deploy -DskipTests -B -V --no-transfer-progress --settings ./.mvn/settings.xml -Dlicense.skip=true 24 | env: 25 | CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} 26 | CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} 27 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/DomTypeMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | /** 19 | * The Interface DomTypeMarker. 20 | */ 21 | public interface DomTypeMarker { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/SqlChild.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql; 17 | 18 | /** 19 | * The Interface SqlChild. 20 | */ 21 | public interface SqlChild { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/com/ibatis/sqlmap/maps/SqlMapConfig.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2004-2022 the original author or authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | driver=org.hsqldb.jdbcDriver 18 | url=jdbc:hsqldb:. 19 | username=sa 20 | password= 21 | 22 | SqlMapPath=com/ibatis/sqlmap/maps 23 | dataSourceType=SIMPLE 24 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/XmlTypeMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | /** 19 | * The Interface XmlTypeMarker. 20 | */ 21 | public interface XmlTypeMarker extends DomTypeMarker { 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/testdomain/SuperAccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | 20 | public class SuperAccount extends Account implements Serializable { 21 | private static final long serialVersionUID = 1L; 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/com/ibatis/sqlmap/maps/DerbySqlMapConfig.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2004-2022 the original author or authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | driver=org.apache.derby.jdbc.EmbeddedDriver 18 | url=jdbc:derby:ibderby;create=true 19 | username= 20 | password= 21 | 22 | SqlMapPath=com/ibatis/sqlmap/maps 23 | dataSourceType=SIMPLE 24 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/DomCollectionTypeMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | /** 19 | * The Interface DomCollectionTypeMarker. 20 | */ 21 | public interface DomCollectionTypeMarker extends DomTypeMarker { 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/engine/mapping/result/loader/test/Bean1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.result.loader.test; 17 | 18 | public class Bean1 { 19 | 20 | void defaultMethod() { 21 | // default-access method 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: [workflow_dispatch, push, pull_request] 4 | 5 | permissions: read-all 6 | 7 | jobs: 8 | test: 9 | runs-on: ${{ matrix.os }} 10 | strategy: 11 | matrix: 12 | cache: [maven] 13 | distribution: [temurin] 14 | java: [17, 21, 24, 25-ea] 15 | os: [ubuntu-latest, macos-latest, windows-latest] 16 | fail-fast: false 17 | max-parallel: 4 18 | name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} 19 | 20 | steps: 21 | - uses: actions/checkout@v6 22 | - name: Set up JDK ${{ matrix.java }} ${{ matrix.distribution }} 23 | uses: actions/setup-java@v5 24 | with: 25 | java-version: ${{ matrix.java }} 26 | distribution: ${{ matrix.distribution }} 27 | cache: ${{ matrix.cache }} 28 | - name: Test with Maven 29 | run: ./mvnw test -B -V --no-transfer-progress -D"license.skip=true" 30 | -------------------------------------------------------------------------------- /.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | fr.jcgay.maven 22 | maven-profiler 23 | 3.3 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/XmlCollectionTypeMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | /** 19 | * The Interface XmlCollectionTypeMarker. 20 | */ 21 | public interface XmlCollectionTypeMarker extends XmlTypeMarker, DomCollectionTypeMarker { 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/badbeans/GoodBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package badbeans; 17 | 18 | public class GoodBean { 19 | 20 | private String value; 21 | 22 | public String getValue() { 23 | return value; 24 | } 25 | 26 | public void setValue(String value) { 27 | this.value = value; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/testdomain/ISupplierKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | /** 19 | * Used in testing the ResultObjectFactory 20 | * 21 | * @author Jeff Butler 22 | */ 23 | public interface ISupplierKey { 24 | Integer getSupplierId(); 25 | 26 | void setSupplierId(Integer supplierId); 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/testdomain/PrivateBook.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | /** 19 | * Created by IntelliJ IDEA. User: cbegin Date: May 14, 2005 Time: 1:39:55 AM To change this template use File | 20 | * Settings | File Templates. 21 | */ 22 | public class PrivateBook extends Document { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/scripts/derby-proc-init.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright 2004-2023 the original author or authors. 3 | -- 4 | -- Licensed under the Apache License, Version 2.0 (the "License"); 5 | -- you may not use this file except in compliance with the License. 6 | -- You may obtain a copy of the License at 7 | -- 8 | -- https://www.apache.org/licenses/LICENSE-2.0 9 | -- 10 | -- Unless required by applicable law or agreed to in writing, software 11 | -- distributed under the License is distributed on an "AS IS" BASIS, 12 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | -- See the License for the specific language governing permissions and 14 | -- limitations under the License. 15 | -- 16 | 17 | DROP PROCEDURE MRESULTSET; 18 | 19 | CREATE PROCEDURE MRESULTSET(DP1 INTEGER, DP2 INTEGER, DP3 INTEGER, DP4 INTEGER) 20 | PARAMETER STYLE JAVA 21 | LANGUAGE JAVA 22 | READS SQL DATA 23 | DYNAMIC RESULT SETS 2 24 | EXTERNAL NAME 'com.ibatis.sqlmap.proc.DerbyProcs.selectRows'; 25 | -------------------------------------------------------------------------------- /src/test/java/badbeans/BeanWithDifferentTypeGetterSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package badbeans; 17 | 18 | public class BeanWithDifferentTypeGetterSetter { 19 | 20 | private String value; 21 | 22 | public String getValue() { 23 | return value; 24 | } 25 | 26 | public void setValue(Integer value) { 27 | this.value = value.toString(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.github/workflows/sonar.yaml: -------------------------------------------------------------------------------- 1 | name: SonarCloud 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | permissions: read-all 9 | 10 | jobs: 11 | build: 12 | if: github.repository_owner == 'mybatis' 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v6 16 | with: 17 | # Disabling shallow clone is recommended for improving relevancy of reporting 18 | fetch-depth: 0 19 | - name: Set up JDK 20 | uses: actions/setup-java@v5 21 | with: 22 | cache: maven 23 | distribution: temurin 24 | java-version: 21 25 | - name: Analyze with SonarCloud 26 | run: ./mvnw verify jacoco:report sonar:sonar -B -V -Dsonar.projectKey=mybatis_ibatis-2 -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN -Dlicense.skip=true --no-transfer-progress 27 | env: 28 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 29 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 30 | -------------------------------------------------------------------------------- /.github/workflows/site.yaml: -------------------------------------------------------------------------------- 1 | name: Site 2 | 3 | on: 4 | push: 5 | branches: 6 | - site 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | build: 13 | if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]') 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v6 17 | - name: Set up JDK 18 | uses: actions/setup-java@v5 19 | with: 20 | cache: maven 21 | distribution: temurin 22 | java-version: 21 23 | - name: Build site 24 | run: ./mvnw site site:stage -DskipTests -Dlicense.skip=true -B -V --no-transfer-progress --settings ./.mvn/settings.xml 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | NVD_API_KEY: ${{ secrets.NVD_API_KEY }} 28 | - name: Deploy Site to gh-pages 29 | uses: JamesIves/github-pages-deploy-action@v4 30 | with: 31 | branch: gh-pages 32 | folder: target/staging 33 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/config/SqlSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.config; 17 | 18 | import com.ibatis.sqlmap.engine.mapping.sql.Sql; 19 | 20 | /** 21 | * The Interface SqlSource. 22 | */ 23 | public interface SqlSource { 24 | 25 | /** 26 | * Gets the sql. 27 | * 28 | * @return the sql 29 | */ 30 | Sql getSql(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/engine/mapping/result/loader/test/Bean2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.result.loader.test; 17 | 18 | public class Bean2 { 19 | 20 | private Bean1 bean1; 21 | 22 | public void setBean1(Bean1 bean1) { 23 | this.bean1 = bean1; 24 | } 25 | 26 | public void testDefaultAccess() { 27 | bean1.defaultMethod(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/badbeans/BeanWithOverloadedSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package badbeans; 17 | 18 | public class BeanWithOverloadedSetter { 19 | 20 | private String value; 21 | 22 | public String getValue() { 23 | return value; 24 | } 25 | 26 | public void setValue(String value) { 27 | this.value = value; 28 | } 29 | 30 | public void setValue(Integer value) { 31 | this.value = value.toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/badbeans/BeanWithDifferentTypeOverloadedSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package badbeans; 17 | 18 | public class BeanWithDifferentTypeOverloadedSetter { 19 | 20 | private String value; 21 | 22 | public String getValue() { 23 | return value; 24 | } 25 | 26 | public void setValue(Double value) { 27 | this.value = value.toString(); 28 | } 29 | 30 | public void setValue(Integer value) { 31 | this.value = value.toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/com/ibatis/sqlmap/maps/Complex.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsEqualTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsEqualTagHandler. 20 | */ 21 | public class IsEqualTagHandler extends ConditionalTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | return compare(ctx, tag, parameterObject) == 0; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/engine/cache/fifo/FifoCacheControllerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.cache.fifo; 17 | 18 | import com.ibatis.sqlmap.engine.cache.CacheController; 19 | import com.ibatis.sqlmap.engine.cache.lru.LruCacheControllerTest; 20 | 21 | class FifoCacheControllerTest extends LruCacheControllerTest { 22 | 23 | @Override 24 | protected CacheController getController() { 25 | return new FifoCacheController(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/DynamicParent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | import com.ibatis.sqlmap.engine.mapping.sql.SqlChild; 19 | 20 | /** 21 | * The Interface DynamicParent. 22 | */ 23 | public interface DynamicParent { 24 | 25 | /** 26 | * Adds the child. 27 | * 28 | * @param child 29 | * the child 30 | */ 31 | void addChild(SqlChild child); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsNotNullTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsNotNullTagHandler. 20 | */ 21 | public class IsNotNullTagHandler extends IsNullTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | return !super.isCondition(ctx, tag, parameterObject); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/testdomain/ComplexBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | import java.util.Map; 20 | 21 | public class ComplexBean implements Serializable { 22 | 23 | private static final long serialVersionUID = 1L; 24 | private Map map; 25 | 26 | public Map getMap() { 27 | return map; 28 | } 29 | 30 | public void setMap(Map map) { 31 | this.map = map; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/testdomain/Magazine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | /** 19 | * Created by IntelliJ IDEA. User: cbegin Date: May 14, 2005 Time: 1:40:08 AM To change this template use File | 20 | * Settings | File Templates. 21 | */ 22 | public class Magazine extends Document { 23 | 24 | private String city; 25 | 26 | public String getCity() { 27 | return city; 28 | } 29 | 30 | public void setCity(String city) { 31 | this.city = city; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsNotEmptyTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsNotEmptyTagHandler. 20 | */ 21 | public class IsNotEmptyTagHandler extends IsEmptyTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | return !super.isCondition(ctx, tag, parameterObject); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsNotEqualTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsNotEqualTagHandler. 20 | */ 21 | public class IsNotEqualTagHandler extends IsEqualTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | return !super.isCondition(ctx, tag, parameterObject); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/testdomain/Book.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | /** 19 | * Created by IntelliJ IDEA. User: cbegin Date: May 14, 2005 Time: 1:39:55 AM To change this template use File | 20 | * Settings | File Templates. 21 | */ 22 | public class Book extends Document { 23 | 24 | private Integer pages; 25 | 26 | public Integer getPages() { 27 | return pages; 28 | } 29 | 30 | public void setPages(Integer pages) { 31 | this.pages = pages; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsParameterPresentTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsParameterPresentTagHandler. 20 | */ 21 | public class IsParameterPresentTagHandler extends ConditionalTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | return parameterObject != null; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/badbeans/BeanWithNoGetterOverloadedSetters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package badbeans; 17 | 18 | public class BeanWithNoGetterOverloadedSetters { 19 | 20 | // bad bean with no getter on purpose 21 | @SuppressWarnings("unused") 22 | private String value; 23 | 24 | public void setValue(String value) { 25 | this.value = value; 26 | } 27 | 28 | // Duplicate is on purpose 29 | public void setValue(Integer value) { 30 | this.value = value.toString(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=source 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip 20 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar 21 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/DynamicTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class DynamicTagHandler. 20 | */ 21 | public class DynamicTagHandler extends BaseTagHandler { 22 | 23 | @Override 24 | public int doStartFragment(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | ctx.pushRemoveFirstPrependMarker(tag); 26 | return SqlTagHandler.INCLUDE_BODY; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsNotParameterPresentTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsNotParameterPresentTagHandler. 20 | */ 21 | public class IsNotParameterPresentTagHandler extends IsParameterPresentTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | return !super.isCondition(ctx, tag, parameterObject); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsNotPropertyAvailableTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsNotPropertyAvailableTagHandler. 20 | */ 21 | public class IsNotPropertyAvailableTagHandler extends IsPropertyAvailableTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | return !super.isCondition(ctx, tag, parameterObject); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/BaseTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | /** 19 | * Base type handler for convenience. 20 | */ 21 | public abstract class BaseTypeHandler implements TypeHandler { 22 | 23 | @Override 24 | public boolean equals(Object object, String string) { 25 | if (object == null || string == null) { 26 | return object == string; 27 | } 28 | Object castedObject = valueOf(string); 29 | return object.equals(castedObject); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsLessThanTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsLessThanTagHandler. 20 | */ 21 | public class IsLessThanTagHandler extends ConditionalTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | long x = compare(ctx, tag, parameterObject); 26 | return x < 0 && x != ConditionalTagHandler.NOT_COMPARABLE; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /.github/workflows/coveralls.yaml: -------------------------------------------------------------------------------- 1 | name: Coveralls 2 | 3 | on: [push, pull_request] 4 | 5 | permissions: read-all 6 | 7 | jobs: 8 | build: 9 | if: github.repository_owner == 'mybatis' 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v6 13 | - name: Set up JDK 14 | uses: actions/setup-java@v5 15 | with: 16 | cache: maven 17 | distribution: temurin 18 | java-version: 21 19 | - name: Report Coverage to Coveralls for Pull Requests 20 | if: github.event_name == 'pull_request' 21 | run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --no-transfer-progress 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | PR_NUMBER: ${{ github.event.number }} 25 | - name: Report Coverage to Coveralls for General Push 26 | if: github.event_name == 'push' 27 | run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github --no-transfer-progress 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsLessEqualTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsLessEqualTagHandler. 20 | */ 21 | public class IsLessEqualTagHandler extends ConditionalTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | long x = compare(ctx, tag, parameterObject); 26 | return x <= 0 && x != ConditionalTagHandler.NOT_COMPARABLE; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsGreaterEqualTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsGreaterEqualTagHandler. 20 | */ 21 | public class IsGreaterEqualTagHandler extends ConditionalTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | long x = compare(ctx, tag, parameterObject); 26 | return x >= 0 && x != ConditionalTagHandler.NOT_COMPARABLE; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsGreaterThanTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | /** 19 | * The Class IsGreaterThanTagHandler. 20 | */ 21 | public class IsGreaterThanTagHandler extends ConditionalTagHandler { 22 | 23 | @Override 24 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 25 | long x = compare(ctx, tag, parameterObject); 26 | return x > 0 && x != ConditionalTagHandler.NOT_COMPARABLE; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/client/SqlMapSession.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.client; 17 | 18 | /** 19 | * A single threaded session for working with your SQL Maps. This interface inherits transaction control and execution 20 | * methods from the SqlMapTransactionManager and SqlMapExecutor interfaces. 21 | * 22 | * @see SqlMapClient 23 | * @see SqlMapSession 24 | * @see SqlMapExecutor 25 | */ 26 | public interface SqlMapSession extends SqlMapExecutor, SqlMapTransactionManager { 27 | 28 | /** 29 | * Closes the session. 30 | */ 31 | public void close(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/testdomain/ISupplierKeyImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | /** 19 | * Used in testing the ResultObjectFactory 20 | * 21 | * @author Jeff Butler 22 | */ 23 | public class ISupplierKeyImpl implements ISupplierKey { 24 | 25 | private Integer supplierId; 26 | 27 | /** 28 | * 29 | */ 30 | public ISupplierKeyImpl() { 31 | } 32 | 33 | @Override 34 | public Integer getSupplierId() { 35 | return supplierId; 36 | } 37 | 38 | @Override 39 | public void setSupplierId(Integer supplierId) { 40 | this.supplierId = supplierId; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/com/ibatis/sqlmap/maps/PrivateBook.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 22 | 23 | 24 | 25 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | schedule: 9 | - cron: '24 22 * * 5' 10 | 11 | jobs: 12 | analyze: 13 | name: Analyze 14 | runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} 15 | timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} 16 | permissions: 17 | security-events: write 18 | 19 | actions: read 20 | contents: read 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | language: [ 'java-kotlin' ] 26 | 27 | steps: 28 | - name: Checkout repository 29 | uses: actions/checkout@v6 30 | 31 | - name: Setup Java 32 | uses: actions/setup-java@v5 33 | with: 34 | distribution: 'temurin' 35 | java-version: 21 36 | 37 | - name: Initialize CodeQL 38 | uses: github/codeql-action/init@v4 39 | with: 40 | languages: ${{ matrix.language }} 41 | 42 | - name: Autobuild 43 | uses: github/codeql-action/autobuild@v4 44 | 45 | - name: Perform CodeQL Analysis 46 | uses: github/codeql-action/analyze@v4 47 | with: 48 | category: "/language:${{ matrix.language }}" 49 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/engine/cache/memory/MemoryCacheControllerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.cache.memory; 17 | 18 | import com.ibatis.sqlmap.engine.cache.CacheController; 19 | import com.ibatis.sqlmap.engine.cache.lru.LruCacheControllerTest; 20 | 21 | import org.junit.jupiter.api.Test; 22 | 23 | class MemoryCacheControllerTest extends LruCacheControllerTest { 24 | 25 | @Override 26 | protected CacheController getController() { 27 | return new MemoryCacheController(); 28 | } 29 | 30 | @Override 31 | @Test 32 | public void testSizeOne() { 33 | // This is not relevant for this model 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/testdomain/TopicDescription.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | 20 | public class TopicDescription implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private String description; 25 | 26 | /** 27 | * @return Returns the topicDescription. 28 | */ 29 | public String getDescription() { 30 | return description; 31 | } 32 | 33 | /** 34 | * @param topicDescription 35 | * The topicDescription to set. 36 | */ 37 | public void setDescription(String description) { 38 | this.description = description; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/xmltester/MiniAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package xmltester; 17 | 18 | public class MiniAttribute { 19 | 20 | private String name; 21 | private String value; 22 | 23 | public MiniAttribute() { 24 | } 25 | 26 | public MiniAttribute(String name, String value) { 27 | this.name = name; 28 | this.value = value; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | public String getValue() { 40 | return value; 41 | } 42 | 43 | public void setValue(String value) { 44 | this.value = value; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/datasource/SimpleDataSourceFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.datasource; 17 | 18 | import com.ibatis.common.jdbc.SimpleDataSource; 19 | 20 | import java.util.Map; 21 | 22 | import javax.sql.DataSource; 23 | 24 | /** 25 | * DataSourceFactory implementation for the iBATIS SimpleDataSource. 26 | */ 27 | public class SimpleDataSourceFactory implements DataSourceFactory { 28 | 29 | /** The data source. */ 30 | private DataSource dataSource; 31 | 32 | public void initialize(Map map) { 33 | dataSource = new SimpleDataSource(map); 34 | } 35 | 36 | public DataSource getDataSource() { 37 | return dataSource; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/datasource/DataSourceFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.datasource; 17 | 18 | import java.util.Map; 19 | 20 | import javax.sql.DataSource; 21 | 22 | /** 23 | * Interface to provide a way to create and configure a DataSource for iBATIS. 24 | */ 25 | public interface DataSourceFactory { 26 | 27 | /** 28 | * Simple method to initialize/configure a datasource. 29 | * 30 | * @param map 31 | * - the configuration information 32 | */ 33 | public void initialize(Map map); 34 | 35 | /** 36 | * Returns a datasource. 37 | * 38 | * @return an implementation of DataSource 39 | */ 40 | public DataSource getDataSource(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/threads/Foo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package threads; 17 | 18 | public class Foo { 19 | 20 | private String column1; 21 | 22 | private String column2; 23 | 24 | private String column3; 25 | 26 | public String getColumn1() { 27 | return this.column1; 28 | } 29 | 30 | public void setColumn1(String column1) { 31 | this.column1 = column1; 32 | } 33 | 34 | public String getColumn2() { 35 | return this.column2; 36 | } 37 | 38 | public void setColumn2(String column2) { 39 | this.column2 = column2; 40 | } 41 | 42 | public String getColumn3() { 43 | return this.column3; 44 | } 45 | 46 | public void setColumn3(String column3) { 47 | this.column3 = column3; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/datasource/DbcpDataSourceFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.datasource; 17 | 18 | import com.ibatis.common.jdbc.DbcpConfiguration; 19 | 20 | import java.util.Map; 21 | 22 | import javax.sql.DataSource; 23 | 24 | /** 25 | * DataSourceFactory implementation for DBCP. 26 | */ 27 | public class DbcpDataSourceFactory implements DataSourceFactory { 28 | 29 | /** The data source. */ 30 | private DataSource dataSource; 31 | 32 | public void initialize(Map map) { 33 | DbcpConfiguration dbcp = new DbcpConfiguration(map); 34 | dataSource = dbcp.getDataSource(); 35 | } 36 | 37 | public DataSource getDataSource() { 38 | return dataSource; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/accessplan/AccessPlan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.accessplan; 17 | 18 | /** 19 | * An interface to make access to resources consistent, regardless of type. 20 | */ 21 | public interface AccessPlan { 22 | 23 | /** 24 | * Sets all of the properties of a bean. 25 | * 26 | * @param object 27 | * - the bean 28 | * @param values 29 | * - the property values 30 | */ 31 | public void setProperties(Object object, Object[] values); 32 | 33 | /** 34 | * Gets all of the properties of a bean. 35 | * 36 | * @param object 37 | * - the bean 38 | * 39 | * @return the properties 40 | */ 41 | public Object[] getProperties(Object object); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/statement/ExecuteListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.statement; 17 | 18 | /** 19 | * The listener interface for receiving execute events. The class that is interested in processing a execute event 20 | * implements this interface, and the object created with that class is registered with a component using the 21 | * component's addExecuteListener method. When the execute event occurs, that object's appropriate method 22 | * is invoked. 23 | */ 24 | public interface ExecuteListener { 25 | 26 | /** 27 | * On execute statement. 28 | * 29 | * @param statement 30 | * the statement 31 | */ 32 | void onExecuteStatement(MappedStatement statement); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/statement/SelectStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.statement; 17 | 18 | import com.ibatis.sqlmap.engine.scope.StatementScope; 19 | import com.ibatis.sqlmap.engine.transaction.Transaction; 20 | 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * The Class SelectStatement. 25 | */ 26 | public class SelectStatement extends MappedStatement { 27 | 28 | @Override 29 | public StatementType getStatementType() { 30 | return StatementType.SELECT; 31 | } 32 | 33 | @Override 34 | public int executeUpdate(StatementScope statementScope, Transaction trans, Object parameterObject) 35 | throws SQLException { 36 | throw new SQLException("Select statements cannot be executed as an update."); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/engine/cache/CacheKeyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.cache; 17 | 18 | import static org.junit.jupiter.api.Assertions.assertTrue; 19 | 20 | import org.junit.jupiter.api.Test; 21 | 22 | /** 23 | * CacheKey Tester. 24 | * 25 | * @author 26 | * 27 | * @version 1.0 28 | * 29 | * @since 30 | * 31 | *
32 |  *        08 / 29 / 2006
33 |  *        
34 | */ 35 | class CacheKeyTest { 36 | 37 | @Test 38 | void testUpdate() { 39 | CacheKey key3 = new CacheKey(); 40 | 41 | CacheKey key4 = new CacheKey(); 42 | 43 | key3.update("AV"); 44 | 45 | key4.update("B7"); 46 | 47 | assertTrue(!key3.equals(key4)); 48 | assertTrue(!key3.toString().equals(key4.toString())); 49 | 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/test/resources/scripts/more-account-records.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright 2004-2022 the original author or authors. 3 | -- 4 | -- Licensed under the Apache License, Version 2.0 (the "License"); 5 | -- you may not use this file except in compliance with the License. 6 | -- You may obtain a copy of the License at 7 | -- 8 | -- https://www.apache.org/licenses/LICENSE-2.0 9 | -- 10 | -- Unless required by applicable law or agreed to in writing, software 11 | -- distributed under the License is distributed on an "AS IS" BASIS, 12 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | -- See the License for the specific language governing permissions and 14 | -- limitations under the License. 15 | -- 16 | 17 | DELETE ACCOUNT; 18 | 19 | INSERT INTO ACCOUNT VALUES(1,'Clinton', 'Begin', 'clinton.begin@ibatis.com'); 20 | INSERT INTO ACCOUNT VALUES(2,'Jim', 'Smith', 'jim.smith@somewhere.com'); 21 | INSERT INTO ACCOUNT VALUES(3,'Elizabeth', 'Jones', null); 22 | INSERT INTO ACCOUNT VALUES(4,'Bob', 'Jackson', 'bob.jackson@somewhere.com'); 23 | INSERT INTO ACCOUNT VALUES(5,'&manda', 'Goodman', null); 24 | INSERT INTO ACCOUNT VALUES(6,'Rick', 'Maximum', 'rick@ibatis.com'); 25 | INSERT INTO ACCOUNT VALUES(7,'Steve', 'Todor', 'steve@somewhere.com'); 26 | INSERT INTO ACCOUNT VALUES(8,'Elizabeth', 'Samson', null); 27 | INSERT INTO ACCOUNT VALUES(9,'Robert', 'Johnson', 'blahblah@somewhere.com'); 28 | INSERT INTO ACCOUNT VALUES(10,'June', 'Willis', null); 29 | 30 | -------------------------------------------------------------------------------- /src/test/java/testdomain/ProcBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | 20 | public class ProcBean implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private String email1; 25 | private String email2; 26 | private String status; 27 | 28 | public String getEmail1() { 29 | return email1; 30 | } 31 | 32 | public void setEmail1(String email1) { 33 | this.email1 = email1; 34 | } 35 | 36 | public String getEmail2() { 37 | return email2; 38 | } 39 | 40 | public void setEmail2(String email2) { 41 | this.email2 = email2; 42 | } 43 | 44 | public String getStatus() { 45 | return status; 46 | } 47 | 48 | public void setStatus(String status) { 49 | this.status = status; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/testdomain/SimpleNestedParameterObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.util.List; 19 | 20 | public class SimpleNestedParameterObject { 21 | 22 | private NestedIterateParameterObject nestedIterateParameterObject; 23 | private List nestedList; 24 | 25 | public List getNestedList() { 26 | return nestedList; 27 | } 28 | 29 | public void setNestedList(List nestedList) { 30 | this.nestedList = nestedList; 31 | } 32 | 33 | public NestedIterateParameterObject getNestedIterateParameterObject() { 34 | return nestedIterateParameterObject; 35 | } 36 | 37 | public void setNestedIterateParameterObject(NestedIterateParameterObject nestedIterateParameterObject) { 38 | this.nestedIterateParameterObject = nestedIterateParameterObject; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/scripts/person-init.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright 2004-2025 the original author or authors. 3 | -- 4 | -- Licensed under the Apache License, Version 2.0 (the "License"); 5 | -- you may not use this file except in compliance with the License. 6 | -- You may obtain a copy of the License at 7 | -- 8 | -- https://www.apache.org/licenses/LICENSE-2.0 9 | -- 10 | -- Unless required by applicable law or agreed to in writing, software 11 | -- distributed under the License is distributed on an "AS IS" BASIS, 12 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | -- See the License for the specific language governing permissions and 14 | -- limitations under the License. 15 | -- 16 | 17 | -- HSQL DATABASE 18 | 19 | -- Dropping Tables 20 | 21 | DROP TABLE PERSON; 22 | 23 | -- Creating Tables 24 | 25 | create table person ( 26 | id int not null, 27 | first_name char(50) not null, 28 | last_name char(50) not null, 29 | primary key (id) 30 | ); 31 | 32 | 33 | -- Creating Test Data 34 | 35 | insert into person values(1, 'Jeff', 'Jones'); 36 | insert into person values(2, 'Matt', 'Jones'); 37 | insert into person values(3, 'Amy', 'Jones'); 38 | insert into person values(4, 'Scott', 'Jones'); 39 | insert into person values(5, 'Wilma', 'Jones'); 40 | insert into person values(6, 'Fred', 'Jones'); 41 | insert into person values(7, 'Jeff', 'Smith'); 42 | insert into person values(8, 'Matt', 'Smith'); 43 | insert into person values(9, 'Amy', 'Smith'); 44 | -------------------------------------------------------------------------------- /src/test/resources/threads/sql-map-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/PrivateMethodAccessTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap; 17 | 18 | import static org.junit.jupiter.api.Assertions.assertEquals; 19 | import static org.junit.jupiter.api.Assertions.assertNotNull; 20 | 21 | import java.util.List; 22 | 23 | import org.junit.jupiter.api.BeforeEach; 24 | import org.junit.jupiter.api.Test; 25 | 26 | class PrivateMethodAccessTest extends BaseSqlMap { 27 | 28 | @BeforeEach 29 | void setUp() throws Exception { 30 | initSqlMap("com/ibatis/sqlmap/maps/SqlMapConfig.xml", null); 31 | initScript("scripts/docs-init.sql"); 32 | } 33 | 34 | @Test 35 | void testShouldSetPrivateProperties() throws Exception { 36 | List list = sqlMap.queryForList("getPrivateBooks"); 37 | assertNotNull(list); 38 | assertEquals(2, list.size()); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/logging/nologging/NoLoggingImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.logging.nologging; 17 | 18 | import com.ibatis.common.logging.Log; 19 | 20 | /** 21 | * The Class NoLoggingImpl. 22 | */ 23 | public class NoLoggingImpl implements Log { 24 | 25 | /** 26 | * Instantiates a new no logging impl. 27 | * 28 | * @param clazz 29 | * the clazz 30 | */ 31 | public NoLoggingImpl(Class clazz) { 32 | } 33 | 34 | @Override 35 | public boolean isDebugEnabled() { 36 | return false; 37 | } 38 | 39 | @Override 40 | public void error(String s, Throwable e) { 41 | } 42 | 43 | @Override 44 | public void error(String s) { 45 | } 46 | 47 | @Override 48 | public void debug(String s) { 49 | } 50 | 51 | @Override 52 | public void warn(String s) { 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/testdomain/ISupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | /** 19 | * Used in testing the ResultObjectFactory 20 | * 21 | * @author Jeff Butler 22 | */ 23 | public interface ISupplier extends ISupplierKey { 24 | 25 | String getAddressLine1(); 26 | 27 | void setAddressLine1(String addressLine1); 28 | 29 | String getAddressLine2(); 30 | 31 | void setAddressLine2(String addressLine2); 32 | 33 | String getCity(); 34 | 35 | void setCity(String city); 36 | 37 | String getName(); 38 | 39 | void setName(String name); 40 | 41 | String getPhone(); 42 | 43 | void setPhone(String phone); 44 | 45 | String getState(); 46 | 47 | void setState(String state); 48 | 49 | String getStatus(); 50 | 51 | void setStatus(String status); 52 | 53 | String getZip(); 54 | 55 | void setZip(String zip); 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/beans/Invoker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.beans; 17 | 18 | import java.lang.reflect.InvocationTargetException; 19 | 20 | /** 21 | * The Interface Invoker. 22 | */ 23 | public interface Invoker { 24 | 25 | /** 26 | * Gets the name. 27 | * 28 | * @return the name 29 | */ 30 | String getName(); 31 | 32 | /** 33 | * Invoke. 34 | * 35 | * @param target 36 | * the target 37 | * @param args 38 | * the args 39 | * 40 | * @return the object 41 | * 42 | * @throws IllegalAccessException 43 | * the illegal access exception 44 | * @throws InvocationTargetException 45 | * the invocation target exception 46 | */ 47 | Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException; 48 | } 49 | -------------------------------------------------------------------------------- /src/test/java/testdomain/PersonDocument.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | /** 19 | * @author Jeff Butler 20 | */ 21 | public class PersonDocument { 22 | 23 | private Integer id; 24 | private String name; 25 | private Document favoriteDocument; 26 | 27 | /** 28 | * 29 | */ 30 | public PersonDocument() { 31 | } 32 | 33 | public Document getFavoriteDocument() { 34 | return favoriteDocument; 35 | } 36 | 37 | public void setFavoriteDocument(Document favoriteDocument) { 38 | this.favoriteDocument = favoriteDocument; 39 | } 40 | 41 | public Integer getId() { 42 | return id; 43 | } 44 | 45 | public void setId(Integer id) { 46 | this.id = id; 47 | } 48 | 49 | public String getName() { 50 | return name; 51 | } 52 | 53 | public void setName(String name) { 54 | this.name = name; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/transaction/TransactionState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.transaction; 17 | 18 | /** 19 | * The Class TransactionState. 20 | */ 21 | public class TransactionState { 22 | 23 | /** The Constant STATE_STARTED. */ 24 | public static final TransactionState STATE_STARTED = new TransactionState(); 25 | 26 | /** The Constant STATE_COMMITTED. */ 27 | public static final TransactionState STATE_COMMITTED = new TransactionState(); 28 | 29 | /** The Constant STATE_ENDED. */ 30 | public static final TransactionState STATE_ENDED = new TransactionState(); 31 | 32 | /** The Constant STATE_USER_PROVIDED. */ 33 | public static final TransactionState STATE_USER_PROVIDED = new TransactionState(); 34 | 35 | /** 36 | * Instantiates a new transaction state. 37 | */ 38 | private TransactionState() { 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/logging/Log.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.logging; 17 | 18 | /** 19 | * The Interface Log. 20 | */ 21 | public interface Log { 22 | 23 | /** 24 | * Checks if is debug enabled. 25 | * 26 | * @return true, if is debug enabled 27 | */ 28 | boolean isDebugEnabled(); 29 | 30 | /** 31 | * Error. 32 | * 33 | * @param s 34 | * the s 35 | * @param e 36 | * the e 37 | */ 38 | void error(String s, Throwable e); 39 | 40 | /** 41 | * Error. 42 | * 43 | * @param s 44 | * the s 45 | */ 46 | void error(String s); 47 | 48 | /** 49 | * Debug. 50 | * 51 | * @param s 52 | * the s 53 | */ 54 | void debug(String s); 55 | 56 | /** 57 | * Warn. 58 | * 59 | * @param s 60 | * the s 61 | */ 62 | void warn(String s); 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/test/java/testdomain/Document.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.util.List; 19 | 20 | public class Document { 21 | 22 | private int id; 23 | private String title; 24 | private DocType type; 25 | private List attributes; 26 | 27 | public int getId() { 28 | return id; 29 | } 30 | 31 | public void setId(int id) { 32 | this.id = id; 33 | } 34 | 35 | public String getTitle() { 36 | return title; 37 | } 38 | 39 | public void setTitle(String title) { 40 | this.title = title; 41 | } 42 | 43 | public DocType getType() { 44 | return type; 45 | } 46 | 47 | public void setType(DocType type) { 48 | this.type = type; 49 | } 50 | 51 | public List getAttributes() { 52 | return attributes; 53 | } 54 | 55 | public void setAttributes(List attributes) { 56 | this.attributes = attributes; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/transaction/jdbc/JdbcTransactionConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.transaction.jdbc; 17 | 18 | import com.ibatis.sqlmap.engine.transaction.BaseTransactionConfig; 19 | import com.ibatis.sqlmap.engine.transaction.Transaction; 20 | import com.ibatis.sqlmap.engine.transaction.TransactionException; 21 | 22 | import java.sql.SQLException; 23 | import java.util.Properties; 24 | 25 | /** 26 | * The Class JdbcTransactionConfig. 27 | */ 28 | public class JdbcTransactionConfig extends BaseTransactionConfig { 29 | 30 | @Override 31 | public Transaction newTransaction(int transactionIsolation) throws SQLException, TransactionException { 32 | return new JdbcTransaction(dataSource, transactionIsolation); 33 | } 34 | 35 | @Override 36 | public void setProperties(Properties props) throws SQLException, TransactionException { 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/statement/DefaultRowHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.statement; 17 | 18 | import com.ibatis.sqlmap.client.event.RowHandler; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | /** 24 | * The Class DefaultRowHandler. 25 | */ 26 | public class DefaultRowHandler implements RowHandler { 27 | 28 | /** The list. */ 29 | private List list = new ArrayList<>(); 30 | 31 | @Override 32 | public void handleRow(Object valueObject) { 33 | list.add(valueObject); 34 | } 35 | 36 | /** 37 | * Gets the list. 38 | * 39 | * @return the list 40 | */ 41 | public List getList() { 42 | return list; 43 | } 44 | 45 | /** 46 | * Sets the list. 47 | * 48 | * @param list 49 | * the new list 50 | */ 51 | public void setList(List list) { 52 | this.list = list; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/DerbyParameterMapTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap; 17 | 18 | import static org.junit.jupiter.api.Assertions.assertTrue; 19 | 20 | import org.junit.jupiter.api.BeforeEach; 21 | 22 | /** 23 | * TestCase for validating PreparedStatement.setNull calls for Derby. See IBATIS-536 for more information. 24 | */ 25 | class DerbyParameterMapTest extends ParameterMapTest { 26 | 27 | // SETUP & TEARDOWN 28 | 29 | @Override 30 | @BeforeEach 31 | void setUp() throws Exception { 32 | initSqlMap("com/ibatis/sqlmap/maps/DerbySqlMapConfig.xml", null); 33 | initScript("scripts/account-init.sql"); 34 | } 35 | 36 | // PARAMETER MAP FEATURE TESTS 37 | 38 | @Override 39 | protected void assertMessageIsNullValueNotAllowed(String message) { 40 | assertTrue(message.indexOf("Column 'ACC_ID' cannot accept a NULL value.") > -1, "Invalid exception message"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/testdomain/MyBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * Created by IntelliJ IDEA. User: bgoodin Date: May 25, 2005 Time: 6:57:01 AM To change this template use File | 22 | * Settings | File Templates. 23 | */ 24 | public class MyBean { 25 | 26 | public List getMyList() { 27 | return myList; 28 | } 29 | 30 | public void setMyList(List myList) { 31 | this.myList = myList; 32 | } 33 | 34 | public Object[] getMyArray() { 35 | return myArray; 36 | } 37 | 38 | public void setMyArray(Object[] myArray) { 39 | this.myArray = myArray; 40 | } 41 | 42 | public int[] getIntArray() { 43 | return intArray; 44 | } 45 | 46 | public void setIntArray(int[] intArray) { 47 | this.intArray = intArray; 48 | } 49 | 50 | private List myList; 51 | private Object[] myArray; 52 | private int[] intArray; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Legacy iBATIS (aka MyBatis 2) maintenance repository 2 | ==================================================== 3 | 4 | [![Java CI](https://github.com/mybatis/ibatis-2/actions/workflows/ci.yaml/badge.svg)](https://github.com/mybatis/ibatis-2/actions/workflows/ci.yaml) 5 | [![Coverage Status](https://coveralls.io/repos/mybatis/ibatis-2/badge.svg?branch=master&service=github)](https://coveralls.io/github/mybatis/ibatis-2?branch=master) 6 | [![Maven central](https://maven-badges.herokuapp.com/maven-central/org.mybatis/mybatis2/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.mybatis/mybatis2) 7 | [![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/https/oss.sonatype.org/org.mybatis/mybatis2.svg)](https://oss.sonatype.org/content/repositories/snapshots/org/mybatis/mybatis2/) 8 | [![License](https://img.shields.io/:license-apache-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 9 | 10 | ![mybatis](https://mybatis.org/images/mybatis-logo.png) 11 | 12 | The MyBatis data mapper framework makes it easier to use a relational database with object-oriented applications. 13 | MyBatis couples objects with stored procedures or SQL statements using a XML descriptor or annotations. 14 | Simplicity is the biggest advantage of the MyBatis data mapper over object relational mapping tools. 15 | 16 | Users are advised to upgrade to myBatis 3. Both mybatis (ibatis) 2 and mybatis 3 can be used together. Changes to this repo will only be considered if small bug fixes. Given its widespread usage still, this repo will be kept alive as java conditions change as long as needed. 17 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/proc/DerbyProcs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.proc; 17 | 18 | import java.sql.Connection; 19 | import java.sql.DriverManager; 20 | import java.sql.PreparedStatement; 21 | import java.sql.ResultSet; 22 | import java.sql.SQLException; 23 | 24 | public class DerbyProcs { 25 | public static void selectRows(int p1, int p2, int p3, int p4, ResultSet[] rs1, ResultSet[] rs2) throws SQLException { 26 | Connection conn = DriverManager.getConnection("jdbc:default:connection"); 27 | PreparedStatement ps1 = conn.prepareStatement("select * from account where acc_id in (?,?)"); 28 | ps1.setInt(1, p1); 29 | ps1.setInt(2, p2); 30 | rs1[0] = ps1.executeQuery(); 31 | PreparedStatement ps2 = conn.prepareStatement("select * from account where acc_id in (?,?)"); 32 | ps2.setInt(1, p3); 33 | ps2.setInt(2, p4); 34 | rs2[0] = ps2.executeQuery(); 35 | conn.close(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /bundle.xml: -------------------------------------------------------------------------------- 1 | 18 | 21 | bundle 22 | 23 | zip 24 | 25 | 26 | 27 | target/${project.artifactId}-${project.version}.${project.packaging} 28 | 29 | 30 | target/${project.artifactId}-${project.version}-sources.${project.packaging} 31 | 32 | 33 | LICENSE 34 | 35 | 36 | NOTICE 37 | 38 | 39 | 40 | 41 | optional 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/beans/GetFieldInvoker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.beans; 17 | 18 | import java.lang.reflect.Field; 19 | import java.lang.reflect.InvocationTargetException; 20 | 21 | /** 22 | * The Class GetFieldInvoker. 23 | */ 24 | public class GetFieldInvoker implements Invoker { 25 | 26 | /** The field. */ 27 | private Field field; 28 | 29 | /** The name. */ 30 | private String name; 31 | 32 | /** 33 | * Instantiates a new gets the field invoker. 34 | * 35 | * @param field 36 | * the field 37 | */ 38 | public GetFieldInvoker(Field field) { 39 | this.field = field; 40 | this.name = "(" + field.getName() + ")"; 41 | } 42 | 43 | @Override 44 | public Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException { 45 | return field.get(target); 46 | } 47 | 48 | @Override 49 | public String getName() { 50 | return name; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsNullTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | import com.ibatis.common.beans.Probe; 19 | import com.ibatis.common.beans.ProbeFactory; 20 | 21 | /** 22 | * The Class IsNullTagHandler. 23 | */ 24 | public class IsNullTagHandler extends ConditionalTagHandler { 25 | 26 | /** The Constant PROBE. */ 27 | private static final Probe PROBE = ProbeFactory.getProbe(); 28 | 29 | @Override 30 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 31 | if (parameterObject == null) { 32 | return true; 33 | } else { 34 | String prop = getResolvedProperty(ctx, tag); 35 | Object value; 36 | if (prop != null) { 37 | value = PROBE.getObject(parameterObject, prop); 38 | } else { 39 | value = parameterObject; 40 | } 41 | return value == null; 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/beans/SetFieldInvoker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.beans; 17 | 18 | import java.lang.reflect.Field; 19 | import java.lang.reflect.InvocationTargetException; 20 | 21 | /** 22 | * The Class SetFieldInvoker. 23 | */ 24 | public class SetFieldInvoker implements Invoker { 25 | 26 | /** The field. */ 27 | private Field field; 28 | 29 | /** The name. */ 30 | private String name; 31 | 32 | /** 33 | * Instantiates a new sets the field invoker. 34 | * 35 | * @param field 36 | * the field 37 | */ 38 | public SetFieldInvoker(Field field) { 39 | this.field = field; 40 | this.name = "(" + field.getName() + ")"; 41 | } 42 | 43 | @Override 44 | public Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException { 45 | field.set(target, args[0]); 46 | return null; 47 | } 48 | 49 | @Override 50 | public String getName() { 51 | return name; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/testdomain/ArticleIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | import java.util.List; 20 | 21 | public class ArticleIndex implements Serializable { 22 | 23 | private static final long serialVersionUID = 1L; 24 | private String categoryTitle; 25 | private List topics; 26 | 27 | /** 28 | * @return Returns the categoryTitle. 29 | */ 30 | public String getCategoryTitle() { 31 | return categoryTitle; 32 | } 33 | 34 | /** 35 | * @param categoryTitle 36 | * The categoryTitle to set. 37 | */ 38 | public void setCategoryTitle(String categoryTitle) { 39 | this.categoryTitle = categoryTitle; 40 | } 41 | 42 | /** 43 | * @return Returns the topics. 44 | */ 45 | public List getTopics() { 46 | return topics; 47 | } 48 | 49 | /** 50 | * @param topics 51 | * The topics to set. 52 | */ 53 | public void setTopics(List topics) { 54 | this.topics = topics; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/statement/StatementType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.statement; 17 | 18 | /** 19 | * The Class StatementType. 20 | */ 21 | public final class StatementType { 22 | 23 | /** The Constant UNKNOWN. */ 24 | public static final StatementType UNKNOWN = new StatementType(); 25 | 26 | /** The Constant INSERT. */ 27 | public static final StatementType INSERT = new StatementType(); 28 | 29 | /** The Constant UPDATE. */ 30 | public static final StatementType UPDATE = new StatementType(); 31 | 32 | /** The Constant DELETE. */ 33 | public static final StatementType DELETE = new StatementType(); 34 | 35 | /** The Constant SELECT. */ 36 | public static final StatementType SELECT = new StatementType(); 37 | 38 | /** The Constant PROCEDURE. */ 39 | public static final StatementType PROCEDURE = new StatementType(); 40 | 41 | /** 42 | * Instantiates a new statement type. 43 | */ 44 | private StatementType() { 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/testdomain/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | public class Person { 19 | private Integer id; 20 | 21 | private String firstName; 22 | 23 | private String lastName; 24 | 25 | public String getFirstName() { 26 | return firstName; 27 | } 28 | 29 | public void setFirstName(String firstName) { 30 | this.firstName = firstName; 31 | } 32 | 33 | public Integer getId() { 34 | return id; 35 | } 36 | 37 | public void setId(Integer id) { 38 | this.id = id; 39 | } 40 | 41 | public String getLastName() { 42 | return lastName; 43 | } 44 | 45 | public void setLastName(String lastName) { 46 | this.lastName = lastName; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | StringBuilder sb = new StringBuilder(); 52 | sb.append("id: "); 53 | sb.append(id); 54 | sb.append(", firstName: "); 55 | sb.append(firstName); 56 | sb.append(", lastName: "); 57 | sb.append(lastName); 58 | 59 | return sb.toString(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/logging/log4j/Log4jImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.logging.log4j; 17 | 18 | import org.apache.log4j.Logger; 19 | 20 | /** 21 | * The Class Log4jImpl. 22 | */ 23 | public class Log4jImpl implements com.ibatis.common.logging.Log { 24 | 25 | /** The log. */ 26 | private Logger log; 27 | 28 | /** 29 | * Instantiates a new log 4 j impl. 30 | * 31 | * @param clazz 32 | * the clazz 33 | */ 34 | public Log4jImpl(Class clazz) { 35 | log = Logger.getLogger(clazz); 36 | } 37 | 38 | @Override 39 | public boolean isDebugEnabled() { 40 | return log.isDebugEnabled(); 41 | } 42 | 43 | @Override 44 | public void error(String s, Throwable e) { 45 | log.error(s, e); 46 | } 47 | 48 | @Override 49 | public void error(String s) { 50 | log.error(s); 51 | } 52 | 53 | @Override 54 | public void debug(String s) { 55 | log.debug(s); 56 | } 57 | 58 | @Override 59 | public void warn(String s) { 60 | log.warn(s); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/test/java/testdomain/Topic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | import java.util.List; 20 | 21 | public class Topic implements Serializable { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | private String topicTitle; 26 | private List descriptionList; 27 | 28 | /** 29 | * @return Returns the descriptionList. 30 | */ 31 | public List getDescriptionList() { 32 | return descriptionList; 33 | } 34 | 35 | /** 36 | * @param descriptionList 37 | * The descriptionList to set. 38 | */ 39 | public void setDescriptionList(List description) { 40 | this.descriptionList = description; 41 | } 42 | 43 | /** 44 | * @return Returns the topicTitle. 45 | */ 46 | public String getTopicTitle() { 47 | return topicTitle; 48 | } 49 | 50 | /** 51 | * @param topicTitle 52 | * The topicTitle to set. 53 | */ 54 | public void setTopicTitle(String topicTitle) { 55 | this.topicTitle = topicTitle; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/SimpleDateFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import com.ibatis.sqlmap.client.SqlMapException; 19 | 20 | import java.text.ParseException; 21 | import java.text.SimpleDateFormat; 22 | import java.util.Date; 23 | 24 | /** 25 | * The Class SimpleDateFormatter. 26 | */ 27 | public class SimpleDateFormatter { 28 | 29 | /** 30 | * Prevent instantiation. 31 | */ 32 | private SimpleDateFormatter() { 33 | // Prevent instantiation 34 | } 35 | 36 | /** 37 | * Format. 38 | * 39 | * @param format 40 | * the format 41 | * @param datetime 42 | * the datetime 43 | * 44 | * @return the date 45 | */ 46 | public static Date format(String format, String datetime) { 47 | try { 48 | return new SimpleDateFormat(format).parse(datetime); 49 | } catch (ParseException e) { 50 | throw new SqlMapException("Error parsing default null value date. Format must be '" + format + "'. Cause: " + e); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/test/resources/scripts/jira.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright 2004-2022 the original author or authors. 3 | -- 4 | -- Licensed under the Apache License, Version 2.0 (the "License"); 5 | -- you may not use this file except in compliance with the License. 6 | -- You may obtain a copy of the License at 7 | -- 8 | -- https://www.apache.org/licenses/LICENSE-2.0 9 | -- 10 | -- Unless required by applicable law or agreed to in writing, software 11 | -- distributed under the License is distributed on an "AS IS" BASIS, 12 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | -- See the License for the specific language governing permissions and 14 | -- limitations under the License. 15 | -- 16 | 17 | DROP TABLE ARTICLE_INDEX; 18 | 19 | CREATE TABLE ARTICLE_INDEX ( 20 | CATEGORY_ID INTEGER NOT NULL, 21 | CATEGORY_TITLE VARCHAR(32), 22 | TOPIC_TITLE VARCHAR(32), 23 | TOPIC_DESCRIPTION VARCHAR(80), 24 | PRIMARY KEY (CATEGORY_ID) 25 | ); 26 | 27 | INSERT INTO ARTICLE_INDEX VALUES (1, 'Health', 'Heart', 'Exercises for your heart'); 28 | INSERT INTO ARTICLE_INDEX VALUES (2, 'Health', 'Health', 'General health for people'); 29 | INSERT INTO ARTICLE_INDEX VALUES (3, 'Health', 'Love', 'How love affects your health1'); 30 | INSERT INTO ARTICLE_INDEX VALUES (4, 'Love', 'Heart', 'Language of the heart'); 31 | INSERT INTO ARTICLE_INDEX VALUES (5, 'Love', 'Health', 'How love affects your health2'); 32 | INSERT INTO ARTICLE_INDEX VALUES (6, 'Combat', 'Health', 'Staying alive in combat'); 33 | INSERT INTO ARTICLE_INDEX VALUES (7, 'Love', 'Love', 'Love is all around'); 34 | INSERT INTO ARTICLE_INDEX VALUES (8, 'Health', 'Heart', 'More Exercises for your heart'); 35 | -------------------------------------------------------------------------------- /src/test/java/threads/MyThread.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package threads; 17 | 18 | import com.ibatis.sqlmap.client.SqlMapClient; 19 | 20 | import java.sql.SQLException; 21 | import java.util.List; 22 | 23 | import org.junit.jupiter.api.Assertions; 24 | 25 | class MyThread extends Thread { 26 | 27 | private SqlMapClient sqlMap; 28 | private String remap; 29 | 30 | public MyThread(SqlMapClient sqlMap, String remap) { 31 | this.remap = remap; 32 | this.sqlMap = sqlMap; 33 | } 34 | 35 | @Override 36 | @SuppressWarnings("unchecked") 37 | public void run() { 38 | while (true) { 39 | try { 40 | List list = sqlMap.queryForList("selectFoo" + remap, null); 41 | Assertions.assertEquals(300, list.size()); 42 | check(list); 43 | } catch (SQLException e) { 44 | throw new RuntimeException(e); 45 | } 46 | } 47 | } 48 | 49 | private static void check(List list) { 50 | for (Foo foo : list) { 51 | if (foo == null) { 52 | Assertions.fail("list contained a null element"); 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/ResultObjectFactoryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap; 17 | 18 | import static org.junit.jupiter.api.Assertions.assertEquals; 19 | 20 | import java.util.List; 21 | 22 | import org.junit.jupiter.api.BeforeEach; 23 | import org.junit.jupiter.api.Test; 24 | 25 | import testdomain.IItem; 26 | 27 | class ResultObjectFactoryTest extends BaseSqlMap { 28 | 29 | @BeforeEach 30 | void setUp() throws Exception { 31 | initSqlMap("com/ibatis/sqlmap/maps/SqlMapConfig_rof.xml", null); 32 | initScript("scripts/jpetstore-hsqldb-schema.sql"); 33 | initScript("scripts/jpetstore-hsqldb-dataload.sql"); 34 | } 35 | 36 | /** 37 | * This tests that the result object factory is working - everything in the sql map is declared as an interface. 38 | */ 39 | @Test 40 | void testShouldDemonstrateThatTheObjectFactoryIsWorking() throws Exception { 41 | List results = sqlMap.queryForList("getAllItemsROF"); 42 | assertEquals(28, results.size()); 43 | assertEquals(Integer.valueOf(1), ((IItem) results.get(2)).getSupplier().getSupplierId()); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/test/resources/scripts/account-init.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright 2004-2022 the original author or authors. 3 | -- 4 | -- Licensed under the Apache License, Version 2.0 (the "License"); 5 | -- you may not use this file except in compliance with the License. 6 | -- You may obtain a copy of the License at 7 | -- 8 | -- https://www.apache.org/licenses/LICENSE-2.0 9 | -- 10 | -- Unless required by applicable law or agreed to in writing, software 11 | -- distributed under the License is distributed on an "AS IS" BASIS, 12 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | -- See the License for the specific language governing permissions and 14 | -- limitations under the License. 15 | -- 16 | 17 | -- HSQL DATABASE 18 | 19 | -- Dropping Tables 20 | 21 | DROP TABLE ACCOUNT; 22 | 23 | -- Creating Tables 24 | 25 | CREATE TABLE ACCOUNT ( 26 | ACC_ID INTEGER NOT NULL, 27 | ACC_FIRST_NAME VARCHAR(255) NOT NULL, 28 | ACC_LAST_NAME VARCHAR(255) NOT NULL, 29 | ACC_EMAIL VARCHAR(255), 30 | ACC_AGE NUMERIC, 31 | ACC_BANNER_OPTION VARCHAR(255), 32 | ACC_CART_OPTION INTEGER, 33 | ACC_DATE_ADDED DATE, 34 | PRIMARY KEY (ACC_ID) 35 | ); 36 | 37 | -- Creating Test Data 38 | 39 | INSERT INTO ACCOUNT VALUES(1,'Clinton', 'Begin', 'clinton.begin@ibatis.com', 1, 'Aye', 200, CURRENT_DATE); 40 | INSERT INTO ACCOUNT VALUES(2,'Jim', 'Smith', 'jim.smith@somewhere.com', 2, 'Aye', 200, CURRENT_DATE); 41 | INSERT INTO ACCOUNT VALUES(3,'Elizabeth', 'Jones', null, 3, 'Nay', 100, CURRENT_DATE); 42 | INSERT INTO ACCOUNT VALUES(4,'Bob', 'Jackson', 'bob.jackson@somewhere.com', 4, 'Nay', 100, CURRENT_DATE); 43 | INSERT INTO ACCOUNT VALUES(5,'&manda', 'Goodman', null, 5, 'Aye', 100, CURRENT_DATE); 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/beans/MethodInvoker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.beans; 17 | 18 | import java.lang.reflect.InvocationTargetException; 19 | import java.lang.reflect.Method; 20 | 21 | /** 22 | * The Class MethodInvoker. 23 | */ 24 | public class MethodInvoker implements Invoker { 25 | 26 | /** The method. */ 27 | private Method method; 28 | 29 | /** The name. */ 30 | private String name; 31 | 32 | /** 33 | * Instantiates a new method invoker. 34 | * 35 | * @param method 36 | * the method 37 | */ 38 | public MethodInvoker(Method method) { 39 | this.method = method; 40 | this.name = method.getName(); 41 | } 42 | 43 | @Override 44 | public Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException { 45 | return method.invoke(target, args); 46 | } 47 | 48 | /** 49 | * Gets the method. 50 | * 51 | * @return the method 52 | */ 53 | public Method getMethod() { 54 | return method; 55 | } 56 | 57 | @Override 58 | public String getName() { 59 | return name; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/xml/NodeletException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.xml; 17 | 18 | /** 19 | * The Class NodeletException. 20 | */ 21 | public class NodeletException extends Exception { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * Instantiates a new nodelet exception. 27 | */ 28 | public NodeletException() { 29 | super(); 30 | } 31 | 32 | /** 33 | * Instantiates a new nodelet exception. 34 | * 35 | * @param msg 36 | * the msg 37 | */ 38 | public NodeletException(String msg) { 39 | super(msg); 40 | } 41 | 42 | /** 43 | * Instantiates a new nodelet exception. 44 | * 45 | * @param cause 46 | * the cause 47 | */ 48 | public NodeletException(Throwable cause) { 49 | super(cause); 50 | } 51 | 52 | /** 53 | * Instantiates a new nodelet exception. 54 | * 55 | * @param msg 56 | * the msg 57 | * @param cause 58 | * the cause 59 | */ 60 | public NodeletException(String msg, Throwable cause) { 61 | super(msg, cause); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/accessplan/MapAccessPlan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.accessplan; 17 | 18 | import java.util.Map; 19 | 20 | /** 21 | * Access plan for working with Maps. 22 | */ 23 | public class MapAccessPlan extends BaseAccessPlan { 24 | 25 | /** 26 | * Instantiates a new map access plan. 27 | * 28 | * @param clazz 29 | * the clazz 30 | * @param propertyNames 31 | * the property names 32 | */ 33 | MapAccessPlan(Class clazz, String[] propertyNames) { 34 | super(clazz, propertyNames); 35 | } 36 | 37 | public void setProperties(Object object, Object[] values) { 38 | Map map = (Map) object; 39 | for (int i = 0; i < propertyNames.length; i++) { 40 | map.put(propertyNames[i], values[i]); 41 | } 42 | } 43 | 44 | public Object[] getProperties(Object object) { 45 | Object[] values = new Object[propertyNames.length]; 46 | Map map = (Map) object; 47 | for (int i = 0; i < propertyNames.length; i++) { 48 | values[i] = map.get(propertyNames[i]); 49 | } 50 | return values; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/parameter/NoParameterMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.parameter; 17 | 18 | import com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate; 19 | import com.ibatis.sqlmap.engine.scope.StatementScope; 20 | 21 | /** 22 | * The Class NoParameterMap. 23 | */ 24 | public class NoParameterMap extends ParameterMap { 25 | 26 | /** The Constant NO_PARAMETERS. */ 27 | private static final ParameterMapping[] NO_PARAMETERS = new ParameterMapping[0]; 28 | 29 | /** The Constant NO_DATA. */ 30 | private static final Object[] NO_DATA = new Object[0]; 31 | 32 | /** 33 | * Instantiates a new no parameter map. 34 | * 35 | * @param delegate 36 | * the delegate 37 | */ 38 | public NoParameterMap(SqlMapExecutorDelegate delegate) { 39 | super(delegate); 40 | } 41 | 42 | @Override 43 | public ParameterMapping[] getParameterMappings() { 44 | return NO_PARAMETERS; 45 | } 46 | 47 | @Override 48 | public Object[] getParameterObjectValues(StatementScope statementScope, Object parameterObject) { 49 | return NO_DATA; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/client/event/RowHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.client.event; 17 | 18 | /** 19 | * Event handler for row by row processing. 20 | *

21 | * The RowHandler interface is used by the SqlMapSession.queryWithRowHandler() method. Generally a RowHandler 22 | * implementation will perform some row-by-row processing logic in cases where there are too many rows to efficiently 23 | * load into memory. 24 | *

25 | * Example: 26 | * 27 | *

28 |  * sqlMap.queryWithRowHandler ("findAllEmployees", null, new MyRowHandler()));
29 |  * 
30 | */ 31 | public interface RowHandler { 32 | 33 | /** 34 | * Handles a single row of a result set. 35 | *

36 | * This method will be called for each row in a result set. For each row the result map will be applied to build the 37 | * value object, which is then passed in as the valueObject parameter. 38 | * 39 | * @param valueObject 40 | * The object representing a single row from the query. 41 | * 42 | * @see com.ibatis.sqlmap.client.SqlMapSession 43 | */ 44 | void handleRow(Object valueObject); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/accessplan/EnhancedPropertyAccessPlan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.accessplan; 17 | 18 | import net.sf.cglib.beans.BulkBean; 19 | 20 | /** 21 | * Enhanced PropertyAccessPlan (for working with beans using CG Lib). 22 | */ 23 | public class EnhancedPropertyAccessPlan extends BaseAccessPlan { 24 | 25 | /** The bulk bean. */ 26 | private BulkBean bulkBean; 27 | 28 | /** 29 | * Instantiates a new enhanced property access plan. 30 | * 31 | * @param clazz 32 | * the clazz 33 | * @param propertyNames 34 | * the property names 35 | */ 36 | EnhancedPropertyAccessPlan(Class clazz, String[] propertyNames) { 37 | super(clazz, propertyNames); 38 | bulkBean = BulkBean.create(clazz, getGetterNames(propertyNames), getSetterNames(propertyNames), 39 | getTypes(propertyNames)); 40 | } 41 | 42 | public void setProperties(Object object, Object[] values) { 43 | bulkBean.setPropertyValues(object, values); 44 | } 45 | 46 | public Object[] getProperties(Object object) { 47 | return bulkBean.getPropertyValues(object); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/test/resources/threads/Foo-sql-map.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 22 | 23 | 24 | 27 | select * from foo 28 | 29 | 30 | 31 | 34 | select * from foo 35 | 36 | 37 | 38 | drop table foo if exists; 39 | 40 | 41 | 42 | create table foo ( 43 | column1 varchar(50), 44 | column2 varchar(50), 45 | column3 varchar(50) 46 | ); 47 | 48 | 49 | 50 | insert into foo values ('a', 'a', 'a'); 51 | 52 | 53 | 54 | insert into foo values ('b', 'b', 'b'); 55 | 56 | 57 | 58 | insert into foo values ('c', 'c', 'c'); 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/ComplexTypeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap; 17 | 18 | import static org.junit.jupiter.api.Assertions.assertEquals; 19 | 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | import org.junit.jupiter.api.BeforeEach; 24 | import org.junit.jupiter.api.Test; 25 | 26 | import testdomain.ComplexBean; 27 | 28 | class ComplexTypeTest extends BaseSqlMap { 29 | 30 | // SETUP & TEARDOWN 31 | 32 | @BeforeEach 33 | void setUp() throws Exception { 34 | initSqlMap("com/ibatis/sqlmap/maps/SqlMapConfig.xml", null); 35 | initScript("scripts/account-init.sql"); 36 | initScript("scripts/order-init.sql"); 37 | initScript("scripts/line_item-init.sql"); 38 | } 39 | 40 | @Test 41 | void testMapBeanMap() throws Exception { 42 | Map map = new HashMap<>(); 43 | ComplexBean bean = new ComplexBean(); 44 | bean.setMap(new HashMap<>()); 45 | bean.getMap().put("id", Integer.valueOf(1)); 46 | map.put("bean", bean); 47 | 48 | Integer id = (Integer) sqlMap.queryForObject("mapBeanMap", map); 49 | 50 | assertEquals(id, bean.getMap().get("id")); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/logging/jakarta/JakartaCommonsLoggingImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.logging.jakarta; 17 | 18 | import org.apache.commons.logging.Log; 19 | import org.apache.commons.logging.LogFactory; 20 | 21 | /** 22 | * The Class JakartaCommonsLoggingImpl. 23 | */ 24 | public class JakartaCommonsLoggingImpl implements com.ibatis.common.logging.Log { 25 | 26 | /** The log. */ 27 | private Log log; 28 | 29 | /** 30 | * Instantiates a new jakarta commons logging impl. 31 | * 32 | * @param clazz 33 | * the clazz 34 | */ 35 | public JakartaCommonsLoggingImpl(Class clazz) { 36 | log = LogFactory.getLog(clazz); 37 | } 38 | 39 | @Override 40 | public boolean isDebugEnabled() { 41 | return log.isDebugEnabled(); 42 | } 43 | 44 | @Override 45 | public void error(String s, Throwable e) { 46 | log.error(s, e); 47 | } 48 | 49 | @Override 50 | public void error(String s) { 51 | log.error(s); 52 | } 53 | 54 | @Override 55 | public void debug(String s) { 56 | log.debug(s); 57 | } 58 | 59 | @Override 60 | public void warn(String s) { 61 | log.warn(s); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/logging/jdk14/Jdk14LoggingImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.logging.jdk14; 17 | 18 | import java.util.logging.Level; 19 | import java.util.logging.Logger; 20 | 21 | /** 22 | * The Class Jdk14LoggingImpl. 23 | */ 24 | public class Jdk14LoggingImpl implements com.ibatis.common.logging.Log { 25 | 26 | /** The log. */ 27 | private Logger log; 28 | 29 | /** 30 | * Instantiates a new jdk 14 logging impl. 31 | * 32 | * @param clazz 33 | * the clazz 34 | */ 35 | public Jdk14LoggingImpl(Class clazz) { 36 | log = Logger.getLogger(clazz.getName()); 37 | } 38 | 39 | @Override 40 | public boolean isDebugEnabled() { 41 | return log.isLoggable(Level.FINE); 42 | } 43 | 44 | @Override 45 | public void error(String s, Throwable e) { 46 | log.log(Level.SEVERE, s, e); 47 | } 48 | 49 | @Override 50 | public void error(String s) { 51 | log.log(Level.SEVERE, s); 52 | } 53 | 54 | @Override 55 | public void debug(String s) { 56 | log.log(Level.FINE, s); 57 | } 58 | 59 | @Override 60 | public void warn(String s) { 61 | log.log(Level.WARNING, s); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/test/java/testdomain/IItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.math.BigDecimal; 19 | 20 | /** 21 | * Used in testing the ResultObjectFactory 22 | * 23 | * @author Jeff Butler 24 | */ 25 | public interface IItem { 26 | String getAttribute1(); 27 | 28 | void setAttribute1(String attribute1); 29 | 30 | String getAttribute2(); 31 | 32 | void setAttribute2(String attribute2); 33 | 34 | String getAttribute3(); 35 | 36 | void setAttribute3(String attribute3); 37 | 38 | String getAttribute4(); 39 | 40 | void setAttribute4(String attribute4); 41 | 42 | String getAttribute5(); 43 | 44 | void setAttribute5(String attribute5); 45 | 46 | String getItemId(); 47 | 48 | void setItemId(String itemId); 49 | 50 | BigDecimal getListPrice(); 51 | 52 | void setListPrice(BigDecimal listPrice); 53 | 54 | String getProductId(); 55 | 56 | void setProductId(String productId); 57 | 58 | String getStatus(); 59 | 60 | void setStatus(String status); 61 | 62 | ISupplier getSupplier(); 63 | 64 | void setSupplier(ISupplier supplier); 65 | 66 | BigDecimal getUnitCost(); 67 | 68 | void setUnitCost(BigDecimal unitCost); 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/transaction/TransactionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.transaction; 17 | 18 | /** 19 | * The Class TransactionException. 20 | */ 21 | public class TransactionException extends Exception { 22 | 23 | /** The Constant serialVersionUID. */ 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * Instantiates a new transaction exception. 28 | */ 29 | public TransactionException() { 30 | } 31 | 32 | /** 33 | * Instantiates a new transaction exception. 34 | * 35 | * @param msg 36 | * the msg 37 | */ 38 | public TransactionException(String msg) { 39 | super(msg); 40 | } 41 | 42 | /** 43 | * Instantiates a new transaction exception. 44 | * 45 | * @param cause 46 | * the cause 47 | */ 48 | public TransactionException(Throwable cause) { 49 | super(cause); 50 | } 51 | 52 | /** 53 | * Instantiates a new transaction exception. 54 | * 55 | * @param msg 56 | * the msg 57 | * @param cause 58 | * the cause 59 | */ 60 | public TransactionException(String msg, Throwable cause) { 61 | super(msg, cause); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/test/java/testdomain/LineItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | import java.math.BigDecimal; 20 | 21 | public class LineItem implements Serializable { 22 | 23 | private static final long serialVersionUID = 1L; 24 | private int id; 25 | private int orderId; 26 | private String itemCode; 27 | private int quantity; 28 | private BigDecimal price; 29 | 30 | public int getId() { 31 | return id; 32 | } 33 | 34 | public void setId(int id) { 35 | this.id = id; 36 | } 37 | 38 | public int getOrderId() { 39 | return orderId; 40 | } 41 | 42 | public void setOrderId(int orderId) { 43 | this.orderId = orderId; 44 | } 45 | 46 | public String getItemCode() { 47 | return itemCode; 48 | } 49 | 50 | public void setItemCode(String itemCode) { 51 | this.itemCode = itemCode; 52 | } 53 | 54 | public int getQuantity() { 55 | return quantity; 56 | } 57 | 58 | public void setQuantity(int quantity) { 59 | this.quantity = quantity; 60 | } 61 | 62 | public BigDecimal getPrice() { 63 | return price; 64 | } 65 | 66 | public void setPrice(BigDecimal price) { 67 | this.price = price; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/testdomain/FieldAccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | 20 | public class FieldAccount implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | private int id; 24 | private String firstName; 25 | private String lastName; 26 | private String emailAddress; 27 | private FieldAccount account; 28 | 29 | public int id() { 30 | return id; 31 | } 32 | 33 | public void id(int id) { 34 | this.id = id; 35 | } 36 | 37 | public String firstName() { 38 | return firstName; 39 | } 40 | 41 | public void firstName(String firstName) { 42 | this.firstName = firstName; 43 | } 44 | 45 | public String lastName() { 46 | return lastName; 47 | } 48 | 49 | public void lastName(String lastName) { 50 | this.lastName = lastName; 51 | } 52 | 53 | public String emailAddress() { 54 | return emailAddress; 55 | } 56 | 57 | public void emailAddress(String emailAddress) { 58 | this.emailAddress = emailAddress; 59 | } 60 | 61 | public FieldAccount account() { 62 | return account; 63 | } 64 | 65 | public void account(FieldAccount account) { 66 | this.account = account; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /.mvn/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 21 | 22 | 23 | 24 | 25 | central 26 | ${env.CI_DEPLOY_USERNAME} 27 | ${env.CI_DEPLOY_PASSWORD} 28 | 29 | 30 | 31 | 32 | gh-pages-scm 33 | 34 | branch 35 | gh-pages 36 | 37 | 38 | 39 | 40 | 41 | github 42 | ${env.GITHUB_TOKEN} 43 | 44 | 45 | 46 | 47 | nvd 48 | ${env.NVD_API_KEY} 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/beans/ProbeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.beans; 17 | 18 | /** 19 | * BeansException for use for by BeanProbe and StaticBeanProbe. 20 | */ 21 | public class ProbeException extends RuntimeException { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * Default constructor. 27 | */ 28 | public ProbeException() { 29 | } 30 | 31 | /** 32 | * Constructor to set the message for the exception. 33 | * 34 | * @param msg 35 | * - the message for the exception 36 | */ 37 | public ProbeException(String msg) { 38 | super(msg); 39 | } 40 | 41 | /** 42 | * Constructor to create a nested exception. 43 | * 44 | * @param cause 45 | * - the reason the exception is being thrown 46 | */ 47 | public ProbeException(Throwable cause) { 48 | super(cause); 49 | } 50 | 51 | /** 52 | * Constructor to create a nested exception with a message. 53 | * 54 | * @param msg 55 | * - the message for the exception 56 | * @param cause 57 | * - the reason the exception is being thrown 58 | */ 59 | public ProbeException(String msg, Throwable cause) { 60 | super(msg, cause); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/xml/Nodelet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.xml; 17 | 18 | import org.w3c.dom.Node; 19 | 20 | /** 21 | * A nodelet is a sort of callback or event handler that can be registered to handle an XPath event registered with the 22 | * NodeParser. 23 | */ 24 | public interface Nodelet { 25 | 26 | /** 27 | * For a registered XPath, the NodeletParser will call the Nodelet's process method for processing. 28 | * 29 | * @param node 30 | * The node represents any XML node that can be registered under an XPath supported by the NodeletParser. 31 | * Possible nodes are: 32 | *

    33 | *
  • Text - Use node.getNodeValue() for the text value. 34 | *
  • Attribute - Use node.getNodeValue() for the attribute value. 35 | *
  • Element - This is the most flexible type. You can get the node content and iterate over the node's 36 | * child nodes if neccessary. This is useful where a single XPath registration cannot describe the complex 37 | * structure for a given XML stanza. 38 | *
39 | * 40 | * @throws Exception 41 | * the exception 42 | */ 43 | void process(Node node) throws Exception; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/accessplan/ComplexAccessPlan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.accessplan; 17 | 18 | import com.ibatis.common.beans.Probe; 19 | import com.ibatis.common.beans.ProbeFactory; 20 | 21 | /** 22 | * Access plan for working with beans. 23 | */ 24 | public class ComplexAccessPlan extends BaseAccessPlan { 25 | 26 | /** The Constant PROBE. */ 27 | private static final Probe PROBE = ProbeFactory.getProbe(); 28 | 29 | /** 30 | * Instantiates a new complex access plan. 31 | * 32 | * @param clazz 33 | * the clazz 34 | * @param propertyNames 35 | * the property names 36 | */ 37 | ComplexAccessPlan(Class clazz, String[] propertyNames) { 38 | super(clazz, propertyNames); 39 | } 40 | 41 | public void setProperties(Object object, Object[] values) { 42 | for (int i = 0; i < propertyNames.length; i++) { 43 | PROBE.setObject(object, propertyNames[i], values[i]); 44 | } 45 | } 46 | 47 | public Object[] getProperties(Object object) { 48 | Object[] values = new Object[propertyNames.length]; 49 | for (int i = 0; i < propertyNames.length; i++) { 50 | values[i] = PROBE.getObject(object, propertyNames[i]); 51 | } 52 | return values; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/resources/com/ibatis/sqlmap/maps/DerbyProc.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | 36 | 37 | {call MRESULTSET(#1#,#2#,#3#,#4#)} 38 | 39 | 40 | 41 | {call MRESULTSET(#1#,#2#,#3#,#4#)} 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/test/java/testdomain/Product.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | import java.util.List; 20 | 21 | public class Product implements Serializable { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | private String productId; 26 | private String categoryId; 27 | private String name; 28 | private String description; 29 | private List itemList; 30 | 31 | public String getProductId() { 32 | return productId; 33 | } 34 | 35 | public void setProductId(String productId) { 36 | this.productId = productId; 37 | } 38 | 39 | public String getCategoryId() { 40 | return categoryId; 41 | } 42 | 43 | public void setCategoryId(String categoryId) { 44 | this.categoryId = categoryId; 45 | } 46 | 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | public void setName(String name) { 52 | this.name = name; 53 | } 54 | 55 | public String getDescription() { 56 | return description; 57 | } 58 | 59 | public void setDescription(String description) { 60 | this.description = description; 61 | } 62 | 63 | public List getItemList() { 64 | return itemList; 65 | } 66 | 67 | public void setItemList(List itemList) { 68 | this.itemList = itemList; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsEmptyTagHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements; 17 | 18 | import com.ibatis.common.beans.Probe; 19 | import com.ibatis.common.beans.ProbeFactory; 20 | 21 | import java.lang.reflect.Array; 22 | import java.util.Collection; 23 | 24 | /** 25 | * The Class IsEmptyTagHandler. 26 | */ 27 | public class IsEmptyTagHandler extends ConditionalTagHandler { 28 | 29 | /** The Constant PROBE. */ 30 | private static final Probe PROBE = ProbeFactory.getProbe(); 31 | 32 | @Override 33 | public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) { 34 | if (parameterObject == null) { 35 | return true; 36 | } else { 37 | String prop = getResolvedProperty(ctx, tag); 38 | Object value; 39 | if (prop != null) { 40 | value = PROBE.getObject(parameterObject, prop); 41 | } else { 42 | value = parameterObject; 43 | } 44 | if (value instanceof Collection) { 45 | return ((Collection) value).isEmpty(); 46 | } else if (value != null && value.getClass().isArray()) { 47 | return Array.getLength(value) == 0; 48 | } else { 49 | return value == null || String.valueOf(value).equals(""); 50 | } 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/DirectFieldMappingTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap; 17 | 18 | import java.sql.SQLException; 19 | 20 | import org.junit.jupiter.api.BeforeEach; 21 | import org.junit.jupiter.api.Test; 22 | 23 | import testdomain.FieldAccount; 24 | import testdomain.PrivateAccount; 25 | 26 | class DirectFieldMappingTest extends BaseSqlMap { 27 | 28 | @BeforeEach 29 | void setUp() throws Exception { 30 | initSqlMap("com/ibatis/sqlmap/maps/SqlMapConfig.xml", null); 31 | initScript("scripts/account-init.sql"); 32 | } 33 | 34 | @Test 35 | void testInsertAndSelectDirectToFields() throws SQLException { 36 | FieldAccount account = newFieldAccount6(); 37 | 38 | sqlMap.insert("insertAccountFromFields", account); 39 | 40 | account = (FieldAccount) sqlMap.queryForObject("getAccountToFields", Integer.valueOf(6)); 41 | 42 | assertFieldAccount6(account); 43 | assertFieldAccount6(account.account()); 44 | } 45 | 46 | @Test 47 | void testGetAccountWithPrivateConstructor() throws SQLException { 48 | FieldAccount account = newFieldAccount6(); 49 | 50 | sqlMap.insert("insertAccountFromFields", account); 51 | 52 | PrivateAccount pvt = (PrivateAccount) sqlMap.queryForObject("getAccountWithPrivateConstructor", Integer.valueOf(6)); 53 | 54 | assertPrivateAccount6(pvt); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/test/java/testdomain/Category.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | import java.util.List; 20 | 21 | public class Category implements Serializable { 22 | 23 | private static final long serialVersionUID = 1L; 24 | private String categoryId; 25 | private Category parentCategory; 26 | private String name; 27 | private String description; 28 | private List productList; 29 | 30 | public String getCategoryId() { 31 | return categoryId; 32 | } 33 | 34 | public void setCategoryId(String categoryId) { 35 | this.categoryId = categoryId; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | public String getDescription() { 47 | return description; 48 | } 49 | 50 | public void setDescription(String description) { 51 | this.description = description; 52 | } 53 | 54 | public List getProductList() { 55 | return productList; 56 | } 57 | 58 | public void setProductList(List productList) { 59 | this.productList = productList; 60 | } 61 | 62 | public Category getParentCategory() { 63 | return parentCategory; 64 | } 65 | 66 | public void setParentCategory(Category parentCategory) { 67 | this.parentCategory = parentCategory; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/common/beans/ProbeFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.beans; 17 | 18 | /** 19 | * An abstract factory for getting Probe implementations. 20 | */ 21 | public class ProbeFactory { 22 | 23 | /** The Constant DOM. */ 24 | private static final Probe DOM = new DomProbe(); 25 | 26 | /** The Constant BEAN. */ 27 | private static final Probe BEAN = new ComplexBeanProbe(); 28 | 29 | /** The Constant GENERIC. */ 30 | private static final Probe GENERIC = new GenericProbe(); 31 | 32 | /** 33 | * Private constructor to prevent instantiation. 34 | */ 35 | private ProbeFactory() { 36 | // Prevent instantiation 37 | } 38 | 39 | /** 40 | * Factory method for getting a Probe object. 41 | * 42 | * @return An implementation of the Probe interface 43 | */ 44 | public static Probe getProbe() { 45 | return GENERIC; 46 | } 47 | 48 | /** 49 | * Factory method for getting a Probe object that is the best choice for the type of object supplied by the object 50 | * parameter. 51 | * 52 | * @param object 53 | * The object to get a Probe for 54 | * 55 | * @return An implementation of the Probe interface 56 | */ 57 | public static Probe getProbe(Object object) { 58 | if (object instanceof org.w3c.dom.Document) { 59 | return DOM; 60 | } 61 | return BEAN; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/stat/StaticSql.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.stat; 17 | 18 | import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap; 19 | import com.ibatis.sqlmap.engine.mapping.result.ResultMap; 20 | import com.ibatis.sqlmap.engine.mapping.sql.Sql; 21 | import com.ibatis.sqlmap.engine.scope.StatementScope; 22 | 23 | /** 24 | * The Class StaticSql. 25 | */ 26 | public class StaticSql implements Sql { 27 | 28 | /** The sql statement. */ 29 | private String sqlStatement; 30 | 31 | /** 32 | * Instantiates a new static sql. 33 | * 34 | * @param sqlStatement 35 | * the sql statement 36 | */ 37 | public StaticSql(String sqlStatement) { 38 | this.sqlStatement = sqlStatement.replace('\r', ' ').replace('\n', ' '); 39 | } 40 | 41 | @Override 42 | public String getSql(StatementScope statementScope, Object parameterObject) { 43 | return sqlStatement; 44 | } 45 | 46 | @Override 47 | public ParameterMap getParameterMap(StatementScope statementScope, Object parameterObject) { 48 | return statementScope.getParameterMap(); 49 | } 50 | 51 | @Override 52 | public ResultMap getResultMap(StatementScope statementScope, Object parameterObject) { 53 | return statementScope.getResultMap(); 54 | } 55 | 56 | @Override 57 | public void cleanup(StatementScope statementScope) { 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/ClobTypeHandlerCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import com.ibatis.sqlmap.client.extensions.ParameterSetter; 19 | import com.ibatis.sqlmap.client.extensions.ResultGetter; 20 | import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback; 21 | 22 | import java.io.StringReader; 23 | import java.sql.Clob; 24 | import java.sql.SQLException; 25 | import java.sql.Types; 26 | 27 | /** 28 | * The Class ClobTypeHandlerCallback. 29 | */ 30 | public class ClobTypeHandlerCallback implements TypeHandlerCallback { 31 | 32 | @Override 33 | public Object getResult(ResultGetter getter) throws SQLException { 34 | String value; 35 | Clob clob = getter.getClob(); 36 | if (!getter.wasNull()) { 37 | int size = (int) clob.length(); 38 | value = clob.getSubString(1, size); 39 | } else { 40 | value = null; 41 | } 42 | 43 | return value; 44 | } 45 | 46 | @Override 47 | public void setParameter(ParameterSetter setter, Object parameter) throws SQLException { 48 | String s = (String) parameter; 49 | if (s != null) { 50 | StringReader reader = new StringReader(s); 51 | setter.setCharacterStream(reader, s.length()); 52 | } else { 53 | setter.setNull(Types.CLOB); 54 | } 55 | } 56 | 57 | @Override 58 | public Object valueOf(String s) { 59 | return s; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/transaction/Transaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.transaction; 17 | 18 | import java.sql.Connection; 19 | import java.sql.SQLException; 20 | 21 | /** 22 | * The Interface Transaction. 23 | */ 24 | public interface Transaction { 25 | 26 | /** 27 | * Commit. 28 | * 29 | * @throws SQLException 30 | * the SQL exception 31 | * @throws TransactionException 32 | * the transaction exception 33 | */ 34 | void commit() throws SQLException, TransactionException; 35 | 36 | /** 37 | * Rollback. 38 | * 39 | * @throws SQLException 40 | * the SQL exception 41 | * @throws TransactionException 42 | * the transaction exception 43 | */ 44 | void rollback() throws SQLException, TransactionException; 45 | 46 | /** 47 | * Close. 48 | * 49 | * @throws SQLException 50 | * the SQL exception 51 | * @throws TransactionException 52 | * the transaction exception 53 | */ 54 | void close() throws SQLException, TransactionException; 55 | 56 | /** 57 | * Gets the connection. 58 | * 59 | * @return the connection 60 | * 61 | * @throws SQLException 62 | * the SQL exception 63 | * @throws TransactionException 64 | * the transaction exception 65 | */ 66 | Connection getConnection() throws SQLException, TransactionException; 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/BlobTypeHandlerCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import com.ibatis.sqlmap.client.extensions.ParameterSetter; 19 | import com.ibatis.sqlmap.client.extensions.ResultGetter; 20 | import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback; 21 | 22 | import java.io.ByteArrayInputStream; 23 | import java.sql.Blob; 24 | import java.sql.SQLException; 25 | import java.sql.Types; 26 | 27 | /** 28 | * The Class BlobTypeHandlerCallback. 29 | */ 30 | public class BlobTypeHandlerCallback implements TypeHandlerCallback { 31 | 32 | @Override 33 | public Object getResult(ResultGetter getter) throws SQLException { 34 | Blob blob = getter.getBlob(); 35 | byte[] returnValue; 36 | if (!getter.wasNull()) { 37 | returnValue = blob.getBytes(1, (int) blob.length()); 38 | } else { 39 | returnValue = null; 40 | } 41 | return returnValue; 42 | } 43 | 44 | @Override 45 | public void setParameter(ParameterSetter setter, Object parameter) throws SQLException { 46 | if (null != parameter) { 47 | byte[] bytes = (byte[]) parameter; 48 | ByteArrayInputStream bis = new ByteArrayInputStream(bytes); 49 | setter.setBinaryStream(bis, bytes.length); 50 | } else { 51 | setter.setNull(Types.BLOB); 52 | } 53 | } 54 | 55 | @Override 56 | public Object valueOf(String s) { 57 | return s; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/StringTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * String implementation of TypeHandler. 25 | */ 26 | public class StringTypeHandler extends BaseTypeHandler implements TypeHandler { 27 | 28 | @Override 29 | public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException { 30 | ps.setString(i, (String) parameter); 31 | } 32 | 33 | @Override 34 | public Object getResult(ResultSet rs, String columnName) throws SQLException { 35 | Object s = rs.getString(columnName); 36 | if (rs.wasNull()) { 37 | return null; 38 | } 39 | return s; 40 | } 41 | 42 | @Override 43 | public Object getResult(ResultSet rs, int columnIndex) throws SQLException { 44 | Object s = rs.getString(columnIndex); 45 | if (rs.wasNull()) { 46 | return null; 47 | } 48 | return s; 49 | } 50 | 51 | @Override 52 | public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { 53 | Object s = cs.getString(columnIndex); 54 | if (cs.wasNull()) { 55 | return null; 56 | } 57 | return s; 58 | } 59 | 60 | @Override 61 | public Object valueOf(String s) { 62 | return s; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/ObjectTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * Object implementation of TypeHandler. 25 | */ 26 | public class ObjectTypeHandler extends BaseTypeHandler implements TypeHandler { 27 | 28 | @Override 29 | public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException { 30 | ps.setObject(i, parameter); 31 | } 32 | 33 | @Override 34 | public Object getResult(ResultSet rs, String columnName) throws SQLException { 35 | Object object = rs.getObject(columnName); 36 | if (rs.wasNull()) { 37 | return null; 38 | } 39 | return object; 40 | } 41 | 42 | @Override 43 | public Object getResult(ResultSet rs, int columnIndex) throws SQLException { 44 | Object object = rs.getObject(columnIndex); 45 | if (rs.wasNull()) { 46 | return null; 47 | } 48 | return object; 49 | } 50 | 51 | @Override 52 | public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { 53 | Object object = cs.getObject(columnIndex); 54 | if (cs.wasNull()) { 55 | return null; 56 | } 57 | return object; 58 | } 59 | 60 | @Override 61 | public Object valueOf(String s) { 62 | return s; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/sql/raw/RawSql.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.sql.raw; 17 | 18 | import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap; 19 | import com.ibatis.sqlmap.engine.mapping.result.ResultMap; 20 | import com.ibatis.sqlmap.engine.mapping.sql.Sql; 21 | import com.ibatis.sqlmap.engine.scope.StatementScope; 22 | 23 | /** 24 | * A non-executable SQL container simply for communicating raw SQL around the framework. 25 | */ 26 | public class RawSql implements Sql { 27 | 28 | /** The sql. */ 29 | private String sql; 30 | 31 | /** 32 | * Instantiates a new raw sql. 33 | * 34 | * @param sql 35 | * the sql 36 | */ 37 | public RawSql(String sql) { 38 | this.sql = sql; 39 | } 40 | 41 | @Override 42 | public String getSql(StatementScope statementScope, Object parameterObject) { 43 | return sql; 44 | } 45 | 46 | @Override 47 | public ParameterMap getParameterMap(StatementScope statementScope, Object parameterObject) { 48 | throw new RuntimeException("Method not implemented on RawSql."); 49 | } 50 | 51 | @Override 52 | public ResultMap getResultMap(StatementScope statementScope, Object parameterObject) { 53 | throw new RuntimeException("Method not implemented on RawSql."); 54 | } 55 | 56 | @Override 57 | public void cleanup(StatementScope statementScope) { 58 | throw new RuntimeException("Method not implemented on RawSql."); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/ByteArrayTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * byte[] implementation of TypeHandler. 25 | */ 26 | public class ByteArrayTypeHandler extends BaseTypeHandler implements TypeHandler { 27 | 28 | @Override 29 | public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException { 30 | ps.setBytes(i, (byte[]) parameter); 31 | } 32 | 33 | @Override 34 | public Object getResult(ResultSet rs, String columnName) throws SQLException { 35 | Object bytes = rs.getBytes(columnName); 36 | if (rs.wasNull()) { 37 | return null; 38 | } 39 | return bytes; 40 | } 41 | 42 | @Override 43 | public Object getResult(ResultSet rs, int columnIndex) throws SQLException { 44 | Object bytes = rs.getBytes(columnIndex); 45 | if (rs.wasNull()) { 46 | return null; 47 | } 48 | return bytes; 49 | } 50 | 51 | @Override 52 | public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { 53 | Object bytes = cs.getBytes(columnIndex); 54 | if (cs.wasNull()) { 55 | return null; 56 | } 57 | return bytes; 58 | } 59 | 60 | @Override 61 | public Object valueOf(String s) { 62 | return s.getBytes(); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/common/beans/ComplexBeanProbeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.common.beans; 17 | 18 | import static org.junit.jupiter.api.Assertions.assertEquals; 19 | import static org.junit.jupiter.api.Assertions.assertTrue; 20 | import static org.junit.jupiter.api.Assertions.fail; 21 | 22 | import org.junit.jupiter.api.Test; 23 | 24 | class ComplexBeanProbeTest { 25 | 26 | @Test 27 | void testSetObject() { 28 | SimpleClass mySimpleClass = new SimpleClass(); 29 | Probe probe = ProbeFactory.getProbe(mySimpleClass); 30 | probe.setObject(mySimpleClass, "myInt", Integer.valueOf(1)); 31 | assertEquals(1, mySimpleClass.getMyInt()); 32 | probe.setObject(mySimpleClass, "myInt", Integer.valueOf(2)); 33 | assertEquals(2, mySimpleClass.getMyInt()); 34 | try { 35 | probe.setObject(mySimpleClass, "myInt", null); 36 | fail(); 37 | } catch (RuntimeException e) { 38 | assertTrue(e.getMessage().contains("'myInt' to value 'null'")); 39 | } 40 | try { 41 | probe.setObject(mySimpleClass, "myInt", Float.valueOf(1.2f)); 42 | fail(); 43 | } catch (RuntimeException e) { 44 | assertTrue(e.getMessage().contains("'myInt' to value '1.2'")); 45 | } 46 | } 47 | 48 | public class SimpleClass { 49 | 50 | int myInt; 51 | 52 | public int getMyInt() { 53 | return myInt; 54 | } 55 | 56 | public void setMyInt(int myInt) { 57 | this.myInt = myInt; 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/test/java/com/ibatis/sqlmap/engine/builder/xml/SqlMapConfigParserTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.builder.xml; 17 | 18 | import com.ibatis.common.resources.Resources; 19 | 20 | import java.io.IOException; 21 | import java.io.InputStreamReader; 22 | 23 | import org.junit.jupiter.api.Assertions; 24 | import org.junit.jupiter.api.Test; 25 | 26 | class SqlMapConfigParserTest { 27 | @Test 28 | void parseStream() throws IOException { 29 | SqlMapConfigParser parser = new SqlMapConfigParser(); 30 | var stream = Resources.getResourceAsStream("com/ibatis/sqlmap/maps/SqlMapConfig.xml"); 31 | final var sqlMapClient = parser.parse(stream); // fails 32 | 33 | Assertions.assertNotNull(sqlMapClient); 34 | } 35 | 36 | @Test 37 | void parseStreamToReader() throws IOException { 38 | SqlMapConfigParser parser = new SqlMapConfigParser(); 39 | var stream = Resources.getResourceAsStream("com/ibatis/sqlmap/maps/SqlMapConfig.xml"); 40 | var reader = new InputStreamReader(stream); 41 | final var sqlMapClient = parser.parse(reader); 42 | 43 | Assertions.assertNotNull(sqlMapClient); 44 | } 45 | 46 | @Test 47 | void parseReader() throws IOException { 48 | SqlMapConfigParser parser = new SqlMapConfigParser(); 49 | var reader = Resources.getResourceAsReader("com/ibatis/sqlmap/maps/SqlMapConfig.xml"); 50 | final var sqlMapClient = parser.parse(reader); 51 | 52 | Assertions.assertNotNull(sqlMapClient); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/statement/DeleteStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.statement; 17 | 18 | import com.ibatis.sqlmap.client.event.RowHandler; 19 | import com.ibatis.sqlmap.engine.scope.StatementScope; 20 | import com.ibatis.sqlmap.engine.transaction.Transaction; 21 | 22 | import java.sql.SQLException; 23 | import java.util.List; 24 | 25 | /** 26 | * The Class DeleteStatement. 27 | */ 28 | public class DeleteStatement extends MappedStatement { 29 | 30 | @Override 31 | public StatementType getStatementType() { 32 | return StatementType.DELETE; 33 | } 34 | 35 | @Override 36 | public Object executeQueryForObject(StatementScope statementScope, Transaction trans, Object parameterObject, 37 | Object resultObject) throws SQLException { 38 | throw new SQLException("Delete statements cannot be executed as a query."); 39 | } 40 | 41 | @Override 42 | public List executeQueryForList(StatementScope statementScope, Transaction trans, Object parameterObject, 43 | int skipResults, int maxResults) throws SQLException { 44 | throw new SQLException("Delete statements cannot be executed as a query."); 45 | } 46 | 47 | @Override 48 | public void executeQueryWithRowHandler(StatementScope statementScope, Transaction trans, Object parameterObject, 49 | RowHandler rowHandler) throws SQLException { 50 | throw new SQLException("Delete statements cannot be executed as a query."); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/mapping/statement/UpdateStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.mapping.statement; 17 | 18 | import com.ibatis.sqlmap.client.event.RowHandler; 19 | import com.ibatis.sqlmap.engine.scope.StatementScope; 20 | import com.ibatis.sqlmap.engine.transaction.Transaction; 21 | 22 | import java.sql.SQLException; 23 | import java.util.List; 24 | 25 | /** 26 | * The Class UpdateStatement. 27 | */ 28 | public class UpdateStatement extends MappedStatement { 29 | 30 | @Override 31 | public StatementType getStatementType() { 32 | return StatementType.UPDATE; 33 | } 34 | 35 | @Override 36 | public Object executeQueryForObject(StatementScope statementScope, Transaction trans, Object parameterObject, 37 | Object resultObject) throws SQLException { 38 | throw new SQLException("Update statements cannot be executed as a query."); 39 | } 40 | 41 | @Override 42 | public List executeQueryForList(StatementScope statementScope, Transaction trans, Object parameterObject, 43 | int skipResults, int maxResults) throws SQLException { 44 | throw new SQLException("Update statements cannot be executed as a query."); 45 | } 46 | 47 | @Override 48 | public void executeQueryWithRowHandler(StatementScope statementScope, Transaction trans, Object parameterObject, 49 | RowHandler rowHandler) throws SQLException { 50 | throw new SQLException("Update statements cannot be executed as a query."); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/ByteTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * Byte implementation of TypeHandler. 25 | */ 26 | public class ByteTypeHandler extends BaseTypeHandler implements TypeHandler { 27 | 28 | @Override 29 | public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException { 30 | ps.setByte(i, ((Byte) parameter).byteValue()); 31 | } 32 | 33 | @Override 34 | public Object getResult(ResultSet rs, String columnName) throws SQLException { 35 | byte b = rs.getByte(columnName); 36 | if (rs.wasNull()) { 37 | return null; 38 | } 39 | return Byte.valueOf(b); 40 | } 41 | 42 | @Override 43 | public Object getResult(ResultSet rs, int columnIndex) throws SQLException { 44 | byte b = rs.getByte(columnIndex); 45 | if (rs.wasNull()) { 46 | return null; 47 | } 48 | return Byte.valueOf(b); 49 | } 50 | 51 | @Override 52 | public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { 53 | byte b = cs.getByte(columnIndex); 54 | if (cs.wasNull()) { 55 | return null; 56 | } 57 | return Byte.valueOf(b); 58 | } 59 | 60 | @Override 61 | public Object valueOf(String s) { 62 | return Byte.valueOf(s); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/LongTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * Long implementation of TypeHandler. 25 | */ 26 | public class LongTypeHandler extends BaseTypeHandler implements TypeHandler { 27 | 28 | @Override 29 | public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException { 30 | ps.setLong(i, ((Long) parameter).longValue()); 31 | } 32 | 33 | @Override 34 | public Object getResult(ResultSet rs, String columnName) throws SQLException { 35 | long l = rs.getLong(columnName); 36 | if (rs.wasNull()) { 37 | return null; 38 | } 39 | return Long.valueOf(l); 40 | } 41 | 42 | @Override 43 | public Object getResult(ResultSet rs, int columnIndex) throws SQLException { 44 | long l = rs.getLong(columnIndex); 45 | if (rs.wasNull()) { 46 | return null; 47 | } 48 | return Long.valueOf(l); 49 | } 50 | 51 | @Override 52 | public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { 53 | long l = cs.getLong(columnIndex); 54 | if (cs.wasNull()) { 55 | return null; 56 | } 57 | return Long.valueOf(l); 58 | } 59 | 60 | @Override 61 | public Object valueOf(String s) { 62 | return Long.valueOf(s); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/test/resources/com/ibatis/sqlmap/maps/OracleProc.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {call swap_email_address (?, ?, ?)} 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | {call swap_email_address (?, ?, ?)} 43 | 44 | 45 | 46 | {call no_param_proc ()} 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/test/java/testdomain/ArticleIndexDenorm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package testdomain; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * Denormalized version of an toy ArticleIndex object. 22 | */ 23 | public class ArticleIndexDenorm implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | private String categoryTitle; 27 | 28 | private String topicTitle; 29 | 30 | private String description; 31 | 32 | /** 33 | * @return Returns the categoryTitle. 34 | */ 35 | public String getCategoryTitle() { 36 | return categoryTitle; 37 | } 38 | 39 | /** 40 | * @param categoryTitle 41 | * The categoryTitle to set. 42 | */ 43 | public void setCategoryTitle(String categoryTitle) { 44 | this.categoryTitle = categoryTitle; 45 | } 46 | 47 | /** 48 | * @return Returns the description. 49 | */ 50 | public String getDescription() { 51 | return description; 52 | } 53 | 54 | /** 55 | * @param description 56 | * The description to set. 57 | */ 58 | public void setDescription(String description) { 59 | this.description = description; 60 | } 61 | 62 | /** 63 | * @return Returns the topicTitle. 64 | */ 65 | public String getTopicTitle() { 66 | return topicTitle; 67 | } 68 | 69 | /** 70 | * @param topicTitle 71 | * The topicTitle to set. 72 | */ 73 | public void setTopicTitle(String topicTitle) { 74 | this.topicTitle = topicTitle; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/FloatTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * Float implementation of TypeHandler. 25 | */ 26 | public class FloatTypeHandler extends BaseTypeHandler implements TypeHandler { 27 | 28 | @Override 29 | public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException { 30 | ps.setFloat(i, ((Float) parameter).floatValue()); 31 | } 32 | 33 | @Override 34 | public Object getResult(ResultSet rs, String columnName) throws SQLException { 35 | float f = rs.getFloat(columnName); 36 | if (rs.wasNull()) { 37 | return null; 38 | } 39 | return Float.valueOf(f); 40 | } 41 | 42 | @Override 43 | public Object getResult(ResultSet rs, int columnIndex) throws SQLException { 44 | float f = rs.getFloat(columnIndex); 45 | if (rs.wasNull()) { 46 | return null; 47 | } 48 | return Float.valueOf(f); 49 | } 50 | 51 | @Override 52 | public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { 53 | float f = cs.getFloat(columnIndex); 54 | if (cs.wasNull()) { 55 | return null; 56 | } 57 | return Float.valueOf(f); 58 | } 59 | 60 | @Override 61 | public Object valueOf(String s) { 62 | return Float.valueOf(s); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/ShortTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * Short implementation of TypeHandler. 25 | */ 26 | public class ShortTypeHandler extends BaseTypeHandler implements TypeHandler { 27 | 28 | @Override 29 | public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException { 30 | ps.setShort(i, ((Short) parameter).shortValue()); 31 | } 32 | 33 | @Override 34 | public Object getResult(ResultSet rs, String columnName) throws SQLException { 35 | short s = rs.getShort(columnName); 36 | if (rs.wasNull()) { 37 | return null; 38 | } 39 | return Short.valueOf(s); 40 | } 41 | 42 | @Override 43 | public Object getResult(ResultSet rs, int columnIndex) throws SQLException { 44 | short s = rs.getShort(columnIndex); 45 | if (rs.wasNull()) { 46 | return null; 47 | } 48 | return Short.valueOf(s); 49 | } 50 | 51 | @Override 52 | public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { 53 | short s = cs.getShort(columnIndex); 54 | if (cs.wasNull()) { 55 | return null; 56 | } 57 | return Short.valueOf(s); 58 | } 59 | 60 | @Override 61 | public Object valueOf(String s) { 62 | return Short.valueOf(s); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/exchange/BaseDataExchange.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.exchange; 17 | 18 | import com.ibatis.sqlmap.engine.cache.CacheKey; 19 | import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap; 20 | import com.ibatis.sqlmap.engine.scope.StatementScope; 21 | 22 | /** 23 | * Base implementation for the DataExchange interface. 24 | */ 25 | public abstract class BaseDataExchange implements DataExchange { 26 | 27 | /** The data exchange factory. */ 28 | private DataExchangeFactory dataExchangeFactory; 29 | 30 | /** 31 | * Instantiates a new base data exchange. 32 | * 33 | * @param dataExchangeFactory 34 | * the data exchange factory 35 | */ 36 | protected BaseDataExchange(DataExchangeFactory dataExchangeFactory) { 37 | this.dataExchangeFactory = dataExchangeFactory; 38 | } 39 | 40 | public CacheKey getCacheKey(StatementScope statementScope, ParameterMap parameterMap, Object parameterObject) { 41 | CacheKey key = new CacheKey(); 42 | Object[] data = getData(statementScope, parameterMap, parameterObject); 43 | for (int i = 0; i < data.length; i++) { 44 | if (data[i] != null) { 45 | key.update(data[i]); 46 | } 47 | } 48 | return key; 49 | } 50 | 51 | /** 52 | * Getter for the factory that created this object. 53 | * 54 | * @return - the factory 55 | */ 56 | public DataExchangeFactory getDataExchangeFactory() { 57 | return dataExchangeFactory; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/ibatis/sqlmap/engine/type/IntegerTypeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.ibatis.sqlmap.engine.type; 17 | 18 | import java.sql.CallableStatement; 19 | import java.sql.PreparedStatement; 20 | import java.sql.ResultSet; 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * Integer Decimal implementation of TypeHandler. 25 | */ 26 | public class IntegerTypeHandler extends BaseTypeHandler implements TypeHandler { 27 | 28 | @Override 29 | public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException { 30 | ps.setInt(i, ((Integer) parameter).intValue()); 31 | } 32 | 33 | @Override 34 | public Object getResult(ResultSet rs, String columnName) throws SQLException { 35 | int i = rs.getInt(columnName); 36 | if (rs.wasNull()) { 37 | return null; 38 | } 39 | return Integer.valueOf(i); 40 | } 41 | 42 | @Override 43 | public Object getResult(ResultSet rs, int columnIndex) throws SQLException { 44 | int i = rs.getInt(columnIndex); 45 | if (rs.wasNull()) { 46 | return null; 47 | } 48 | return Integer.valueOf(i); 49 | } 50 | 51 | @Override 52 | public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { 53 | int i = cs.getInt(columnIndex); 54 | if (cs.wasNull()) { 55 | return null; 56 | } 57 | return Integer.valueOf(i); 58 | } 59 | 60 | @Override 61 | public Object valueOf(String s) { 62 | return Integer.valueOf(s); 63 | } 64 | 65 | } 66 | --------------------------------------------------------------------------------