├── src
├── test
│ ├── java
│ │ ├── META-INF
│ │ │ └── MANIFEST.MF
│ │ └── com
│ │ │ └── miragesql
│ │ │ └── miragesql
│ │ │ ├── bean
│ │ │ ├── BookType.java
│ │ │ ├── Magazine.java
│ │ │ ├── BeanDescImplTest.java
│ │ │ ├── Book.java
│ │ │ ├── DefaultPropertyExtractorTest.java
│ │ │ └── FieldPropertyExtractorTest.java
│ │ │ ├── type
│ │ │ ├── ByteArrayValueTypeTest.java
│ │ │ └── DefaultValueTypeTest.java
│ │ │ ├── dialect
│ │ │ ├── HyperSQLDialectTest.java
│ │ │ ├── MySQLDialectTest.java
│ │ │ ├── PostgreSQLDialectTest.java
│ │ │ ├── OracleDialectTest.java
│ │ │ └── StandardDialectTest.java
│ │ │ ├── parser
│ │ │ └── SqlParserImplTest.java
│ │ │ └── AbstractDatabaseTest.java
│ ├── resources
│ │ └── com
│ │ │ └── miragesql
│ │ │ └── miragesql
│ │ │ ├── SqlManagerImplTest_countBook.sql
│ │ │ ├── SqlManagerImplTest_testCall_tearDown.sql
│ │ │ ├── SqlManagerImplTest_testOracleHint1.sql
│ │ │ ├── SqlManagerImplTest_testOracleHint2.sql
│ │ │ ├── SqlManagerImplTest_removeSemicolon.sql
│ │ │ ├── SqlManagerImplTest_tearDown.sql
│ │ │ ├── SqlManagerImplTest_selectByBookName.sql
│ │ │ ├── SqlManagerImplTest_selectByBookNames.sql
│ │ │ ├── SqlManagerImplTest_selectMagazineByBookName.sql
│ │ │ ├── SqlManagerImplTest_testCall_setUp.sql
│ │ │ └── SqlManagerImplTest_setUp.sql
│ └── groovy
│ │ └── com
│ │ └── miragesql
│ │ └── miragesql
│ │ ├── bean
│ │ ├── DefaultPropertyExtractorSpec.groovy
│ │ ├── BeanDescFactorySpec.groovy
│ │ └── BeanDescImplSpec.groovy
│ │ ├── naming
│ │ └── DefaultNameConverterSpec.groovy
│ │ └── DefaultEntityOperatorSpec.groovy
└── main
│ └── java
│ └── com
│ └── miragesql
│ └── miragesql
│ ├── package-info.java
│ ├── util
│ ├── package-info.java
│ ├── ExceptionUtil.java
│ ├── ModifierUtil.java
│ ├── ReflectionUtil.java
│ ├── JdbcUtil.java
│ └── IOUtil.java
│ ├── provider
│ ├── package-info.java
│ ├── ConnectionProvider.java
│ ├── JNDIDataSourceConnectionProvider.java
│ ├── JNDIXADataSourceConnectionProvider.java
│ ├── DefaultConnectionProvider.java
│ ├── DataSourceConnectionProvider.java
│ └── XADataSourceConnectionProvider.java
│ ├── type
│ ├── package-info.java
│ ├── enumerate
│ │ └── package-info.java
│ ├── PostgreResultSetValueType.java
│ ├── OracleResultSetValueType.java
│ ├── ObjectValueType.java
│ ├── StringValueType.java
│ ├── TimeValueType.java
│ ├── SqlDateValueType.java
│ ├── TimestampValueType.java
│ ├── BigDecimalValueType.java
│ ├── IntegerPrimitiveValueType.java
│ ├── LongPrimitiveValueType.java
│ ├── FloatPrimitiveValueType.java
│ ├── DoublePrimitiveValueType.java
│ ├── LongValueType.java
│ ├── BooleanPrimitiveValueType.java
│ ├── ShortPrimitiveValueType.java
│ ├── FloatValueType.java
│ ├── IntegerValueType.java
│ ├── ShortValueType.java
│ ├── DoubleValueType.java
│ ├── BooleanValueType.java
│ ├── UtilDateValueType.java
│ ├── ValueType.java
│ ├── AbstractResultSetValueType.java
│ └── ByteArrayValueType.java
│ ├── exception
│ ├── package-info.java
│ ├── OgnlRuntimeException.java
│ ├── BreakIterationException.java
│ ├── SessionException.java
│ ├── TwoWaySQLException.java
│ ├── IORuntimeException.java
│ ├── BeanDescException.java
│ ├── SQLRuntimeException.java
│ └── ConfigurationException.java
│ ├── updater
│ ├── package-info.java
│ └── SchemaUpdateListener.java
│ ├── session
│ ├── package-info.java
│ ├── DialectAutoSelector.java
│ └── Session.java
│ ├── filter
│ └── package-info.java
│ ├── bean
│ ├── package-info.java
│ ├── PropertyExtractor.java
│ ├── BeanDesc.java
│ ├── MapPropertyDescImpl.java
│ ├── ReflectiveOperationFailedException.java
│ ├── BeanDescFactory.java
│ ├── MapBeanDescImpl.java
│ ├── PropertyDesc.java
│ ├── FieldPropertyExtractor.java
│ └── PropertyDescImpl.java
│ ├── naming
│ ├── package-info.java
│ ├── NameConverter.java
│ ├── RailsLikeNameConverter.java
│ └── DefaultNameConverter.java
│ ├── parser
│ ├── package-info.java
│ ├── SqlArgWrapper.java
│ ├── SqlParser.java
│ ├── ContainerNode.java
│ ├── ElseNode.java
│ ├── SqlNode.java
│ ├── AbstractNode.java
│ ├── BeginNode.java
│ ├── Node.java
│ ├── AddWhereIfNode.java
│ ├── SqlContextPropertyAccessor.java
│ ├── PrefixSqlNode.java
│ └── SqlTokenizer.java
│ ├── annotation
│ ├── package-info.java
│ ├── ResultSet.java
│ ├── Transient.java
│ ├── In.java
│ ├── Out.java
│ ├── InOut.java
│ ├── Table.java
│ ├── PrimaryKey.java
│ ├── Column.java
│ └── Enumerated.java
│ ├── dialect
│ ├── package-info.java
│ ├── DB2Dialect.java
│ ├── DerbyDialect.java
│ ├── SQLiteDialect.java
│ ├── SQLServerDialect.java
│ ├── H2Dialect.java
│ ├── HyperSQLDialect.java
│ ├── MySQLDialect.java
│ ├── StandardDialect.java
│ ├── PostgreSQLDialect.java
│ ├── OracleDialect.java
│ └── Dialect.java
│ ├── IterationCallback.java
│ ├── SqlResource.java
│ ├── EntityCreationFailedException.java
│ ├── StringSqlResource.java
│ └── ClasspathSqlResource.java
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── miragesql-test
├── src
│ ├── test
│ │ ├── resources
│ │ │ └── com
│ │ │ │ └── miragesql
│ │ │ │ └── miragesql
│ │ │ │ ├── SqlManagerImplTest_countBook.sql
│ │ │ │ ├── SqlManagerImplTest_testCall_tearDown.sql
│ │ │ │ ├── SqlManagerImplTest_testOracleHint1.sql
│ │ │ │ ├── SqlManagerImplTest_testOracleHint2.sql
│ │ │ │ ├── SqlManagerImplTest_removeSemicolon.sql
│ │ │ │ ├── SqlManagerImplTest_tearDown.sql
│ │ │ │ ├── SqlManagerImplTest_selectByBookName.sql
│ │ │ │ ├── SqlManagerImplTest_selectByBookNames.sql
│ │ │ │ ├── SqlManagerImplTest_selectMagazineByBookName.sql
│ │ │ │ ├── SqlManagerImplTest_testCall_setUp.sql
│ │ │ │ └── SqlManagerImplTest_setUp.sql
│ │ └── java
│ │ │ └── com
│ │ │ └── miragesql
│ │ │ └── miragesql
│ │ │ └── AbstractDatabaseTest.java
│ └── main
│ │ └── java
│ │ └── com
│ │ └── miragesql
│ │ └── miragesql
│ │ └── test
│ │ ├── package-info.java
│ │ ├── MockSqlManager.java
│ │ └── ExecutedSQLInfo.java
└── build.gradle
├── miragesql-integration
├── src
│ ├── test
│ │ ├── resources
│ │ │ └── com
│ │ │ │ └── miragesql
│ │ │ │ └── miragesql
│ │ │ │ ├── SqlManagerImplTest_countBook.sql
│ │ │ │ ├── SqlManagerImplTest_testCall_tearDown.sql
│ │ │ │ ├── SqlManagerImplTest_testOracleHint1.sql
│ │ │ │ ├── SqlManagerImplTest_testOracleHint2.sql
│ │ │ │ ├── SqlManagerImplTest_removeSemicolon.sql
│ │ │ │ ├── SqlManagerImplTest_tearDown.sql
│ │ │ │ ├── SqlManagerImplTest_selectByBookName.sql
│ │ │ │ ├── SqlManagerImplTest_selectByBookNames.sql
│ │ │ │ ├── SqlManagerImplTest_selectMagazineByBookName.sql
│ │ │ │ ├── SqlManagerImplTest_testCall_setUp.sql
│ │ │ │ ├── SqlManagerImplTest_setUp.sql
│ │ │ │ └── integration
│ │ │ │ └── spring
│ │ │ │ └── applicationContext.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── miragesql
│ │ │ └── miragesql
│ │ │ ├── integration
│ │ │ └── spring
│ │ │ │ ├── SpringTestDao.java
│ │ │ │ └── SpringConnectionProviderTest.java
│ │ │ └── AbstractDatabaseTest.java
│ └── main
│ │ └── java
│ │ └── com
│ │ └── miragesql
│ │ └── miragesql
│ │ └── integration
│ │ ├── seasar
│ │ ├── package-info.java
│ │ └── SeasarConnectionProvider.java
│ │ ├── guice
│ │ ├── package-info.java
│ │ ├── Transactional.java
│ │ ├── MirageModule.java
│ │ └── TransactionInterceptor.java
│ │ └── spring
│ │ ├── package-info.java
│ │ └── SpringConnectionProvider.java
└── build.gradle
├── settings.gradle
├── .gitignore
├── miragesql-tools
├── src
│ ├── test
│ │ ├── resources
│ │ │ └── com
│ │ │ │ └── miragesql
│ │ │ │ └── miragesql
│ │ │ │ ├── SqlManagerImplTest_tearDown.sql
│ │ │ │ ├── SqlManagerImplTest_setUp.sql
│ │ │ │ └── tools
│ │ │ │ ├── EntityGenTest_testGetXmlEntitySource.txt
│ │ │ │ ├── EntityGenTest_testGetGroovyEntitySource.txt
│ │ │ │ └── EntityGenTest_testGetJavaEntitySource.txt
│ │ ├── groovy
│ │ │ └── com
│ │ │ │ └── miragesql
│ │ │ │ └── miragesql
│ │ │ │ └── tools
│ │ │ │ └── EntityGenSpec.groovy
│ │ └── java
│ │ │ └── com
│ │ │ └── miragesql
│ │ │ └── miragesql
│ │ │ └── AbstractDatabaseTest.java
│ └── main
│ │ └── java
│ │ └── com
│ │ └── miragesql
│ │ └── miragesql
│ │ └── tools
│ │ └── package-info.java
└── build.gradle
├── .github
└── workflows
│ └── gradle.yml
└── gradlew.bat
/src/test/java/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_countBook.sql:
--------------------------------------------------------------------------------
1 | SELECT COUNT(*) FROM BOOK
2 |
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testCall_tearDown.sql:
--------------------------------------------------------------------------------
1 | DROP PROCEDURE NEW_BOOK
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mirage-sql/mirage/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_countBook.sql:
--------------------------------------------------------------------------------
1 | SELECT COUNT(*) FROM BOOK
2 |
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testCall_tearDown.sql:
--------------------------------------------------------------------------------
1 | DROP PROCEDURE NEW_BOOK
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_countBook.sql:
--------------------------------------------------------------------------------
1 | SELECT COUNT(*) FROM BOOK
2 |
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testCall_tearDown.sql:
--------------------------------------------------------------------------------
1 | DROP PROCEDURE NEW_BOOK
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'miragesql'
2 | include('miragesql-tools', 'miragesql-test', 'miragesql-integration')
3 |
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testOracleHint1.sql:
--------------------------------------------------------------------------------
1 | select /*+ first_rows(1) */BOOK_ID, BOOK_NAME from BOOK
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testOracleHint2.sql:
--------------------------------------------------------------------------------
1 | select --+ first_rows(1)
2 | BOOK_ID, BOOK_NAME from BOOK
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_removeSemicolon.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE FROM BOOK;
2 |
3 |
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testOracleHint1.sql:
--------------------------------------------------------------------------------
1 | select /*+ first_rows(1) */BOOK_ID, BOOK_NAME from BOOK
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the main Mirage-SQL package.
3 | */
4 | package com.miragesql.miragesql;
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testOracleHint1.sql:
--------------------------------------------------------------------------------
1 | select /*+ first_rows(1) */BOOK_ID, BOOK_NAME from BOOK
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testOracleHint2.sql:
--------------------------------------------------------------------------------
1 | select --+ first_rows(1)
2 | BOOK_ID, BOOK_NAME from BOOK
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testOracleHint2.sql:
--------------------------------------------------------------------------------
1 | select --+ first_rows(1)
2 | BOOK_ID, BOOK_NAME from BOOK
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_removeSemicolon.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE FROM BOOK;
2 |
3 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/util/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides some Mirage-SQL utilities.
3 | */
4 | package com.miragesql.miragesql.util;
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_removeSemicolon.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE FROM BOOK;
2 |
3 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/provider/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the Connection Providers.
3 | */
4 | package com.miragesql.miragesql.provider;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/type/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the DB to Java object mapping types.
3 | */
4 | package com.miragesql.miragesql.type;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides a package of Runtime Exceptions.
3 | */
4 | package com.miragesql.miragesql.exception;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/updater/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the DB Schema Updating functionality.
3 | */
4 | package com.miragesql.miragesql.updater;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/session/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the Session management classes in Mirage-SQL.
3 | */
4 | package com.miragesql.miragesql.session;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/filter/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides Servlet Filter functionality, useful in web applications.
3 | */
4 | package com.miragesql.miragesql.filter;
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_tearDown.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE BOOK;
2 | DROP TABLE MAGAZINE;
3 | DROP TABLE USER_INFO;
4 | DROP SEQUENCE USER_INFO_USER_ID_SEQ;
5 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/bean/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the Beans functionality, required when working with Bean Entities.
3 | */
4 | package com.miragesql.miragesql.bean;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/type/enumerate/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the DB to Java object enumeration mapping types.
3 | */
4 | package com.miragesql.miragesql.type.enumerate;
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/bean/BookType.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.bean;
2 |
3 |
4 | public enum BookType {
5 |
6 | DOMESTIC,
7 |
8 | FOREIGN
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | build/
3 | temp/
4 | .gradle
5 | .idea
6 | *.iml
7 | *.ipr
8 | *.iws
9 | out
10 | .classpath
11 | .settings
12 | .project
13 | .gradletasknamecache
14 | gradle-app.setting
--------------------------------------------------------------------------------
/miragesql-test/src/main/java/com/miragesql/miragesql/test/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides Testing utilities for Mirage-SQL based applications.
3 | */
4 | package com.miragesql.miragesql.test;
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_tearDown.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE BOOK;
2 | DROP TABLE MAGAZINE;
3 | DROP TABLE USER_INFO;
4 | DROP SEQUENCE USER_INFO_USER_ID_SEQ;
5 |
--------------------------------------------------------------------------------
/miragesql-tools/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_tearDown.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE BOOK;
2 | DROP TABLE MAGAZINE;
3 | DROP TABLE USER_INFO;
4 | DROP SEQUENCE USER_INFO_USER_ID_SEQ;
5 |
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_tearDown.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE BOOK;
2 | DROP TABLE MAGAZINE;
3 | DROP TABLE USER_INFO;
4 | DROP SEQUENCE USER_INFO_USER_ID_SEQ;
5 |
--------------------------------------------------------------------------------
/miragesql-integration/src/main/java/com/miragesql/miragesql/integration/seasar/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the Seasar2 integration functionality.
3 | */
4 | package com.miragesql.miragesql.integration.seasar;
--------------------------------------------------------------------------------
/miragesql-integration/src/main/java/com/miragesql/miragesql/integration/guice/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the Google Guice integration functionality.
3 | */
4 | package com.miragesql.miragesql.integration.guice;
--------------------------------------------------------------------------------
/miragesql-integration/src/main/java/com/miragesql/miragesql/integration/spring/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the SpringSource Spring integration functionality.
3 | */
4 | package com.miragesql.miragesql.integration.spring;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/naming/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides naming converter functionality, i.e. conversion between table and entities, columns and properties.
3 | */
4 | package com.miragesql.miragesql.naming;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/parser/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the Mirage-SQL Parser. This parser was manually written, so there's no grammar documenting it.
3 | */
4 | package com.miragesql.miragesql.parser;
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectByBookName.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE
2 | FROM BOOK
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME=/*bookName*/'Mirage in Action'
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the Mirage-SQL Annotations, useful to annotate beans used in conjunction with the 2WaySQL feature.
3 | */
4 | package com.miragesql.miragesql.annotation;
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectByBookNames.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE
2 | FROM BOOK
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME IN /*bookNames*/('Mirage in Action')
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectMagazineByBookName.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, MAG_TYPE, PRICE
2 | FROM MAGAZINE
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME=/*bookName*/'Mirage in Action'
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectByBookName.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE
2 | FROM BOOK
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME=/*bookName*/'Mirage in Action'
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectByBookName.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE
2 | FROM BOOK
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME=/*bookName*/'Mirage in Action'
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides the supported Database dialect features in order to gracefully handle the differences of various database features.
3 | */
4 | package com.miragesql.miragesql.dialect;
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectByBookNames.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE
2 | FROM BOOK
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME IN /*bookNames*/('Mirage in Action')
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectByBookNames.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, AUTHOR, PRICE
2 | FROM BOOK
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME IN /*bookNames*/('Mirage in Action')
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectMagazineByBookName.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, MAG_TYPE, PRICE
2 | FROM MAGAZINE
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME=/*bookName*/'Mirage in Action'
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_selectMagazineByBookName.sql:
--------------------------------------------------------------------------------
1 | SELECT BOOK_ID, BOOK_NAME, MAG_TYPE, PRICE
2 | FROM MAGAZINE
3 | /*IF bookName != null*/
4 | WHERE BOOK_NAME=/*bookName*/'Mirage in Action'
5 | /*END*/
6 |
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testCall_setUp.sql:
--------------------------------------------------------------------------------
1 | CREATE PROCEDURE NEW_BOOK
2 | (BOOK_NAME VARCHAR(200), AUTHOR VARCHAR(200), PRICE INT)
3 | MODIFIES SQL DATA
4 | INSERT INTO BOOK
5 | VALUES (DEFAULT, BOOK_NAME, AUTHOR, PRICE)
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testCall_setUp.sql:
--------------------------------------------------------------------------------
1 | CREATE PROCEDURE NEW_BOOK
2 | (BOOK_NAME VARCHAR(200), AUTHOR VARCHAR(200), PRICE INT)
3 | MODIFIES SQL DATA
4 | INSERT INTO BOOK
5 | VALUES (DEFAULT, BOOK_NAME, AUTHOR, PRICE)
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_testCall_setUp.sql:
--------------------------------------------------------------------------------
1 | CREATE PROCEDURE NEW_BOOK
2 | (BOOK_NAME VARCHAR(200), AUTHOR VARCHAR(200), PRICE INT)
3 | MODIFIES SQL DATA
4 | INSERT INTO BOOK
5 | VALUES (DEFAULT, BOOK_NAME, AUTHOR, PRICE)
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/DB2Dialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | public class DB2Dialect extends StandardDialect {
4 |
5 | /**{@inheritDoc}*/
6 | @Override
7 | public String getName() {
8 | return "db2";
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/DerbyDialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | public class DerbyDialect extends StandardDialect {
4 |
5 | /**{@inheritDoc}*/
6 | @Override
7 | public String getName() {
8 | return "derby";
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/SQLiteDialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | public class SQLiteDialect extends StandardDialect {
4 |
5 | /**{@inheritDoc}*/
6 | @Override
7 | public String getName() {
8 | return "sqlite";
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/miragesql-tools/src/main/java/com/miragesql/miragesql/tools/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides tools to work with Mirage-SQL. E.g. EntityGenTask will reverse engineer
3 | * a database and create Java entities (with the correct annotations) that maps to that schema.
4 | */
5 | package com.miragesql.miragesql.tools;
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/SQLServerDialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | public class SQLServerDialect extends StandardDialect {
4 |
5 | /**{@inheritDoc}*/
6 | @Override
7 | public String getName() {
8 | return "sqlserver";
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/type/PostgreResultSetValueType.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.type;
2 |
3 | import java.sql.Types;
4 |
5 | public class PostgreResultSetValueType extends AbstractResultSetValueType {
6 |
7 | public PostgreResultSetValueType() {
8 | super(Types.OTHER);
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/type/OracleResultSetValueType.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.type;
2 |
3 |
4 | public class OracleResultSetValueType extends AbstractResultSetValueType {
5 |
6 | public static final int CURSOR = -10;
7 |
8 | public OracleResultSetValueType() {
9 | super(CURSOR);
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/OgnlRuntimeException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.exception;
2 |
3 | public class OgnlRuntimeException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 1L;
6 |
7 | public OgnlRuntimeException(Throwable cause, String path, int lineNumber) {
8 | super("OGNL error in path: " + path + ", line:" + lineNumber, cause);
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/H2Dialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | public class H2Dialect extends StandardDialect {
4 |
5 | /**{@inheritDoc}*/
6 | @Override
7 | public String getName() {
8 | return "h2";
9 | }
10 |
11 | /**{@inheritDoc}*/
12 | @Override
13 | public String getSequenceSql(String sequenceName) {
14 | return String.format("SELECT NEXTVAL('%s')", sequenceName);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/BreakIterationException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.exception;
2 |
3 | /**
4 | * Exception thrown in the {@link com.miragesql.miragesql.IterationCallback} to discontinue iteration search.
5 | *
6 | *
7 | * Note: to don't use this exception for other purposes.
8 | *
9 | * @author Naoki Takezoe
10 | */
11 | public class BreakIterationException extends RuntimeException {
12 |
13 | private static final long serialVersionUID = 1L;
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/IterationCallback.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql;
2 |
3 | /**
4 | * Callback interface for iteration search.
5 | *
6 | * @author Naoki Takezoe
7 | *
8 | * @param the entity type
9 | * @param the return type
10 | *
11 | * @see SqlManager#iterate(Class, IterationCallback, SqlResource)
12 | * @see SqlManager#iterate(Class, IterationCallback, SqlResource, Object)
13 | */
14 | public interface IterationCallback {
15 |
16 | R iterate(T entity);
17 | }
18 |
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/type/ByteArrayValueTypeTest.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.type;
2 |
3 | import junit.framework.TestCase;
4 |
5 | public class ByteArrayValueTypeTest extends TestCase {
6 |
7 | public void testIsSupport() {
8 | ByteArrayValueType valueType = new ByteArrayValueType();
9 |
10 | byte[] bytes = new byte[0];
11 | Object[] objs = new Object[0];
12 |
13 | assertTrue(valueType.isSupport(bytes.getClass(), null));
14 | assertFalse(valueType.isSupport(objs.getClass(), null));
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/SqlResource.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 |
6 | /**
7 | * SqlResource is a common interface to access SQLs.
8 | */
9 | public interface SqlResource {
10 |
11 | /**
12 | * Retrieves the Input Stream associated with a given SQL.
13 | *
14 | * @return an {@link InputStream}
15 | * @throws IOException if something goes wrong trying to access the SQL.
16 | */
17 | InputStream getInputStream() throws IOException;
18 | }
19 |
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/dialect/HyperSQLDialectTest.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | import junit.framework.TestCase;
4 |
5 | public class HyperSQLDialectTest extends TestCase {
6 |
7 | public void testGetSequenceSql() {
8 | HyperSQLDialect dialect = new HyperSQLDialect();
9 | String sql = dialect.getSequenceSql("SEQUENCE");
10 |
11 | assertEquals("SELECT NEXT VALUE FOR SEQUENCE " +
12 | "FROM INFORMATION_SCHEMA.SYSTEM_TABLES " +
13 | "WHERE table_name = 'SYSTEM_TABLES'", sql);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/type/DefaultValueTypeTest.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.type;
2 |
3 | import junit.framework.TestCase;
4 |
5 | @Deprecated
6 | public class DefaultValueTypeTest extends TestCase {
7 |
8 | public void testIsSupport() {
9 | DefaultValueType valueType = new DefaultValueType();
10 |
11 | byte[] bytes = new byte[0];
12 | Object[] objs = new Object[0];
13 |
14 | assertTrue(valueType.isSupport(bytes.getClass(), null));
15 | assertFalse(valueType.isSupport(objs.getClass(), null));
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/SessionException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.exception;
2 |
3 | public class SessionException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 1L;
6 |
7 | public SessionException(String message, Throwable cause) {
8 | super(message, cause);
9 | }
10 |
11 | public SessionException(String message) {
12 | super(message);
13 | }
14 |
15 | public SessionException(Throwable cause) {
16 | super(cause);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/TwoWaySQLException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.exception;
2 |
3 | public class TwoWaySQLException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 1L;
6 |
7 | public TwoWaySQLException(String message, Throwable cause) {
8 | super(message, cause);
9 | }
10 |
11 | public TwoWaySQLException(String message) {
12 | super(message);
13 | }
14 |
15 | public TwoWaySQLException(Throwable cause) {
16 | super(cause);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/ResultSet.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Annotation indicating that the annotated property maps a {@link java.sql.ResultSet}.
11 | */
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Target({ElementType.FIELD, ElementType.METHOD})
14 | @Documented
15 | public @interface ResultSet {
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/miragesql-integration/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_setUp.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE BOOK (
2 | BOOK_ID INT IDENTITY PRIMARY KEY,
3 | BOOK_NAME VARCHAR(200) NOT NULL,
4 | AUTHOR VARCHAR(200) NOT NULL,
5 | PRICE INT
6 | );
7 |
8 | CREATE TABLE MAGAZINE (
9 | BOOK_ID INT IDENTITY PRIMARY KEY,
10 | BOOK_NAME VARCHAR(200) NOT NULL,
11 | MAG_TYPE VARCHAR(16) NOT NULL,
12 | PRICE INT
13 | );
14 |
15 | CREATE TABLE USER_INFO (
16 | USER_ID INT PRIMARY KEY,
17 | USER_NAME VARCHAR(200) NOT NULL
18 | );
19 |
20 | CREATE SEQUENCE USER_INFO_USER_ID_SEQ AS INTEGER;
21 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/IORuntimeException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.exception;
2 |
3 | import java.io.IOException;
4 |
5 |
6 | @SuppressWarnings("serial")
7 | public class IORuntimeException extends RuntimeException {
8 |
9 | public IORuntimeException(String message, IOException cause) {
10 | super(message, cause);
11 | }
12 |
13 | public IORuntimeException(IOException cause) {
14 | super(cause);
15 | }
16 |
17 | @Override
18 | public IOException getCause() {
19 | return (IOException) super.getCause();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_setUp.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE BOOK (
2 | BOOK_ID INT IDENTITY PRIMARY KEY,
3 | BOOK_NAME VARCHAR(200) NOT NULL,
4 | AUTHOR VARCHAR(200) NOT NULL,
5 | PRICE INT
6 | );
7 |
8 | CREATE TABLE MAGAZINE (
9 | BOOK_ID INT IDENTITY PRIMARY KEY,
10 | BOOK_NAME VARCHAR(200) NOT NULL,
11 | MAG_TYPE VARCHAR(16) NOT NULL,
12 | PRICE INT
13 | );
14 |
15 | CREATE TABLE USER_INFO (
16 | USER_ID INT PRIMARY KEY,
17 | USER_NAME VARCHAR(200) NOT NULL
18 | );
19 |
20 | CREATE SEQUENCE USER_INFO_USER_ID_SEQ AS INTEGER;
21 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/BeanDescException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.exception;
2 |
3 | import java.lang.reflect.InvocationTargetException;
4 |
5 | import com.miragesql.miragesql.bean.ReflectiveOperationFailedException;
6 |
7 | public class BeanDescException extends ReflectiveOperationFailedException {
8 |
9 | private static final long serialVersionUID = 1L;
10 |
11 | public BeanDescException(InvocationTargetException e) {
12 | super(e);
13 | }
14 |
15 | public BeanDescException(IllegalAccessException e) {
16 | super(e);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/bean/Magazine.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.bean;
2 |
3 | import com.miragesql.miragesql.annotation.PrimaryKey;
4 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
5 |
6 | public class Magazine {
7 | public static final String CONSTANT = "foobar";
8 |
9 | @PrimaryKey(generationType=GenerationType.IDENTITY)
10 | private long magazineId;
11 |
12 | public String magazineCode;
13 |
14 | int price;
15 |
16 | public long getId() {
17 | return magazineId;
18 | }
19 |
20 | public void setId(long id) {
21 | this.magazineId = id;
22 | }
23 | }
--------------------------------------------------------------------------------
/miragesql-test/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_setUp.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE BOOK (
2 | BOOK_ID INT IDENTITY PRIMARY KEY,
3 | BOOK_NAME VARCHAR(200) NOT NULL,
4 | AUTHOR VARCHAR(200) NOT NULL,
5 | PRICE INT
6 | );
7 |
8 | CREATE TABLE MAGAZINE (
9 | BOOK_ID INT IDENTITY PRIMARY KEY,
10 | BOOK_NAME VARCHAR(200) NOT NULL,
11 | MAG_TYPE VARCHAR(16) NOT NULL,
12 | PRICE INT
13 | );
14 |
15 | CREATE TABLE USER_INFO (
16 | USER_ID INT PRIMARY KEY,
17 | USER_NAME VARCHAR(200) NOT NULL
18 | );
19 |
20 | CREATE SEQUENCE USER_INFO_USER_ID_SEQ AS INTEGER;
21 |
--------------------------------------------------------------------------------
/miragesql-tools/src/test/resources/com/miragesql/miragesql/SqlManagerImplTest_setUp.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE BOOK (
2 | BOOK_ID INT IDENTITY PRIMARY KEY,
3 | BOOK_NAME VARCHAR(200) NOT NULL,
4 | AUTHOR VARCHAR(200) NOT NULL,
5 | PRICE INT
6 | );
7 |
8 | CREATE TABLE MAGAZINE (
9 | BOOK_ID INT IDENTITY PRIMARY KEY,
10 | BOOK_NAME VARCHAR(200) NOT NULL,
11 | MAG_TYPE VARCHAR(16) NOT NULL,
12 | PRICE INT
13 | );
14 |
15 | CREATE TABLE USER_INFO (
16 | USER_ID INT PRIMARY KEY,
17 | USER_NAME VARCHAR(200) NOT NULL
18 | );
19 |
20 | CREATE SEQUENCE USER_INFO_USER_ID_SEQ AS INTEGER;
21 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/HyperSQLDialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | public class HyperSQLDialect extends StandardDialect {
4 |
5 | /**{@inheritDoc}*/
6 | @Override
7 | public String getName() {
8 | return "hsqldb";
9 | }
10 |
11 | /**{@inheritDoc}*/
12 | @Override
13 | public String getSequenceSql(String sequenceName) {
14 | return String.format("SELECT NEXT VALUE FOR %s " +
15 | "FROM INFORMATION_SCHEMA.SYSTEM_TABLES " +
16 | "WHERE table_name = 'SYSTEM_TABLES'", sequenceName);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/util/ExceptionUtil.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.util;
2 |
3 | import java.io.PrintWriter;
4 | import java.io.StringWriter;
5 |
6 | public class ExceptionUtil {
7 |
8 | /**
9 | * Returns stacktrace as string.
10 | *
11 | * @param ex the exception
12 | * @return stacktrace
13 | */
14 | public static String toString(Exception ex){
15 | StringWriter writer = new StringWriter();
16 | PrintWriter pw = new PrintWriter(writer);
17 |
18 | ex.printStackTrace(pw);
19 |
20 | return writer.toString();
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/Transient.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Annotation that indicates that the property is transient, so it won't be persisted.
11 | *
12 | * @author Naoki Takezoe
13 | */
14 | @Target({ElementType.FIELD, ElementType.METHOD})
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Documented
17 | public @interface Transient {
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/miragesql-tools/src/test/resources/com/miragesql/miragesql/tools/EntityGenTest_testGetXmlEntitySource.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/SQLRuntimeException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.exception;
2 |
3 | import java.sql.SQLException;
4 |
5 | public class SQLRuntimeException extends RuntimeException {
6 |
7 | private static final long serialVersionUID = 1L;
8 |
9 | public SQLRuntimeException(String message, SQLException cause) {
10 | super(message, cause);
11 | }
12 |
13 | public SQLRuntimeException(SQLException cause) {
14 | super(cause);
15 | }
16 |
17 | @Override
18 | public SQLException getCause() {
19 | return (SQLException) super.getCause();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/miragesql-integration/src/main/java/com/miragesql/miragesql/integration/guice/Transactional.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.integration.guice;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Gives this annotation to transaction boundary methods.
11 | *
12 | * @author Naoki Takezoe
13 | * @see TransactionInterceptor
14 | */
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Target({ElementType.METHOD})
17 | @Documented
18 | public @interface Transactional {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/In.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Annotation that indicates that the property is an IN parameter of the parameter class
11 | * which is used for DB store procedure / function invocation.
12 | */
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Target({ElementType.FIELD, ElementType.METHOD})
15 | @Documented
16 | public @interface In {
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/Out.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Annotation that indicates that the property is an OUT parameter of the parameter class
11 | * which is used for DB store procedure / function invocation.
12 | */
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Target({ElementType.FIELD, ElementType.METHOD})
15 | @Documented
16 | public @interface Out {
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/InOut.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Annotation that indicates that the property is IN-OUT parameter of the parameter class
11 | * which is used for the DB store procedure / function invocation.
12 | */
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Target({ElementType.FIELD, ElementType.METHOD})
15 | @Documented
16 | public @interface InOut {
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/util/ModifierUtil.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.util;
2 |
3 | import java.lang.reflect.Field;
4 | import java.lang.reflect.Modifier;
5 |
6 | public class ModifierUtil {
7 |
8 | protected ModifierUtil() {
9 | }
10 |
11 | public static boolean isStatic(int modifier) {
12 | return Modifier.isStatic(modifier);
13 | }
14 |
15 | public static boolean isFinal(int modifier) {
16 | return Modifier.isFinal(modifier);
17 | }
18 |
19 | public static boolean isInstanceField(Field field) {
20 | int m = field.getModifiers();
21 | return !isStatic(m) && !isFinal(m);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/test/groovy/com/miragesql/miragesql/bean/DefaultPropertyExtractorSpec.groovy:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.bean
2 |
3 | import spock.lang.Specification
4 |
5 | class DefaultPropertyExtractorSpec extends Specification {
6 | def "extractProperties with data"() {
7 | when:
8 | DefaultPropertyExtractor dpe = new DefaultPropertyExtractor()
9 | then:
10 | dpe.extractProperties(clazz).keySet() == result
11 | where:
12 | clazz || result
13 | BookRaw.class ||["id","metaClass","name","title","year"] as Set
14 | BookChanged.class||["id","metaClass","name","title","year"] as Set
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/exception/ConfigurationException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.exception;
2 |
3 | /**
4 | * Exception thrown when the Mirage-SQL {@link com.miragesql.miragesql.session.Session} is not properly configured.
5 | */
6 | public class ConfigurationException extends RuntimeException {
7 |
8 | private static final long serialVersionUID = 1L;
9 |
10 | public ConfigurationException(String message, Throwable cause) {
11 | super(message, cause);
12 | }
13 |
14 | public ConfigurationException(String message) {
15 | super(message);
16 | }
17 |
18 | public ConfigurationException(Throwable cause) {
19 | super(cause);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/.github/workflows/gradle.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3 |
4 | name: Build
5 |
6 | on: [push, pull_request]
7 |
8 | jobs:
9 | build:
10 |
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - uses: actions/checkout@v2
15 | - name: Set up JDK 8
16 | uses: actions/setup-java@v2
17 | with:
18 | java-version: '8'
19 | distribution: 'adopt'
20 | cache: gradle
21 | - name: Grant execute permission for gradlew
22 | run: chmod +x gradlew
23 | - name: Build with Gradle
24 | run: ./gradlew test
25 |
--------------------------------------------------------------------------------
/miragesql-tools/src/test/resources/com/miragesql/miragesql/tools/EntityGenTest_testGetGroovyEntitySource.txt:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.entity
2 |
3 | import com.miragesql.miragesql.annotation.Table
4 | import com.miragesql.miragesql.annotation.Column
5 | import com.miragesql.miragesql.annotation.PrimaryKey
6 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType
7 |
8 | @Table(name="BOOK")
9 | class Book {
10 |
11 | @PrimaryKey(generationType=GenerationType.SEQUENCE, generator="BOOK_BOOK_ID_SEQ")
12 | @Column(name="BOOK_ID")
13 | Integer bookId
14 |
15 | @Column(name="BOOK_NAME")
16 | String bookName
17 |
18 | @Column(name="AUTHOR")
19 | String author
20 |
21 | @Column(name="PRICE")
22 | Integer price
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/miragesql-tools/src/test/resources/com/miragesql/miragesql/tools/EntityGenTest_testGetJavaEntitySource.txt:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.entity;
2 |
3 | import com.miragesql.miragesql.annotation.Table;
4 | import com.miragesql.miragesql.annotation.Column;
5 | import com.miragesql.miragesql.annotation.PrimaryKey;
6 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
7 |
8 | @Table(name="BOOK")
9 | public class Book {
10 |
11 | @PrimaryKey(generationType=GenerationType.SEQUENCE, generator="BOOK_BOOK_ID_SEQ")
12 | @Column(name="BOOK_ID")
13 | public Integer bookId;
14 |
15 | @Column(name="BOOK_NAME")
16 | public String bookName;
17 |
18 | @Column(name="AUTHOR")
19 | public String author;
20 |
21 | @Column(name="PRICE")
22 | public Integer price;
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/provider/ConnectionProvider.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.provider;
2 |
3 | import java.sql.Connection;
4 |
5 | import com.miragesql.miragesql.SqlManager;
6 | import com.miragesql.miragesql.exception.SQLRuntimeException;
7 |
8 | /**
9 | * The interface of the connection provider.
10 | *
11 | * Mirage-SQL uses this interface to get the connection to the database.
12 | *
13 | * @author Naoki Takezoe
14 | * @see SqlManager#setConnectionProvider(ConnectionProvider)
15 | */
16 | public interface ConnectionProvider {
17 |
18 | /**
19 | * Returns the connection to the database.
20 | *
21 | * @return the connection
22 | * @throws SQLRuntimeException Failed to get the connection
23 | */
24 | Connection getConnection();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/miragesql-test/build.gradle:
--------------------------------------------------------------------------------
1 | uploadArchives.repositories.mavenDeployer {
2 | pom.project {
3 | name 'Mirage-SQL Test'
4 | description 'Mirage-SQL Test is a test utility for the Mirage-SQL framework.'
5 | }
6 | }
7 |
8 | dependencies {
9 | compile rootProject
10 |
11 | compile 'org.slf4j:slf4j-api:1.7.25'
12 |
13 | compile 'junit:junit:4.12'
14 |
15 | testImplementation 'cglib:cglib:3.2.5'
16 | testImplementation 'org.mockito:mockito-core:2.13.0'
17 | testImplementation 'com.h2database:h2:1.4.196'
18 | testImplementation 'org.hsqldb:hsqldb:2.4.0'
19 |
20 | // Use the latest Groovy version for Spock testing
21 | testImplementation 'org.codehaus.groovy:groovy-all:2.4.13'
22 | // Use the awesome Spock testing and specification framework even with Java
23 | testImplementation 'org.spockframework:spock-core:1.1-groovy-2.4'
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/EntityCreationFailedException.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql;
2 |
3 |
4 | /**
5 | * {@link EntityCreationFailedException} is thrown to indicate that
6 | * an {@link EntityOperator} failed to create a result entity.
7 | *
8 | * @see EntityOperator
9 | * @author daisuke
10 | */
11 | @SuppressWarnings("serial")
12 | public class EntityCreationFailedException extends RuntimeException {
13 |
14 | public EntityCreationFailedException() {
15 | super();
16 | }
17 |
18 | public EntityCreationFailedException(String message, Throwable cause) {
19 | super(message, cause);
20 | }
21 |
22 | public EntityCreationFailedException(String message) {
23 | super(message);
24 | }
25 |
26 | public EntityCreationFailedException(Throwable cause) {
27 | super(cause);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/MySQLDialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
4 |
5 | // TODO: stored procedure / function and sequence support
6 | public class MySQLDialect extends StandardDialect {
7 |
8 | /**{@inheritDoc}*/
9 | @Override
10 | public String getName() {
11 | return "mysql";
12 | }
13 |
14 | /**{@inheritDoc}*/
15 | @Override
16 | public String getCountSql(String sql) {
17 | return "SELECT COUNT(*) FROM (" + sql + ") A";
18 | }
19 |
20 | /**{@inheritDoc}*/
21 | @Override
22 | public boolean supportsGenerationType(GenerationType generationType) {
23 | if(generationType == GenerationType.SEQUENCE){
24 | return false;
25 | }
26 | return true;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/bean/BeanDescImplTest.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.bean;
2 |
3 | import com.miragesql.miragesql.annotation.Enumerated;
4 | import com.miragesql.miragesql.annotation.PrimaryKey;
5 | import com.miragesql.miragesql.annotation.Transient;
6 | import junit.framework.TestCase;
7 |
8 | public class BeanDescImplTest extends TestCase {
9 |
10 | public void testBeanDescImpl() {
11 | PropertyExtractor propertyExtractor = new DefaultPropertyExtractor();
12 | BeanDesc bd = new BeanDescImpl(Book.class, propertyExtractor.extractProperties(Book.class));
13 |
14 | assertEquals(3, bd.getPropertyDescSize());
15 | assertNotNull(bd.getPropertyDesc("bookId").getAnnotation(PrimaryKey.class));
16 | assertNotNull(bd.getPropertyDesc("bookName").getAnnotation(Transient.class));
17 | assertNotNull(bd.getPropertyDesc("bookType").getAnnotation(Enumerated.class));
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/StandardDialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
4 | import com.miragesql.miragesql.type.ValueType;
5 |
6 | public class StandardDialect implements Dialect {
7 |
8 | public String getName() {
9 | return null;
10 | }
11 |
12 | public boolean needsParameterForResultSet() {
13 | return false;
14 | }
15 |
16 | public ValueType> getValueType() {
17 | return null;
18 | }
19 |
20 | public String getSequenceSql(String sequenceName) {
21 | return null;
22 | }
23 |
24 | public boolean supportsGenerationType(GenerationType generationType) {
25 | return true;
26 | }
27 |
28 | public String getCountSql(String sql) {
29 | return "SELECT COUNT(*) FROM (" + sql + ")";
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/provider/JNDIDataSourceConnectionProvider.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.provider;
2 |
3 | import javax.naming.Context;
4 | import javax.naming.InitialContext;
5 | import javax.naming.NamingException;
6 | import javax.sql.DataSource;
7 |
8 | /**
9 | * {@link ConnectionProvider} implementation which gets a connection from javax.sql.DataSource
10 | * which is obtained from JNDI.
11 | *
12 | * @author Naoki Takezoe
13 | */
14 | public class JNDIDataSourceConnectionProvider extends DataSourceConnectionProvider {
15 |
16 | public JNDIDataSourceConnectionProvider(String jndiName) throws NamingException {
17 | Context initContext = new InitialContext();
18 | Context envContext = (Context) initContext.lookup("java:/comp/env");
19 | DataSource dataSource = (DataSource) envContext.lookup(jndiName);
20 | setDataSource(dataSource);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/miragesql-tools/build.gradle:
--------------------------------------------------------------------------------
1 | uploadArchives.repositories.mavenDeployer {
2 | pom.project {
3 | name 'Mirage-SQL Tools'
4 | description 'Mirage-SQL Tools is a set of tools to help the development of Mirage-SQL based applications.'
5 | }
6 | }
7 |
8 | dependencies {
9 | compile rootProject
10 |
11 | compile 'org.slf4j:slf4j-api:1.7.25'
12 |
13 | compileOnly 'org.apache.ant:ant:1.10.1' // provided
14 |
15 | testImplementation 'junit:junit:4.12'
16 | testImplementation 'org.mockito:mockito-core:2.13.0'
17 | testImplementation 'com.h2database:h2:1.4.196'
18 | testImplementation 'org.hsqldb:hsqldb:2.4.0'
19 |
20 | // Use the latest Groovy version for Spock testing
21 | testImplementation 'org.codehaus.groovy:groovy-all:2.4.13'
22 | // Use the awesome Spock testing and specification framework even with Java
23 | testImplementation 'org.spockframework:spock-core:1.1-groovy-2.4'
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/provider/JNDIXADataSourceConnectionProvider.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.provider;
2 |
3 | import javax.naming.Context;
4 | import javax.naming.InitialContext;
5 | import javax.naming.NamingException;
6 | import javax.sql.XADataSource;
7 |
8 | /**
9 | * {@link ConnectionProvider} implementation which gets a connection from javax.sql.XADataSource
10 | * which is obtained from JNDI.
11 | *
12 | * @author Naoki Takezoe
13 | */
14 | public class JNDIXADataSourceConnectionProvider extends XADataSourceConnectionProvider {
15 |
16 | public JNDIXADataSourceConnectionProvider(String jndiName) throws NamingException {
17 | Context initContext = new InitialContext();
18 | Context envContext = (Context) initContext.lookup("java:/comp/env");
19 | XADataSource xaDataSource = (XADataSource) envContext.lookup(jndiName);
20 | setDataSource(xaDataSource);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/dialect/MySQLDialectTest.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
4 | import junit.framework.TestCase;
5 |
6 | public class MySQLDialectTest extends TestCase {
7 |
8 | public void testGetName() {
9 | MySQLDialect dialect = new MySQLDialect();
10 | assertEquals("mysql", dialect.getName());
11 | }
12 |
13 | public void testSupportsGenerationType() {
14 | MySQLDialect dialect = new MySQLDialect();
15 | assertTrue(dialect.supportsGenerationType(GenerationType.APPLICATION));
16 | assertTrue(dialect.supportsGenerationType(GenerationType.IDENTITY));
17 | assertFalse(dialect.supportsGenerationType(GenerationType.SEQUENCE));
18 | }
19 |
20 | public void testGetCountSql() {
21 | MySQLDialect dialect = new MySQLDialect();
22 | String sql = dialect.getCountSql("SELECT * FROM TABLE");
23 | assertEquals("SELECT COUNT(*) FROM (SELECT * FROM TABLE) A", sql);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/miragesql-integration/src/test/java/com/miragesql/miragesql/integration/spring/SpringTestDao.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.integration.spring;
2 |
3 | import com.miragesql.miragesql.SqlManager;
4 | import com.miragesql.miragesql.StringSqlResource;
5 | import com.miragesql.miragesql.SqlManagerImplTest.Book;
6 |
7 | import org.springframework.transaction.annotation.Transactional;
8 |
9 | public class SpringTestDao {
10 |
11 | private SqlManager sqlManager;
12 |
13 | public SqlManager getSqlManager() {
14 | return sqlManager;
15 | }
16 |
17 | public void setSqlManager(SqlManager sqlManager) {
18 | this.sqlManager = sqlManager;
19 | }
20 |
21 | @Transactional
22 | public void insert(Book book, boolean throwException){
23 | sqlManager.insertEntity(book);
24 | if(throwException){
25 | throw new RuntimeException();
26 | }
27 | }
28 |
29 | @Transactional
30 | public int getCount(){
31 | return sqlManager.getSingleResult(
32 | Integer.class, new StringSqlResource("SELECT COUNT(*) FROM BOOK"));
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/parser/SqlArgWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2004-2010 the Seasar Foundation and the Others.
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 | * http://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,
13 | * either express or implied. See the License for the specific language
14 | * governing permissions and limitations under the License.
15 | */
16 | package com.miragesql.miragesql.parser;
17 |
18 | /**
19 | * Wrapper interface for SQL arguments.
20 | *
21 | * @author taedium
22 | */
23 | public interface SqlArgWrapper {
24 |
25 | /**
26 | * @return the wrapped value.
27 | */
28 | Object getValue();
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/bean/PropertyExtractor.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.bean;
2 |
3 | import java.lang.reflect.Field;
4 | import java.lang.reflect.Method;
5 | import java.util.Map;
6 |
7 | /**
8 | * An interface for extracting property information from a class object.
9 | *
10 | * You can implement your own PropertyExtractor and enable it by {@link BeanDescFactory#setPropertyExtractor(PropertyExtractor)}.
11 | *
12 | * @author Naoki Takezoe
13 | */
14 | public interface PropertyExtractor {
15 |
16 | /**
17 | * Extracts the properties from a class
18 | * @param clazz the class to extract properties from.
19 | *
20 | * @return a Map of properties
21 | */
22 | Map extractProperties(Class> clazz);
23 |
24 | class PropertyInfo {
25 | public String name;
26 | public Class> type;
27 | public Method getterMethod;
28 | public Method setterMethod;
29 | public Field field;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/parser/SqlParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2004-2010 the Seasar Foundation and the Others.
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 | * http://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,
13 | * either express or implied. See the License for the specific language
14 | * governing permissions and limitations under the License.
15 | */
16 | package com.miragesql.miragesql.parser;
17 |
18 | /**
19 | * {@link SqlParser} parses SQL and construct tree of {@link Node}.
20 | *
21 | * @author higa
22 | */
23 | public interface SqlParser {
24 |
25 | /**
26 | * Parse SQL and return {@link Node} tree.
27 | *
28 | * @return root {@link Node}
29 | */
30 | Node parse();
31 | }
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/bean/Book.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.bean;
2 |
3 | import com.miragesql.miragesql.annotation.Enumerated;
4 | import com.miragesql.miragesql.annotation.Enumerated.EnumType;
5 | import com.miragesql.miragesql.annotation.PrimaryKey;
6 | import com.miragesql.miragesql.annotation.Transient;
7 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
8 |
9 | public class Book {
10 | @PrimaryKey(generationType=GenerationType.IDENTITY)
11 | private Integer bookId;
12 | private String bookName;
13 |
14 | @Enumerated(EnumType.STRING)
15 | private BookType bookType;
16 |
17 | public Integer getBookId() {
18 | return bookId;
19 | }
20 | public void setBookId(Integer bookId) {
21 | this.bookId = bookId;
22 | }
23 | @Transient
24 | public String getBookName() {
25 | return bookName;
26 | }
27 | public void setBookName(String bookName) {
28 | this.bookName = bookName;
29 | }
30 | public BookType getBookType() {
31 | return bookType;
32 | }
33 | public void setBookType(BookType bookType) {
34 | this.bookType = bookType;
35 | }
36 | }
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/Table.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | import com.miragesql.miragesql.naming.NameConverter;
10 |
11 | /**
12 | * Annotation that specifies the DB table name which is mapped to the entity class.
13 | *
14 | * By default, Mirage-SQL converts the entity class name to the table name using {@link NameConverter}.
15 | * However if the entity class has this annotation, Mirage-SQL uses the specified table name instead of
16 | * NameConverter conversion.
17 | *
18 | * @author Naoki Takezoe
19 | */
20 | @Retention(RetentionPolicy.RUNTIME)
21 | @Target(ElementType.TYPE)
22 | @Documented
23 | public @interface Table {
24 |
25 | /**
26 | * The table name which is mapped to the annotated entity class.
27 | *
28 | * @return the table name.
29 | */
30 | String name();
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/util/ReflectionUtil.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.util;
2 |
3 | import java.lang.reflect.Field;
4 | import java.lang.reflect.Type;
5 |
6 | public class ReflectionUtil {
7 |
8 | public static Field getField(Class> clazz, String name){
9 | while(clazz != Object.class){
10 | try {
11 | Field field = clazz.getDeclaredField(name);
12 | if(field != null){
13 | return field;
14 | }
15 | } catch(Exception ex){
16 | // ignore
17 | }
18 | clazz = clazz.getSuperclass();
19 | }
20 | return null;
21 | }
22 |
23 | public static Class> getElementTypeOfList(final Type parameterizedList) {
24 | return GenericUtil.getRawClass(GenericUtil
25 | .getElementTypeOfList(parameterizedList));
26 | }
27 |
28 | public static Class> getElementTypeOfListFromFieldType(final Field field) {
29 | final Type type = field.getGenericType();
30 | return getElementTypeOfList(type);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/naming/NameConverter.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.naming;
2 |
3 | import com.miragesql.miragesql.SqlManager;
4 |
5 | /**
6 | * The interface of the converter which converts table / column names and entity / property names.
7 | *
8 | * @author Naoki Takezoe
9 | * @see SqlManager#setNameConverter(NameConverter)
10 | */
11 | public interface NameConverter {
12 |
13 | /**
14 | * Converts the property name to the column name.
15 | *
16 | * @param propertyName the property name
17 | * @return the column name
18 | */
19 | String propertyToColumn(String propertyName);
20 |
21 | /**
22 | * Converts the column name to the property name.
23 | *
24 | * @param columnName the column name
25 | * @return the property name
26 | */
27 | String columnToProperty(String columnName);
28 |
29 | /**
30 | * Converts the entity name to the table name.
31 | *
32 | * @param entityName the entity name
33 | * @return the table name
34 | */
35 | String entityToTable(String entityName);
36 |
37 | // public String tableToEntity(String tableName);
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/parser/ContainerNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2004-2010 the Seasar Foundation and the Others.
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 | * http://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,
13 | * either express or implied. See the License for the specific language
14 | * governing permissions and limitations under the License.
15 | */
16 | package com.miragesql.miragesql.parser;
17 |
18 | /**
19 | * Base {@link Node} that can contain other nodes.
20 | *
21 | * @author higa
22 | */
23 | public class ContainerNode extends AbstractNode {
24 |
25 | public ContainerNode() {
26 | }
27 |
28 | // @Override
29 | public void accept(SqlContext ctx) {
30 | for (int i = 0; i < getChildSize(); ++i) {
31 | getChild(i).accept(ctx);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/miragesql-integration/src/main/java/com/miragesql/miragesql/integration/guice/MirageModule.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.integration.guice;
2 |
3 | import com.miragesql.miragesql.SqlManager;
4 | import com.miragesql.miragesql.session.Session;
5 | import com.miragesql.miragesql.session.SessionFactory;
6 |
7 | import com.google.inject.AbstractModule;
8 | import com.google.inject.Provides;
9 | import com.google.inject.Singleton;
10 | import com.google.inject.matcher.Matchers;
11 |
12 | /**
13 | * The Module implementation to use Mirage-SQL with Google Guice.
14 | *
15 | * @author Naoki Takezoe
16 | */
17 | public class MirageModule extends AbstractModule {
18 |
19 | // @Override
20 | protected void configure() {
21 | bindInterceptor(
22 | Matchers.any(),
23 | Matchers.annotatedWith(Transactional.class),
24 | new TransactionInterceptor());
25 | }
26 |
27 | @Provides
28 | @Singleton
29 | public Session getSession(){
30 | return SessionFactory.getSession();
31 | }
32 |
33 | @Provides
34 | @Singleton
35 | public SqlManager getSqlManager(Session session){
36 | return session.getSqlManager();
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/PostgreSQLDialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
4 | import com.miragesql.miragesql.type.PostgreResultSetValueType;
5 | import com.miragesql.miragesql.type.ValueType;
6 |
7 | // TODO LargeObject support
8 | public class PostgreSQLDialect extends StandardDialect {
9 |
10 | private PostgreResultSetValueType valueType = new PostgreResultSetValueType();
11 |
12 | /**{@inheritDoc}*/
13 | @Override
14 | public String getName() {
15 | return "postgresql";
16 | }
17 |
18 | /**{@inheritDoc}*/
19 | @Override
20 | public ValueType> getValueType(){
21 | return valueType;
22 | }
23 |
24 | /**{@inheritDoc}*/
25 | @Override
26 | public String getSequenceSql(String sequenceName) {
27 | return String.format("SELECT NEXTVAL('%s')", sequenceName);
28 | }
29 |
30 | /**{@inheritDoc}*/
31 | @Override
32 | public boolean supportsGenerationType(GenerationType generationType) {
33 | if(generationType == GenerationType.IDENTITY){
34 | return false;
35 | }
36 | return true;
37 | }
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/miragesql-integration/build.gradle:
--------------------------------------------------------------------------------
1 | uploadArchives.repositories.mavenDeployer {
2 | pom.project {
3 | name 'Mirage-SQL Integration'
4 | description 'Mirage-SQL Integration is an easy way to integrate Mirage-SQL with Spring, Guice or Seasar2'
5 | }
6 | }
7 |
8 | dependencies {
9 | compile rootProject
10 | compile project(":miragesql-test")
11 |
12 | compile 'org.slf4j:slf4j-api:1.7.25'
13 |
14 | compile 'commons-dbcp:commons-dbcp:1.4', optional
15 | compile 'com.zaxxer:HikariCP:2.7.2', optional
16 |
17 | compile "org.springframework:spring-core:5.3.10", optional
18 | compile "org.springframework:spring-context:5.3.10", optional
19 | compile "org.springframework:spring-jdbc:5.3.10", optional
20 |
21 | compile "com.google.inject:guice:5.0.1", optional
22 |
23 |
24 | compileOnly 'org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1.1'
25 | compileOnly 'javax.servlet:servlet-api:2.5'
26 |
27 | compile 'junit:junit:4.12'
28 | testImplementation 'cglib:cglib:3.2.5'
29 | testImplementation 'org.mockito:mockito-core:2.13.0'
30 | testImplementation 'com.h2database:h2:1.4.196'
31 | testImplementation 'org.hsqldb:hsqldb:2.4.0'
32 |
33 | testImplementation 'org.springframework:spring-aop:5.3.10'
34 | }
35 |
--------------------------------------------------------------------------------
/miragesql-test/src/main/java/com/miragesql/miragesql/test/MockSqlManager.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.test;
2 |
3 | import com.miragesql.miragesql.SqlManager;
4 | import com.miragesql.miragesql.SqlManagerImpl;
5 |
6 | /**
7 | * The mock class of {@link SqlManager} for unit testing.
8 | *
9 | * You can run your code which uses SqlManager without database
10 | * using this class instead of {@link SqlManagerImpl}.
11 | * You can also verify executed SQLs via {@link MirageTestContext}.
12 | *
13 | * @author Naoki Takezoe
14 | * @see MockSqlExecuter
15 | * @see MockCallExecuter
16 | * @see MirageTestContext
17 | */
18 | public class MockSqlManager extends SqlManagerImpl {
19 |
20 | /**
21 | * Constructor.
22 | */
23 | public MockSqlManager() {
24 | super();
25 |
26 | this.sqlExecutor = new MockSqlExecuter();
27 | this.sqlExecutor.setNameConverter(this.nameConverter);
28 | this.sqlExecutor.setDialect(this.dialect);
29 |
30 | this.callExecutor = new MockCallExecuter();
31 | this.callExecutor.setNameConverter(this.nameConverter);
32 | this.callExecutor.setDialect(this.dialect);
33 | }
34 |
35 | // TODO GenerationType.SEQUENCE processing
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/parser/ElseNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2004-2010 the Seasar Foundation and the Others.
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 | * http://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,
13 | * either express or implied. See the License for the specific language
14 | * governing permissions and limitations under the License.
15 | */
16 | package com.miragesql.miragesql.parser;
17 |
18 | /**
19 | * {@link Node} representing an ELSE comment.
20 | *
21 | * @author higa
22 | */
23 | public class ElseNode extends ContainerNode {
24 |
25 | public ElseNode() {
26 | }
27 |
28 | @Override
29 | public void accept(SqlContext ctx) {
30 | super.accept(ctx);
31 | ctx.setEnabled(true);
32 | }
33 |
34 | @Override
35 | public String toString() {
36 | return "ElseNode [children=" + children + "]";
37 | }
38 | }
--------------------------------------------------------------------------------
/src/test/java/com/miragesql/miragesql/dialect/PostgreSQLDialectTest.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
4 | import com.miragesql.miragesql.type.PostgreResultSetValueType;
5 | import junit.framework.TestCase;
6 |
7 | public class PostgreSQLDialectTest extends TestCase {
8 |
9 | public void testGetName() {
10 | PostgreSQLDialect dialect = new PostgreSQLDialect();
11 | assertEquals("postgresql", dialect.getName());
12 | }
13 |
14 | public void testGetValueType() {
15 | PostgreSQLDialect dialect = new PostgreSQLDialect();
16 | assertTrue(dialect.getValueType() instanceof PostgreResultSetValueType);
17 | }
18 |
19 | public void testGetSequenceSql() {
20 | PostgreSQLDialect dialect = new PostgreSQLDialect();
21 | String sql = dialect.getSequenceSql("SEQUENCE");
22 | assertEquals("SELECT NEXTVAL('SEQUENCE')", sql);
23 | }
24 |
25 | public void testSupportsGenerationType() {
26 | PostgreSQLDialect dialect = new PostgreSQLDialect();
27 | assertTrue(dialect.supportsGenerationType(GenerationType.APPLICATION));
28 | assertFalse(dialect.supportsGenerationType(GenerationType.IDENTITY));
29 | assertTrue(dialect.supportsGenerationType(GenerationType.SEQUENCE));
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/util/JdbcUtil.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.util;
2 |
3 | import java.sql.Connection;
4 | import java.sql.ResultSet;
5 | import java.sql.Statement;
6 |
7 | /**
8 | * Provides utility methods for JDBC operation.
9 | *
10 | * @author Naoki Takezoe
11 | */
12 | public class JdbcUtil {
13 |
14 | /**
15 | * Closes the Connection with no exceptions.
16 | *
17 | * @param conn the Connection to close
18 | */
19 | public static void close(Connection conn){
20 | if(conn != null) { try { conn.close(); } catch (Exception ex) { /* ignore */ } }
21 | }
22 |
23 | /**
24 | * Closes the Statement with no exceptions.
25 | *
26 | * @param stmt the Statement to close
27 | */
28 | public static void close(Statement stmt){
29 | if(stmt != null) { try { stmt.close(); } catch (Exception ex) { /* ignore */ } }
30 | }
31 |
32 | /**
33 | * Closes the ResultSet with no exceptions.
34 | *
35 | * @param rs the ResultSet to close
36 | */
37 | public static void close(ResultSet rs){
38 | if(rs != null) { try { rs.close(); } catch (Exception ex) { /* ignore */ } }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/provider/DefaultConnectionProvider.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.provider;
2 |
3 | import java.sql.Connection;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 |
7 | import com.miragesql.miragesql.util.JdbcUtil;
8 |
9 | /**
10 | * The simple implementation of {@link ConnectionProvider}.
11 | *
12 | * @author Naoki Takezoe
13 | */
14 | public class DefaultConnectionProvider implements ConnectionProvider {
15 |
16 | private static final Logger logger = LoggerFactory.getLogger(DefaultConnectionProvider.class);
17 |
18 | private ThreadLocal threadLocal = new ThreadLocal<>();
19 |
20 | public void setConnection(Connection conn){
21 | threadLocal.set(conn);
22 | }
23 |
24 | public void releaseConnection(){
25 | Connection conn = threadLocal.get();
26 | if(conn != null){
27 | JdbcUtil.close(conn);
28 | threadLocal.remove();
29 |
30 | logger.info("Connection is released.");
31 |
32 | } else {
33 | logger.info("Connection is not used.");
34 | }
35 | }
36 |
37 | // @Override
38 | /**{@inheritDoc}*/
39 | public Connection getConnection() {
40 | return threadLocal.get();
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/PrimaryKey.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Annotation indicating that a property corresponds to the DB primary key column.
11 | *
12 | * @author Naoki Takezoe
13 | */
14 | @Target({ElementType.FIELD, ElementType.METHOD})
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Documented
17 | public @interface PrimaryKey {
18 |
19 | GenerationType generationType();
20 |
21 | String generator() default "";
22 |
23 | /**
24 | * The type of the generated primary key. Supported types are: APPLICATION, IDENTITY and
25 | * SEQUENCE.
26 | */
27 | enum GenerationType {
28 | /** The primary key is generated by the application itself. */
29 | APPLICATION,
30 |
31 | /** The primary key is generated by the database using autoid/identity type of functionality. */
32 | IDENTITY,
33 |
34 | /** The primary key is generated by the database using a sequence. */
35 | SEQUENCE
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/dialect/OracleDialect.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.dialect;
2 |
3 | import com.miragesql.miragesql.annotation.PrimaryKey.GenerationType;
4 | import com.miragesql.miragesql.type.OracleResultSetValueType;
5 | import com.miragesql.miragesql.type.ValueType;
6 |
7 | public class OracleDialect extends StandardDialect {
8 |
9 | private OracleResultSetValueType valueType = new OracleResultSetValueType();
10 |
11 | /**{@inheritDoc}*/
12 | @Override
13 | public String getName() {
14 | return "oracle";
15 | }
16 |
17 | /**{@inheritDoc}*/
18 | @Override
19 | public boolean needsParameterForResultSet() {
20 | return true;
21 | }
22 |
23 | /**{@inheritDoc}*/
24 | @Override
25 | public ValueType> getValueType() {
26 | return valueType;
27 | }
28 |
29 | /**{@inheritDoc}*/
30 | @Override
31 | public String getSequenceSql(String sequenceName) {
32 | return String.format("SELECT %s.NEXTVAL FROM DUAL", sequenceName);
33 | }
34 |
35 | /**{@inheritDoc}*/
36 | @Override
37 | public boolean supportsGenerationType(GenerationType generationType) {
38 | if(generationType == GenerationType.IDENTITY){
39 | return false;
40 | }
41 | return true;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/test/groovy/com/miragesql/miragesql/bean/BeanDescFactorySpec.groovy:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.bean
2 |
3 | import spock.lang.Specification
4 | import org.apache.commons.lang3.builder.ToStringBuilder
5 |
6 | class BeanDescFactorySpec extends Specification {
7 | public "getBeanDesc Obj with Data"() {
8 | when:
9 | BeanDescFactory factory = new BeanDescFactory()
10 | def desc = factory.getBeanDesc(obj)
11 | println "desc:"+ToStringBuilder.reflectionToString(desc)
12 | then:
13 | desc.propertyDescSize == size
14 | where:
15 | obj || size
16 | new BookChanged() || 5
17 | new BookRaw() || 5
18 | [id:1,name:"a"] || 2
19 | }
20 |
21 | public "getBeanDesc Class with Data"() {
22 | when:
23 | BeanDescFactory factory = new BeanDescFactory()
24 | def desc = factory.getBeanDesc(clazz)
25 | println "desc:"+ToStringBuilder.reflectionToString(desc)
26 | then:
27 | desc.propertyDescSize == size
28 | where:
29 | clazz || size
30 | BookChanged.class || 5
31 | BookRaw.class || 5
32 | Map.class || 0
33 | LinkedHashMap.class || 0
34 | }
35 |
36 | }
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/naming/RailsLikeNameConverter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Daisuke Miyamoto.
3 | * Created on 2011/10/21
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14 | * either express or implied. See the License for the specific language
15 | * governing permissions and limitations under the License.
16 | */
17 | package com.miragesql.miragesql.naming;
18 |
19 | /**
20 | * An implementation of {@link NameConverter} which provides naming convention like Ruby on Rails, i.e.
21 | * it also pluralizes table names using the {@link Inflection} utility for English names only.
22 | *
23 | * @since 1.1.4
24 | * @author daisuke
25 | */
26 | public class RailsLikeNameConverter extends DefaultNameConverter {
27 |
28 | /**{@inheritDoc}*/
29 | @Override
30 | public String entityToTable(String entityName) {
31 | String pluralized = Inflection.pluralize(entityName);
32 | return super.entityToTable(pluralized);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/annotation/Column.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | import com.miragesql.miragesql.naming.NameConverter;
10 |
11 | /**
12 | * Annotation that specifies the DB column name which is mapped to the annotated property.
13 | *
14 | * By default, Mirage-SQL converts the property name to the column name using {@link NameConverter}.
15 | * However if the entity property has this annotation, Mirage-SQL uses the specified column name instead of
16 | * NameConverter conversion.
17 | *
18 | * @author Naoki Takezoe
19 | * @author SHUJI Watanabe
20 | */
21 | @Retention(RetentionPolicy.RUNTIME)
22 | @Target({ElementType.FIELD, ElementType.METHOD})
23 | @Documented
24 | public @interface Column {
25 |
26 | /**
27 | * The column name which is mapped to the annotated property.
28 | *
29 | * @return the column name.
30 | */
31 | String name();
32 |
33 | /**
34 | * The place holder when generate insert / update SQL.
35 | * Defaults to value: ?
36 | *
37 | * @return the place holder
38 | */
39 | String placeHolder() default "?";
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/miragesql/miragesql/type/ObjectValueType.java:
--------------------------------------------------------------------------------
1 | package com.miragesql.miragesql.type;
2 |
3 | import java.sql.CallableStatement;
4 | import java.sql.PreparedStatement;
5 | import java.sql.ResultSet;
6 | import java.sql.SQLException;
7 |
8 | public class ObjectValueType extends AbstractValueType