├── .gitignore ├── EclipseFormatter.xml ├── LICENSE.md ├── README.md ├── README_ENG.md ├── arch.png ├── command.bat ├── core ├── pom.xml └── src │ ├── main │ └── java │ │ ├── com │ │ └── github │ │ │ └── drinkjava2 │ │ │ ├── asm │ │ │ ├── AnnotationVisitor.java │ │ │ ├── AnnotationWriter.java │ │ │ ├── Attribute.java │ │ │ ├── ByteVector.java │ │ │ ├── ClassReader.java │ │ │ ├── ClassTooLargeException.java │ │ │ ├── ClassVisitor.java │ │ │ ├── ClassWriter.java │ │ │ ├── ConstantDynamic.java │ │ │ ├── Constants.java │ │ │ ├── Context.java │ │ │ ├── CurrentFrame.java │ │ │ ├── Edge.java │ │ │ ├── FieldVisitor.java │ │ │ ├── FieldWriter.java │ │ │ ├── Frame.java │ │ │ ├── Handle.java │ │ │ ├── Handler.java │ │ │ ├── Label.java │ │ │ ├── MethodTooLargeException.java │ │ │ ├── MethodVisitor.java │ │ │ ├── MethodWriter.java │ │ │ ├── ModuleVisitor.java │ │ │ ├── ModuleWriter.java │ │ │ ├── Opcodes.java │ │ │ ├── Symbol.java │ │ │ ├── SymbolTable.java │ │ │ ├── Type.java │ │ │ ├── TypePath.java │ │ │ ├── TypeReference.java │ │ │ └── package-info.java │ │ │ ├── cglib │ │ │ ├── Readme.java │ │ │ ├── beans │ │ │ │ ├── BeanCopier.java │ │ │ │ ├── BeanGenerator.java │ │ │ │ ├── BeanMap.java │ │ │ │ ├── BeanMapEmitter.java │ │ │ │ ├── BulkBean.java │ │ │ │ ├── BulkBeanEmitter.java │ │ │ │ ├── BulkBeanException.java │ │ │ │ ├── FixedKeySet.java │ │ │ │ └── ImmutableBean.java │ │ │ ├── core │ │ │ │ ├── AbstractClassGenerator.java │ │ │ │ ├── Block.java │ │ │ │ ├── ClassEmitter.java │ │ │ │ ├── ClassGenerator.java │ │ │ │ ├── ClassInfo.java │ │ │ │ ├── ClassNameReader.java │ │ │ │ ├── ClassesKey.java │ │ │ │ ├── CodeEmitter.java │ │ │ │ ├── CodeGenerationException.java │ │ │ │ ├── CollectionUtils.java │ │ │ │ ├── Constants.java │ │ │ │ ├── Converter.java │ │ │ │ ├── Customizer.java │ │ │ │ ├── DebuggingClassWriter.java │ │ │ │ ├── DefaultGeneratorStrategy.java │ │ │ │ ├── DefaultNamingPolicy.java │ │ │ │ ├── DuplicatesPredicate.java │ │ │ │ ├── EmitUtils.java │ │ │ │ ├── GeneratorStrategy.java │ │ │ │ ├── KeyFactory.java │ │ │ │ ├── Local.java │ │ │ │ ├── LocalVariablesSorter.java │ │ │ │ ├── MethodInfo.java │ │ │ │ ├── MethodInfoTransformer.java │ │ │ │ ├── MethodWrapper.java │ │ │ │ ├── NamingPolicy.java │ │ │ │ ├── ObjectSwitchCallback.java │ │ │ │ ├── Predicate.java │ │ │ │ ├── ProcessArrayCallback.java │ │ │ │ ├── ProcessSwitchCallback.java │ │ │ │ ├── ReflectUtils.java │ │ │ │ ├── RejectModifierPredicate.java │ │ │ │ ├── Signature.java │ │ │ │ ├── TinyBitSet.java │ │ │ │ ├── Transformer.java │ │ │ │ ├── TypeUtils.java │ │ │ │ └── VisibilityPredicate.java │ │ │ ├── proxy │ │ │ │ ├── BridgeMethodResolver.java │ │ │ │ ├── Callback.java │ │ │ │ ├── CallbackFilter.java │ │ │ │ ├── CallbackGenerator.java │ │ │ │ ├── CallbackHelper.java │ │ │ │ ├── CallbackInfo.java │ │ │ │ ├── Dispatcher.java │ │ │ │ ├── DispatcherGenerator.java │ │ │ │ ├── Enhancer.java │ │ │ │ ├── Factory.java │ │ │ │ ├── FixedValue.java │ │ │ │ ├── FixedValueGenerator.java │ │ │ │ ├── InterfaceMaker.java │ │ │ │ ├── InvocationHandler.java │ │ │ │ ├── InvocationHandlerGenerator.java │ │ │ │ ├── LazyLoader.java │ │ │ │ ├── LazyLoaderGenerator.java │ │ │ │ ├── MethodInterceptor.java │ │ │ │ ├── MethodInterceptorGenerator.java │ │ │ │ ├── MethodProxy.java │ │ │ │ ├── Mixin.java │ │ │ │ ├── MixinBeanEmitter.java │ │ │ │ ├── MixinEmitter.java │ │ │ │ ├── MixinEverythingEmitter.java │ │ │ │ ├── NoOp.java │ │ │ │ ├── NoOpGenerator.java │ │ │ │ ├── Proxy.java │ │ │ │ ├── ProxyRefDispatcher.java │ │ │ │ └── UndeclaredThrowableException.java │ │ │ ├── reflect │ │ │ │ ├── ConstructorDelegate.java │ │ │ │ ├── FastClass.java │ │ │ │ ├── FastClassEmitter.java │ │ │ │ ├── FastConstructor.java │ │ │ │ ├── FastMember.java │ │ │ │ ├── FastMethod.java │ │ │ │ ├── MethodDelegate.java │ │ │ │ └── MulticastDelegate.java │ │ │ ├── transform │ │ │ │ ├── AbstractClassFilterTransformer.java │ │ │ │ ├── AbstractClassLoader.java │ │ │ │ ├── AbstractClassTransformer.java │ │ │ │ ├── AnnotationVisitorTee.java │ │ │ │ ├── ClassEmitterTransformer.java │ │ │ │ ├── ClassFilter.java │ │ │ │ ├── ClassFilterTransformer.java │ │ │ │ ├── ClassReaderGenerator.java │ │ │ │ ├── ClassTransformer.java │ │ │ │ ├── ClassTransformerChain.java │ │ │ │ ├── ClassTransformerFactory.java │ │ │ │ ├── ClassTransformerTee.java │ │ │ │ ├── ClassVisitorTee.java │ │ │ │ ├── FieldVisitorTee.java │ │ │ │ ├── MethodFilter.java │ │ │ │ ├── MethodFilterTransformer.java │ │ │ │ ├── MethodVisitorTee.java │ │ │ │ ├── TransformingClassGenerator.java │ │ │ │ ├── TransformingClassLoader.java │ │ │ │ └── impl │ │ │ │ │ ├── AbstractInterceptFieldCallback.java │ │ │ │ │ ├── AccessFieldTransformer.java │ │ │ │ │ ├── AddDelegateTransformer.java │ │ │ │ │ ├── AddInitTransformer.java │ │ │ │ │ ├── AddPropertyTransformer.java │ │ │ │ │ ├── AddStaticInitTransformer.java │ │ │ │ │ ├── FieldProvider.java │ │ │ │ │ ├── FieldProviderTransformer.java │ │ │ │ │ ├── InterceptFieldCallback.java │ │ │ │ │ ├── InterceptFieldEnabled.java │ │ │ │ │ ├── InterceptFieldFilter.java │ │ │ │ │ ├── InterceptFieldTransformer.java │ │ │ │ │ ├── UndeclaredThrowableStrategy.java │ │ │ │ │ └── UndeclaredThrowableTransformer.java │ │ │ └── util │ │ │ │ ├── ParallelSorter.java │ │ │ │ ├── ParallelSorterEmitter.java │ │ │ │ ├── SorterTemplate.java │ │ │ │ └── StringSwitcher.java │ │ │ ├── jbeanbox │ │ │ ├── AopUtils.java │ │ │ ├── BeanBox.java │ │ │ ├── BeanBoxContext.java │ │ │ ├── BeanBoxException.java │ │ │ ├── BeanBoxUtils.java │ │ │ ├── ClassScanner.java │ │ │ ├── EMPTY.java │ │ │ ├── JBEANBOX.java │ │ │ ├── NameMatchUtil.java │ │ │ ├── PrototypeBean.java │ │ │ ├── ProxyBean.java │ │ │ ├── ReflectionUtils.java │ │ │ ├── ValueTranslator.java │ │ │ └── annotation │ │ │ │ ├── AOP.java │ │ │ │ ├── COMPONENT.java │ │ │ │ ├── INJECT.java │ │ │ │ ├── NAMED.java │ │ │ │ ├── POSTCONSTRUCT.java │ │ │ │ ├── PREDESTROY.java │ │ │ │ ├── PROTOTYPE.java │ │ │ │ ├── QUALIFILER.java │ │ │ │ └── VALUE.java │ │ │ ├── jdbpro │ │ │ ├── ClassTranslator.java │ │ │ ├── CustomizedSqlItem.java │ │ │ ├── DbPro.java │ │ │ ├── DbProException.java │ │ │ ├── DefaultOrderSqlHandler.java │ │ │ ├── ImprovedQueryRunner.java │ │ │ ├── JDBC.java │ │ │ ├── JDBPRO.java │ │ │ ├── JdbcContext.java │ │ │ ├── LinkArrayList.java │ │ │ ├── PackageInfo.java │ │ │ ├── PreparedSQL.java │ │ │ ├── SingleTonHandlers.java │ │ │ ├── SqlHandler.java │ │ │ ├── SqlItem.java │ │ │ ├── SqlItemHandler.java │ │ │ ├── SqlOption.java │ │ │ ├── TenantGetter.java │ │ │ ├── Text.java │ │ │ ├── TextUtils.java │ │ │ ├── TxBody.java │ │ │ ├── handler │ │ │ │ ├── CamelHander.java │ │ │ │ ├── PaginHandler.java │ │ │ │ ├── PrintSqlHandler.java │ │ │ │ ├── SimpleCacheHandler.java │ │ │ │ └── TitleArrayListHandler.java │ │ │ └── template │ │ │ │ ├── BasicSqlTemplate.java │ │ │ │ └── SqlTemplateEngine.java │ │ │ ├── jdialects │ │ │ ├── ArrayUtils.java │ │ │ ├── ClassCacheUtils.java │ │ │ ├── DDLCreateUtils.java │ │ │ ├── DDLDropUtils.java │ │ │ ├── DDLFeatures.java │ │ │ ├── DDLFormatter.java │ │ │ ├── DebugUtils.java │ │ │ ├── Dialect.java │ │ │ ├── DialectException.java │ │ │ ├── DialectFunctionTemplate.java │ │ │ ├── DialectFunctionTranslator.java │ │ │ ├── DialectFunctionUtils.java │ │ │ ├── DialectPaginationTemplate.java │ │ │ ├── DialectType.java │ │ │ ├── DialectTypeMappingTemplate.java │ │ │ ├── GuessDialectUtils.java │ │ │ ├── Java8DateUtils.java │ │ │ ├── JdbcUtil.java │ │ │ ├── NamingConversion.java │ │ │ ├── PackageInfo.java │ │ │ ├── ReservedDBWords.java │ │ │ ├── SqlFormatter.java │ │ │ ├── StrUtils.java │ │ │ ├── TableModelUtils.java │ │ │ ├── TableModelUtilsOfDb.java │ │ │ ├── TableModelUtilsOfEntity.java │ │ │ ├── TableModelUtilsOfExcel.java │ │ │ ├── TableModelUtilsOfJavaSrc.java │ │ │ ├── Type.java │ │ │ ├── TypeUtils.java │ │ │ ├── annotation │ │ │ │ ├── jdia │ │ │ │ │ ├── AutoId.java │ │ │ │ │ ├── COLUMN.java │ │ │ │ │ ├── CreateTimestamp.java │ │ │ │ │ ├── CreatedBy.java │ │ │ │ │ ├── FKey.java │ │ │ │ │ ├── FKey1.java │ │ │ │ │ ├── FKey2.java │ │ │ │ │ ├── FKey3.java │ │ │ │ │ ├── IdentityId.java │ │ │ │ │ ├── LastModifiedBy.java │ │ │ │ │ ├── PKey.java │ │ │ │ │ ├── ShardDatabase.java │ │ │ │ │ ├── ShardTable.java │ │ │ │ │ ├── SingleFKey.java │ │ │ │ │ ├── SingleIndex.java │ │ │ │ │ ├── SingleUnique.java │ │ │ │ │ ├── Snowflake.java │ │ │ │ │ ├── TimeStampId.java │ │ │ │ │ ├── UUID.java │ │ │ │ │ ├── UUID25.java │ │ │ │ │ ├── UUID26.java │ │ │ │ │ ├── UUID32.java │ │ │ │ │ ├── UUID36.java │ │ │ │ │ ├── UUIDAny.java │ │ │ │ │ └── UpdateTimestamp.java │ │ │ │ └── jpa │ │ │ │ │ ├── Column.java │ │ │ │ │ ├── Convert.java │ │ │ │ │ ├── Entity.java │ │ │ │ │ ├── EnumType.java │ │ │ │ │ ├── Enumerated.java │ │ │ │ │ ├── GeneratedValue.java │ │ │ │ │ ├── GenerationType.java │ │ │ │ │ ├── Id.java │ │ │ │ │ ├── Index.java │ │ │ │ │ ├── SequenceGenerator.java │ │ │ │ │ ├── Table.java │ │ │ │ │ ├── TableGenerator.java │ │ │ │ │ ├── Temporal.java │ │ │ │ │ ├── TemporalType.java │ │ │ │ │ ├── Transient.java │ │ │ │ │ ├── UniqueConstraint.java │ │ │ │ │ └── Version.java │ │ │ ├── converter │ │ │ │ ├── BasicJavaConverter.java │ │ │ │ ├── BasicJavaToJdbcConverter.java │ │ │ │ ├── BasicJdbcToJavaConverter.java │ │ │ │ ├── JavaConverter.java │ │ │ │ ├── JavaToJdbcConverter.java │ │ │ │ └── JdbcToJavaConverter.java │ │ │ ├── id │ │ │ │ ├── AutoIdGenerator.java │ │ │ │ ├── IdGenerator.java │ │ │ │ ├── IdentityIdGenerator.java │ │ │ │ ├── SequenceIdGenerator.java │ │ │ │ ├── SnowflakeCreator.java │ │ │ │ ├── SnowflakeGenerator.java │ │ │ │ ├── SortedUUIDGenerator.java │ │ │ │ ├── TableIdGenerator.java │ │ │ │ ├── TimeStampIdGenerator.java │ │ │ │ ├── UUID25Generator.java │ │ │ │ ├── UUID26Generator.java │ │ │ │ ├── UUID32Generator.java │ │ │ │ ├── UUID36Generator.java │ │ │ │ ├── UUIDAnyGenerator.java │ │ │ │ └── UUIDGenerator.java │ │ │ ├── model │ │ │ │ ├── ColumnModel.java │ │ │ │ ├── FKeyModel.java │ │ │ │ ├── IndexModel.java │ │ │ │ ├── TableModel.java │ │ │ │ └── UniqueModel.java │ │ │ └── springsrc │ │ │ │ ├── PackageInfo.java │ │ │ │ └── utils │ │ │ │ ├── Assert.java │ │ │ │ ├── ClassUtils.java │ │ │ │ ├── CollectionUtils.java │ │ │ │ ├── ConcurrentReferenceHashMap.java │ │ │ │ ├── ObjectUtils.java │ │ │ │ ├── ReflectionUtils.java │ │ │ │ └── StringUtils.java │ │ │ ├── jlogs │ │ │ ├── ConsoleLog.java │ │ │ ├── EmptyLog.java │ │ │ ├── Log.java │ │ │ ├── LogFactory.java │ │ │ └── SimpleSLF4JLog.java │ │ │ ├── jsqlbox │ │ │ ├── ActiveEntity.java │ │ │ ├── ActiveRecord.java │ │ │ ├── AliasProxyUtil.java │ │ │ ├── CacheTransUtils.java │ │ │ ├── DB.java │ │ │ ├── DbContext.java │ │ │ ├── DbContextUtils.java │ │ │ ├── DbException.java │ │ │ ├── EntityType.java │ │ │ ├── GraphQuery.java │ │ │ ├── JAVA8.java │ │ │ ├── JSQLBOX.java │ │ │ ├── LambdSqlItem.java │ │ │ ├── SQL.java │ │ │ ├── SqlBoxContext.java │ │ │ ├── Tail.java │ │ │ ├── TailType.java │ │ │ ├── converter │ │ │ │ ├── BaseFieldConverter.java │ │ │ │ ├── EnumOrdinalFieldConverter.java │ │ │ │ ├── EnumStringFieldConverter.java │ │ │ │ ├── FieldConverter.java │ │ │ │ ├── FieldConverterUtils.java │ │ │ │ └── VersionFieldConverter.java │ │ │ ├── entitynet │ │ │ │ ├── EntityIdUtils.java │ │ │ │ └── EntityNet.java │ │ │ ├── gtx │ │ │ │ ├── GtxAOP.java │ │ │ │ ├── GtxConnectionManager.java │ │ │ │ ├── GtxId.java │ │ │ │ ├── GtxInfo.java │ │ │ │ ├── GtxLock.java │ │ │ │ ├── GtxLog.java │ │ │ │ ├── GtxTag.java │ │ │ │ ├── GtxUnlockServ.java │ │ │ │ └── GtxUtils.java │ │ │ ├── handler │ │ │ │ ├── EntityListHandler.java │ │ │ │ ├── EntityNetHandler.java │ │ │ │ ├── SSHandler.java │ │ │ │ ├── SSMapListHandler.java │ │ │ │ └── SSTitleArrayListHandler.java │ │ │ ├── sharding │ │ │ │ ├── ShardingModTool.java │ │ │ │ ├── ShardingRangeTool.java │ │ │ │ ├── ShardingTool.java │ │ │ │ └── ShardingUtils.java │ │ │ └── sqlitem │ │ │ │ ├── EntityKeyItem.java │ │ │ │ └── SampleItem.java │ │ │ └── jtransactions │ │ │ ├── ConnectionManager.java │ │ │ ├── DataSourceHolder.java │ │ │ ├── PackageInfo.java │ │ │ ├── ThreadConnectionManager.java │ │ │ ├── TransactionsException.java │ │ │ ├── TxInfo.java │ │ │ ├── TxResult.java │ │ │ ├── grouptx │ │ │ ├── GroupTx.java │ │ │ ├── GroupTxAOP.java │ │ │ └── GroupTxConnectionManager.java │ │ │ ├── jfinal │ │ │ └── JFinalTxConnectionManager.java │ │ │ ├── manual │ │ │ └── ManualTxConnectionManager.java │ │ │ ├── spring │ │ │ └── SpringTxConnectionManager.java │ │ │ └── tinytx │ │ │ ├── TinyTxAOP.java │ │ │ └── TinyTxConnectionManager.java │ │ ├── javax │ │ ├── annotation │ │ │ ├── PostConstruct.java │ │ │ └── PreDestroy.java │ │ └── inject │ │ │ ├── Inject.java │ │ │ ├── Named.java │ │ │ ├── Provider.java │ │ │ ├── Qualifier.java │ │ │ ├── Scope.java │ │ │ └── Singleton.java │ │ └── org │ │ ├── aopalliance │ │ ├── aop │ │ │ ├── Advice.java │ │ │ └── AspectException.java │ │ └── intercept │ │ │ ├── ConstructorInterceptor.java │ │ │ ├── ConstructorInvocation.java │ │ │ ├── Interceptor.java │ │ │ ├── Invocation.java │ │ │ ├── Joinpoint.java │ │ │ ├── MethodInterceptor.java │ │ │ └── MethodInvocation.java │ │ ├── apache │ │ └── commons │ │ │ └── dbutils │ │ │ ├── AbstractQueryRunner.java │ │ │ ├── AsyncQueryRunner.java │ │ │ ├── BaseResultSetHandler.java │ │ │ ├── BasicRowProcessor.java │ │ │ ├── BeanProcessor.java │ │ │ ├── ColumnHandler.java │ │ │ ├── DbUtils.java │ │ │ ├── GenerousBeanProcessor.java │ │ │ ├── OutParameter.java │ │ │ ├── PropertyHandler.java │ │ │ ├── ProxyFactory.java │ │ │ ├── QueryLoader.java │ │ │ ├── QueryRunner.java │ │ │ ├── ResultSetHandler.java │ │ │ ├── ResultSetIterator.java │ │ │ ├── RowProcessor.java │ │ │ ├── StatementConfiguration.java │ │ │ ├── handlers │ │ │ ├── AbstractKeyedHandler.java │ │ │ ├── AbstractListHandler.java │ │ │ ├── ArrayHandler.java │ │ │ ├── ArrayListHandler.java │ │ │ ├── BeanHandler.java │ │ │ ├── BeanListHandler.java │ │ │ ├── BeanMapHandler.java │ │ │ ├── ColumnListHandler.java │ │ │ ├── KeyedHandler.java │ │ │ ├── MapHandler.java │ │ │ ├── MapListHandler.java │ │ │ ├── ScalarHandler.java │ │ │ ├── columns │ │ │ │ ├── BooleanColumnHandler.java │ │ │ │ ├── ByteColumnHandler.java │ │ │ │ ├── DoubleColumnHandler.java │ │ │ │ ├── FloatColumnHandler.java │ │ │ │ ├── IntegerColumnHandler.java │ │ │ │ ├── LongColumnHandler.java │ │ │ │ ├── SQLXMLColumnHandler.java │ │ │ │ ├── ShortColumnHandler.java │ │ │ │ ├── StringColumnHandler.java │ │ │ │ └── TimestampColumnHandler.java │ │ │ ├── package-info.java │ │ │ └── properties │ │ │ │ ├── DatePropertyHandler.java │ │ │ │ └── StringEnumPropertyHandler.java │ │ │ ├── package-info.java │ │ │ └── wrappers │ │ │ ├── SqlNullCheckedResultSet.java │ │ │ ├── StringTrimmedResultSet.java │ │ │ └── package-info.java │ │ └── springframework │ │ ├── beans │ │ └── factory │ │ │ └── annotation │ │ │ ├── Autowired.java │ │ │ ├── Qualifier.java │ │ │ └── Value.java │ │ └── stereotype │ │ ├── Component.java │ │ ├── Controller.java │ │ ├── Repository.java │ │ └── Service.java │ └── test │ ├── java │ └── com │ │ └── github │ │ └── drinkjava2 │ │ ├── common │ │ ├── DataSourceConfig.java │ │ ├── Readme.java │ │ └── Systemout.java │ │ ├── jdbpro │ │ └── HelloWorld.java │ │ ├── jdialects │ │ ├── ClassCacheUtilsTest.java │ │ ├── Java8DateUtilsTest.java │ │ ├── NamingConversionTest.java │ │ ├── SampleDialectTest.java │ │ ├── TableModelTest.java │ │ ├── ToExcelTest.java │ │ ├── config │ │ │ └── JdialectsTestBase.java │ │ ├── entity │ │ │ ├── RoleTB.java │ │ │ └── UserTB.java │ │ └── function │ │ │ ├── AnnotationTest.java │ │ │ ├── DDLFormatterTest.java │ │ │ ├── DDLTest.java │ │ │ ├── Db2ModelsTest.java │ │ │ ├── DialectTest.java │ │ │ ├── EntityAnnotationTest.java │ │ │ ├── FunctionTranslateTest.java │ │ │ ├── ReservedDBWordsTest.java │ │ │ ├── SqlFormatterTest.java │ │ │ └── StrUtilsTest.java │ │ ├── jsqlbox │ │ ├── benchmark │ │ │ ├── BenchMarkTest.java │ │ │ ├── Debuger.java │ │ │ ├── DemoCustomer.java │ │ │ ├── DemoOrder.java │ │ │ ├── DemoUser.java │ │ │ └── TestServiceInterface.java │ │ ├── config │ │ │ └── TestBase.java │ │ ├── function │ │ │ ├── BatchInsertTest.java │ │ │ ├── BatchTest.java │ │ │ ├── CacheTranslateTest.java │ │ │ ├── CamelHanderTest.java │ │ │ ├── CompoundPKeyTest.java │ │ │ ├── ConverterTest.java │ │ │ ├── CrudCompoundIdTest.java │ │ │ ├── CrudTest.java │ │ │ ├── CustomizedSqlItemTest.java │ │ │ ├── DbProLogTest.java │ │ │ ├── DynamicConfigTest.java │ │ │ ├── DynamicPojoConfigTest.java │ │ │ ├── EnumTest.java │ │ │ ├── IdGeneratorInEntityTest.java │ │ │ ├── IdGeneratorTest.java │ │ │ ├── MasterSlaveTest.java │ │ │ ├── OthersTest.java │ │ │ ├── ShardingModToolTest.java │ │ │ ├── ShardingRangeToolTest.java │ │ │ ├── ShardingShardMethodTest.java │ │ │ ├── SqlHandlerGlobalAndThreadedTest.java │ │ │ ├── SqlHandlersTest.java │ │ │ ├── TailTest.java │ │ │ ├── TenantTest.java │ │ │ ├── TextUtilsTest.java │ │ │ ├── UUIDGeneratorsTest.java │ │ │ ├── VersionTest.java │ │ │ ├── entitynet │ │ │ │ ├── EntityNetTest.java │ │ │ │ ├── EntityNetTreeTest.java │ │ │ │ ├── GraphQueryTest.java │ │ │ │ └── entity │ │ │ │ │ ├── Address.java │ │ │ │ │ ├── Email.java │ │ │ │ │ ├── Privilege.java │ │ │ │ │ ├── Role.java │ │ │ │ │ ├── RolePrivilege.java │ │ │ │ │ ├── TreeNode.java │ │ │ │ │ ├── User.java │ │ │ │ │ └── UserRole.java │ │ │ ├── gtx │ │ │ │ ├── GtxShardDbTbLockDbTest.java │ │ │ │ ├── GtxShardDbTbTest.java │ │ │ │ ├── GtxShardDbTest.java │ │ │ │ ├── GtxShardTbTest.java │ │ │ │ ├── GtxTest.java │ │ │ │ └── GtxUnlockServTest.java │ │ │ ├── jdialects │ │ │ │ ├── ColumnTest.java │ │ │ │ ├── EntitySuperclassTest.java │ │ │ │ ├── IdentityIdTest.java │ │ │ │ ├── SqlServerPaginTest.java │ │ │ │ ├── TableModelUtilsOfDbTest.java │ │ │ │ ├── TableModelUtilsOfJavaSrcTest.java │ │ │ │ └── typemapping │ │ │ │ │ ├── DateExtendsTest.java │ │ │ │ │ ├── DateTest.java │ │ │ │ │ ├── DatetimeTimestampTest.java │ │ │ │ │ ├── Java8DateTimeTest.java │ │ │ │ │ └── TypeMappingTest.java │ │ │ ├── jtransactions │ │ │ │ ├── Usr.java │ │ │ │ ├── grouptx │ │ │ │ │ ├── AnnotationGroupTxTest.java │ │ │ │ │ ├── GroupShardTxTest.java │ │ │ │ │ └── GroupTxTest.java │ │ │ │ ├── manultx │ │ │ │ │ └── ManualTxTest.java │ │ │ │ └── tinytx │ │ │ │ │ ├── AnnotationTxDemoTest.java │ │ │ │ │ ├── AnnotationTxTest.java │ │ │ │ │ ├── JavaTxDemoTest.java │ │ │ │ │ ├── JavaTxTest.java │ │ │ │ │ ├── TinyTxTest.java │ │ │ │ │ └── TxMethodTest.java │ │ │ └── quote_column │ │ │ │ ├── QuoteColumnEntityNetTest.java │ │ │ │ ├── QuoteColumnMySqlTest.java │ │ │ │ ├── QuoteColumnOracleTest.java │ │ │ │ ├── QuoteTableEntityNetTest.java │ │ │ │ └── QuoteTableMySqlTest.java │ │ ├── helloworld │ │ │ ├── ActiveRecordDemoTest.java │ │ │ ├── HelloWorld.java │ │ │ └── UsageAndSpeedTest.java │ │ ├── issues │ │ │ ├── I1L5ND_mysql_int_id │ │ │ │ └── I1L5NDTest.java │ │ │ ├── IYDU7_orm_demo │ │ │ │ ├── Ademo.java │ │ │ │ ├── Bdemo.java │ │ │ │ ├── Cdemo.java │ │ │ │ └── IYDU7Test.java │ │ │ └── Readme.java │ │ └── java8 │ │ │ ├── ActiveEntityTest.java │ │ │ ├── HelloWorld.java │ │ │ ├── Java6ExampleTest.java │ │ │ ├── Java8EampleTest.java │ │ │ ├── TransactionDemo.java │ │ │ └── User.java │ │ ├── jtransactions │ │ ├── config │ │ │ └── JTransTinyJdbc.java │ │ └── tinytx │ │ │ └── TinyTxTester.java │ │ └── util │ │ └── JsonUtil.java │ └── resources │ └── text │ └── TextTest.java ├── demo ├── jsqlbox-actframework │ ├── README.md │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── mvn clean compile execexec.bat │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── demo │ │ │ └── transaction │ │ │ └── jsqlbox │ │ │ ├── Account.java │ │ │ ├── MyTX.java │ │ │ └── TransactionDemo.java │ │ └── resources │ │ ├── asset │ │ └── js │ │ │ ├── jquery-1.11.3.min.js │ │ │ └── jquery-ajax-ext.js │ │ ├── conf │ │ └── application.properties │ │ ├── logback.xml │ │ └── rythm │ │ └── demo │ │ └── transaction │ │ └── jsqlbox │ │ └── TransactionDemo │ │ └── home.html ├── jsqlbox-atomikos │ ├── README.md │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── maven_test.bat │ ├── pom.xml │ └── src │ │ └── test │ │ ├── java │ │ └── jsqlboxtx │ │ │ ├── NonXATransactionTest.java │ │ │ └── XATransactionTest.java │ │ └── resources │ │ ├── jta.properties │ │ └── simplelogger.properties ├── jsqlbox-beetl │ ├── README.md │ ├── command.bat │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── maven_test.bat │ ├── pom.xml │ └── src │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── drinkjava2 │ │ │ └── beetlsqldemo │ │ │ ├── BeetlSqlTempalte.java │ │ │ ├── BeetlSqlTemplateDemoTest.java │ │ │ ├── SQLGrammarCreator.java │ │ │ ├── SQLPlaceholderST.java │ │ │ └── SQLTemplateEngine.java │ │ └── resources │ │ ├── common-logging.properties │ │ ├── log4j.properties │ │ └── sql │ │ └── SQLs.java ├── jsqlbox-helloworld │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── HelloWorld.java ├── jsqlbox-jbooox │ ├── README.md │ ├── deploy_tomcat.bat │ ├── deploy_weblogic.bat │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── maven_test.bat │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jsqlboxdemo │ │ │ │ ├── controller │ │ │ │ ├── BaseBox.java │ │ │ │ ├── home.java │ │ │ │ └── team.java │ │ │ │ ├── dispatcher │ │ │ │ └── Dispatcher.java │ │ │ │ ├── init │ │ │ │ └── Initializer.java │ │ │ │ ├── logger │ │ │ │ └── SampleSLF4JLog.java │ │ │ │ └── service │ │ │ │ └── TeamService.java │ │ ├── resources │ │ │ ├── jlogs.properties │ │ │ ├── logback.xml │ │ │ └── model │ │ │ │ └── Team.java │ │ └── webapp │ │ │ ├── META-INF │ │ │ ├── MANIFEST.MF │ │ │ └── context.xml │ │ │ ├── WEB-INF │ │ │ ├── pages │ │ │ │ ├── home.jsp │ │ │ │ ├── team_add.jsp │ │ │ │ ├── team_edit.jsp │ │ │ │ └── team_list.jsp │ │ │ ├── web.xml │ │ │ └── weblogic.xml │ │ │ └── htm2box.jsp │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── jsqlboxdemo │ │ │ ├── TestBase.java │ │ │ ├── controller │ │ │ └── TeamControllerTest.java │ │ │ ├── integration │ │ │ └── IntegrationTest.java │ │ │ ├── log │ │ │ └── LogTest.java │ │ │ ├── mock │ │ │ ├── MockJspWriter.java │ │ │ ├── MockPageContext.java │ │ │ ├── MockRequest.java │ │ │ └── MockRequestDispatcher.java │ │ │ └── service │ │ │ └── TeamServiceTest.java │ │ └── resources │ │ ├── common-logging.properties │ │ └── log4j.properties ├── jsqlbox-jfinal │ ├── Readme.md │ ├── maven start jfinal.bat │ ├── maven_clean.bat │ ├── maven_clean_package.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── demo │ │ │ ├── blog │ │ │ ├── BlogController.java │ │ │ ├── BlogInterceptor.java │ │ │ ├── BlogService.java │ │ │ └── BlogValidator.java │ │ │ ├── common │ │ │ ├── Blog.java │ │ │ └── DemoConfig.java │ │ │ └── index │ │ │ └── IndexController.java │ │ ├── resources │ │ ├── a_little_config.txt │ │ └── log4j.properties │ │ └── webapp │ │ ├── META-INF │ │ └── MANIFEST.MF │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── blog │ │ ├── _form.html │ │ ├── add.html │ │ ├── blog.html │ │ └── edit.html │ │ ├── common │ │ ├── _layout.html │ │ └── _paginate.html │ │ ├── css │ │ └── manage.css │ │ ├── favicon.ico │ │ ├── img │ │ ├── bg.gif │ │ ├── left2.gif │ │ └── right2.gif │ │ ├── index │ │ └── index.html │ │ └── js │ │ └── jquery-1.4.4.min.js ├── jsqlbox-mybatis │ ├── README.md │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── maven_test.bat │ ├── mvn spring-boot run.bat │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── jsqlboxinspringboot │ │ │ │ ├── JsqlboxInSpringbootApplication.java │ │ │ │ ├── controller │ │ │ │ └── Controller.java │ │ │ │ ├── entity │ │ │ │ ├── Customer.java │ │ │ │ └── CustomerMapper.java │ │ │ │ └── services │ │ │ │ └── Services.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── jsqlboxinspringboot │ │ └── JsqlboxInSpringbootApplicationTests.java ├── jsqlbox-qclass │ ├── README.md │ ├── command.bat │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── maven_test.bat │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── drinkjava2 │ │ ├── User.java │ │ └── demo │ │ ├── jpa │ │ └── QClassDemo.java │ │ ├── jsqlbox1 │ │ ├── QClassDemo.java │ │ └── QUserDemo.java │ │ └── jsqlbox2 │ │ ├── QClassDemo.java │ │ └── QUserDemo.java ├── jsqlbox-spring │ ├── README.md │ ├── deploy_tomcat.bat │ ├── deploy_weblogic.bat │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── maven_test.bat │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── demo │ │ │ │ ├── controller │ │ │ │ ├── LinkController.java │ │ │ │ └── TeamController.java │ │ │ │ ├── init │ │ │ │ ├── Initializer.java │ │ │ │ └── WebAppConfig.java │ │ │ │ ├── model │ │ │ │ └── Team.java │ │ │ │ └── service │ │ │ │ └── TeamService.java │ │ ├── resources │ │ │ ├── common-logging.properties │ │ │ └── log4j.properties │ │ └── webapp │ │ │ ├── META-INF │ │ │ ├── MANIFEST.MF │ │ │ └── maven │ │ │ │ └── com.mvchib │ │ │ │ └── spring │ │ │ │ ├── pom.properties │ │ │ │ └── pom.xml │ │ │ └── WEB-INF │ │ │ ├── pages │ │ │ ├── add-team-form.jsp │ │ │ ├── edit-team-form.jsp │ │ │ ├── home.jsp │ │ │ └── list-of-teams.jsp │ │ │ ├── web.xml │ │ │ └── weblogic.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── demo │ │ ├── init │ │ └── BaseTestConfig.java │ │ ├── services │ │ └── TeamServiceTest.java │ │ └── test │ │ └── LinkControllerTest.java ├── jsqlbox-springboot │ ├── README.md │ ├── maven_clean.bat │ ├── maven_eclipse_clean.bat │ ├── maven_eclipse_eclipse.bat │ ├── maven_test.bat │ ├── mvn spring-boot run.bat │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── jsqlboxinspringboot │ │ │ │ ├── JsqlboxInSpringbootApplication.java │ │ │ │ ├── controller │ │ │ │ └── Controller.java │ │ │ │ ├── entity │ │ │ │ └── Customer.java │ │ │ │ └── services │ │ │ │ └── Services.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── jsqlboxinspringboot │ │ └── JsqlboxInSpringbootApplicationTests.java ├── mvn_clean_all.bat └── mvn_eclipse_all.bat ├── jsqlbox-logo.png ├── orm.png └── tree.png /.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | target/ 3 | bin/ 4 | .project 5 | .classpath 6 | .settings/ 7 | *~ 8 | *.orig 9 | *.new 10 | .idea/ 11 | *.iml 12 | *.ipr 13 | test/**/build/ 14 | examples/**/build/ -------------------------------------------------------------------------------- /arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drinkjava2/jSqlBox/94e2e6ba9101b9aeab0493561aee2bc166957095/arch.png -------------------------------------------------------------------------------- /command.bat: -------------------------------------------------------------------------------- 1 | cmd -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/asm/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * jBeanBox's repackaging of ASM 3 | * 7.0 for internal use only). 4 | * 5 | *

6 | * This repackaging technique avoids any potential conflicts with dependencies 7 | * on ASM at the application level or from third-party libraries and frameworks. 8 | */ 9 | package com.github.drinkjava2.asm; 10 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/Readme.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.drinkjava2.cglib;//NOSONAR 3 | 4 | /** 5 | * To avoid jar conflict if a project need use other version CGLIB, I included cglib3.2.0 source code in this project 6 | * and changed its package name 7 | * 8 | * @author Yong 9 | * @since 2.4.1 10 | * 11 | */ 12 | class Readme {// NOSONAR 13 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/beans/BulkBeanException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.beans; 17 | @SuppressWarnings("serial") 18 | public class BulkBeanException extends RuntimeException 19 | { 20 | private int index; 21 | private Throwable cause; 22 | 23 | public BulkBeanException(String message, int index) { 24 | super(message); 25 | this.index = index; 26 | } 27 | 28 | public BulkBeanException(Throwable cause, int index) { 29 | super(cause.getMessage()); 30 | this.index = index; 31 | this.cause = cause; 32 | } 33 | 34 | public int getIndex() { 35 | return index; 36 | } 37 | 38 | public Throwable getCause() { 39 | return cause; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/beans/FixedKeySet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.beans; 17 | 18 | import java.util.*; 19 | 20 | @SuppressWarnings({"rawtypes","unchecked"}) 21 | public /* need it for class loading */ class FixedKeySet extends AbstractSet { 22 | private Set set; 23 | private int size; 24 | 25 | 26 | public FixedKeySet(String[] keys) { 27 | size = keys.length; 28 | set = Collections.unmodifiableSet(new HashSet(Arrays.asList(keys))); 29 | } 30 | 31 | public Iterator iterator() { 32 | return set.iterator(); 33 | } 34 | 35 | public int size() { 36 | return size; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/Block.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import com.github.drinkjava2.asm.Label; 19 | 20 | public class Block 21 | { 22 | private CodeEmitter e; 23 | private Label start; 24 | private Label end; 25 | 26 | public Block(CodeEmitter e) { 27 | this.e = e; 28 | start = e.mark(); 29 | } 30 | 31 | public CodeEmitter getCodeEmitter() { 32 | return e; 33 | } 34 | 35 | public void end() { 36 | if (end != null) { 37 | throw new IllegalStateException("end of label already set"); 38 | } 39 | end = e.mark(); 40 | } 41 | 42 | public Label getStart() { 43 | return start; 44 | } 45 | 46 | public Label getEnd() { 47 | return end; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/ClassGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import com.github.drinkjava2.asm.ClassVisitor; 19 | 20 | public interface ClassGenerator { 21 | void generateClass(ClassVisitor v) throws Exception; 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/ClassesKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | public class ClassesKey { 19 | private static final Key FACTORY = (Key)KeyFactory.create(Key.class, KeyFactory.OBJECT_BY_CLASS); 20 | 21 | interface Key { 22 | Object newInstance(Object[] array); 23 | } 24 | 25 | private ClassesKey() { 26 | } 27 | 28 | public static Object create(Object[] array) { 29 | return FACTORY.newInstance(array); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/CodeGenerationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | /** 19 | * @version $Id: CodeGenerationException.java,v 1.3 2004/06/24 21:15:21 herbyderby Exp $ 20 | */ 21 | @SuppressWarnings("serial") 22 | public class CodeGenerationException extends RuntimeException { 23 | private Throwable cause; 24 | 25 | public CodeGenerationException(Throwable cause) { 26 | super(cause.getClass().getName() + "-->" + cause.getMessage()); 27 | this.cause = cause; 28 | } 29 | 30 | public Throwable getCause() { 31 | return cause; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/Converter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | @SuppressWarnings({"rawtypes"}) 18 | public interface Converter { 19 | Object convert(Object value, Class target, Object context); 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/Customizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import com.github.drinkjava2.asm.Type; 19 | 20 | public interface Customizer { 21 | void customize(CodeEmitter e, Type type); 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/DuplicatesPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import java.lang.reflect.Method; 19 | import java.util.*; 20 | @SuppressWarnings({"rawtypes","unchecked" }) 21 | public class DuplicatesPredicate implements Predicate { 22 | private Set unique = new HashSet(); 23 | 24 | public boolean evaluate(Object arg) { 25 | return unique.add(MethodWrapper.create((Method)arg)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/Local.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import com.github.drinkjava2.asm.Type; 19 | 20 | public class Local 21 | { 22 | private Type type; 23 | private int index; 24 | 25 | public Local(int index, Type type) { 26 | this.type = type; 27 | this.index = index; 28 | } 29 | 30 | public int getIndex() { 31 | return index; 32 | } 33 | 34 | public Type getType() { 35 | return type; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/ObjectSwitchCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import com.github.drinkjava2.asm.Label; 19 | 20 | public interface ObjectSwitchCallback { 21 | void processCase(Object key, Label end) throws Exception; 22 | void processDefault() throws Exception; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/Predicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | public interface Predicate { 19 | boolean evaluate(Object arg); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/ProcessArrayCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import com.github.drinkjava2.asm.Type; 19 | 20 | public interface ProcessArrayCallback { 21 | void processElement(Type type); 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/ProcessSwitchCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import com.github.drinkjava2.asm.Label; 19 | 20 | public interface ProcessSwitchCallback { 21 | void processCase(int key, Label end) throws Exception; 22 | void processDefault() throws Exception; 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/RejectModifierPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | import java.lang.reflect.*; 19 | 20 | public class RejectModifierPredicate implements Predicate { 21 | private int rejectMask; 22 | 23 | public RejectModifierPredicate(int rejectMask) { 24 | this.rejectMask = rejectMask; 25 | } 26 | 27 | public boolean evaluate(Object arg) { 28 | return (((Member)arg).getModifiers() & rejectMask) == 0; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/core/Transformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.core; 17 | 18 | public interface Transformer { 19 | Object transform(Object value); 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/proxy/Callback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.proxy; 17 | 18 | /** 19 | * All callback interfaces used by {@link Enhancer} extend this interface. 20 | * @see MethodInterceptor 21 | * @see NoOp 22 | * @see LazyLoader 23 | * @see Dispatcher 24 | * @see InvocationHandler 25 | * @see FixedValue 26 | */ 27 | public interface Callback 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/proxy/Dispatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.proxy; 17 | 18 | /** 19 | * Dispatching {@link Enhancer} callback. This is identical to the 20 | * {@link LazyLoader} interface but needs to be separate so that Enhancer 21 | * knows which type of code to generate. 22 | */ 23 | public interface Dispatcher extends Callback { 24 | /** 25 | * Return the object which the original method invocation should 26 | * be dispatched. This method is called for every method invocation. 27 | * @return an object that can invoke the method 28 | */ 29 | Object loadObject() throws Exception; 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/proxy/LazyLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.proxy; 17 | 18 | /** 19 | * Lazy-loading {@link Enhancer} callback. 20 | */ 21 | public interface LazyLoader extends Callback { 22 | /** 23 | * Return the object which the original method invocation should be 24 | * dispatched. Called as soon as the first lazily-loaded method in 25 | * the enhanced instance is invoked. The same object is then used 26 | * for every future method call to the proxy instance. 27 | * @return an object that can invoke the method 28 | */ 29 | Object loadObject() throws Exception; 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/proxy/NoOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.proxy; 17 | 18 | /** 19 | * Methods using this {@link Enhancer} callback will delegate directly to the 20 | * default (super) implementation in the base class. 21 | */ 22 | public interface NoOp extends Callback 23 | { 24 | /** 25 | * A thread-safe singleton instance of the NoOp callback. 26 | */ 27 | public static final NoOp INSTANCE = new NoOp() { }; 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/proxy/ProxyRefDispatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.proxy; 17 | 18 | /** 19 | * Dispatching {@link Enhancer} callback. This is the same as the 20 | * {@link Dispatcher} except for the addition of an argument 21 | * which references the proxy object. 22 | */ 23 | public interface ProxyRefDispatcher extends Callback { 24 | /** 25 | * Return the object which the original method invocation should 26 | * be dispatched. This method is called for every method invocation. 27 | * @param proxy a reference to the proxy (generated) object 28 | * @return an object that can invoke the method 29 | */ 30 | Object loadObject(Object proxy) throws Exception; 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/proxy/UndeclaredThrowableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002,2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.github.drinkjava2.cglib.proxy; 18 | 19 | import com.github.drinkjava2.cglib.core.CodeGenerationException; 20 | 21 | /** 22 | * Used by {@link Proxy} as a replacement for java.lang.reflect.UndeclaredThrowableException. 23 | * @author Juozas Baliuka 24 | */ 25 | @SuppressWarnings("serial") 26 | public class UndeclaredThrowableException extends CodeGenerationException { 27 | /** 28 | * Creates a new instance of UndeclaredThrowableException without detail message. 29 | */ 30 | public UndeclaredThrowableException(Throwable t) { 31 | super(t); 32 | } 33 | 34 | public Throwable getUndeclaredThrowable() { 35 | return getCause(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/AbstractClassTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | import com.github.drinkjava2.asm.ClassVisitor; 19 | import com.github.drinkjava2.asm.Opcodes; 20 | 21 | abstract public class AbstractClassTransformer extends ClassTransformer { 22 | protected AbstractClassTransformer() { 23 | super(Opcodes.ASM5); 24 | } 25 | 26 | public void setTarget(ClassVisitor target) { 27 | cv = target; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/ClassEmitterTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | import com.github.drinkjava2.cglib.core.ClassEmitter; 19 | 20 | abstract public class ClassEmitterTransformer extends ClassEmitter { 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/ClassFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.github.drinkjava2.cglib.transform; 18 | 19 | /** 20 | * 21 | * @author baliuka 22 | */ 23 | public interface ClassFilter { 24 | 25 | boolean accept(String className); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/ClassFilterTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003,2004 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | public class ClassFilterTransformer extends AbstractClassFilterTransformer { 19 | private ClassFilter filter; 20 | 21 | public ClassFilterTransformer(ClassFilter filter, ClassTransformer pass) { 22 | super(pass); 23 | this.filter = filter; 24 | } 25 | 26 | protected boolean accept(int version, int access, String name, String signature, String superName, String[] interfaces) { 27 | return filter.accept(name.replace('/', '.')); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/ClassTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | import com.github.drinkjava2.asm.ClassVisitor; 19 | import com.github.drinkjava2.asm.Opcodes; 20 | 21 | public abstract class ClassTransformer extends ClassVisitor { 22 | public ClassTransformer() { 23 | super(Opcodes.ASM5); 24 | } 25 | public ClassTransformer(int opcode) { 26 | super(opcode); 27 | } 28 | public abstract void setTarget(ClassVisitor target); 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/ClassTransformerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | public interface ClassTransformerFactory { 19 | ClassTransformer newInstance(); 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/ClassTransformerTee.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | import com.github.drinkjava2.asm.ClassVisitor; 19 | import com.github.drinkjava2.asm.Opcodes; 20 | 21 | public class ClassTransformerTee extends ClassTransformer { 22 | private ClassVisitor branch; 23 | 24 | public ClassTransformerTee(ClassVisitor branch) { 25 | super(Opcodes.ASM5); 26 | this.branch = branch; 27 | } 28 | 29 | public void setTarget(ClassVisitor target) { 30 | cv = new ClassVisitorTee(branch, target); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/MethodFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | public interface MethodFilter { 19 | // TODO: pass class name too? 20 | boolean accept(int access, String name, String desc, String signature, String[] exceptions); 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/TransformingClassGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | import com.github.drinkjava2.asm.ClassVisitor; 19 | import com.github.drinkjava2.cglib.core.ClassGenerator; 20 | 21 | public class TransformingClassGenerator implements ClassGenerator { 22 | private ClassGenerator gen; 23 | private ClassTransformer t; 24 | 25 | public TransformingClassGenerator(ClassGenerator gen, ClassTransformer t) { 26 | this.gen = gen; 27 | this.t = t; 28 | } 29 | 30 | public void generateClass(ClassVisitor v) throws Exception { 31 | t.setTarget(v); 32 | gen.generateClass(t); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/TransformingClassLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform; 17 | 18 | import com.github.drinkjava2.asm.ClassReader; 19 | import com.github.drinkjava2.cglib.core.ClassGenerator; 20 | 21 | public class TransformingClassLoader extends AbstractClassLoader { 22 | private ClassTransformerFactory t; 23 | 24 | public TransformingClassLoader(ClassLoader parent, ClassFilter filter, ClassTransformerFactory t) { 25 | super(parent, parent, filter); 26 | this.t = t; 27 | } 28 | 29 | protected ClassGenerator getGenerator(ClassReader r) { 30 | ClassTransformer t2 = (ClassTransformer)t.newInstance(); 31 | return new TransformingClassGenerator(super.getGenerator(r), t2); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/impl/FieldProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform.impl; 17 | @SuppressWarnings({"rawtypes" }) 18 | public interface FieldProvider { 19 | 20 | String[] getFieldNames(); 21 | 22 | Class[] getFieldTypes(); 23 | 24 | void setField(int index, Object value); 25 | 26 | Object getField(int index); 27 | 28 | 29 | void setField(String name, Object value); 30 | 31 | Object getField(String name); 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/impl/InterceptFieldEnabled.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform.impl; 17 | 18 | public interface InterceptFieldEnabled { 19 | void setInterceptFieldCallback(InterceptFieldCallback callback); 20 | InterceptFieldCallback getInterceptFieldCallback(); 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/cglib/transform/impl/InterceptFieldFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 The Apache Software Foundation 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.cglib.transform.impl; 17 | 18 | import com.github.drinkjava2.asm.Type; 19 | 20 | public interface InterceptFieldFilter { 21 | boolean acceptRead(Type owner, String name); 22 | boolean acceptWrite(Type owner, String name); 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/EMPTY.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox; 11 | 12 | /** 13 | * EMPTY used to mark a EMPTY value 14 | * 15 | * @author Yong Zhu 16 | * @since 2.4.8 17 | * 18 | */ 19 | public final class EMPTY {// NOSONAR 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/PrototypeBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox; 11 | 12 | /** Subclass implemented this interface will create prototype bean */ 13 | public interface PrototypeBean {// NOSONAR 14 | } 15 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/annotation/COMPONENT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox.annotation; 11 | 12 | import java.lang.annotation.ElementType; 13 | import java.lang.annotation.Retention; 14 | import java.lang.annotation.RetentionPolicy; 15 | import java.lang.annotation.Target; 16 | 17 | /** 18 | * @COMPONENT used to mark a component, similar like @Component 19 | * annotation in Spring 20 | * 21 | * @author Yong Zhu 22 | * @since 2.5.0 23 | */ 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @Target(ElementType.TYPE) 26 | public @interface COMPONENT { 27 | /** If not empty, the value is the bean name */ 28 | String value() default ""; 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/annotation/NAMED.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox.annotation; 11 | 12 | import java.lang.annotation.ElementType; 13 | import java.lang.annotation.Retention; 14 | import java.lang.annotation.RetentionPolicy; 15 | import java.lang.annotation.Target; 16 | 17 | /** 18 | * @NAMED similar like JSR330's @Named annotation 19 | * 20 | * @author Yong Zhu 21 | * @since 2.4.7 22 | * 23 | */ 24 | @QUALIFILER 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER }) 27 | public @interface NAMED { 28 | public String value() default ""; 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/annotation/POSTCONSTRUCT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox.annotation; 11 | 12 | import static java.lang.annotation.ElementType.METHOD; 13 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 14 | 15 | import java.lang.annotation.Documented; 16 | import java.lang.annotation.Retention; 17 | import java.lang.annotation.Target; 18 | 19 | /** 20 | * The POSTCONSTRUCT annotation is used on a method that needs to be executed 21 | * after dependency injection is done to perform any initialization. 22 | */ 23 | @Documented 24 | @Retention(RUNTIME) 25 | @Target(METHOD) 26 | public @interface POSTCONSTRUCT { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/annotation/PREDESTROY.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox.annotation; 11 | 12 | import static java.lang.annotation.ElementType.METHOD; 13 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 14 | 15 | import java.lang.annotation.Documented; 16 | import java.lang.annotation.Retention; 17 | import java.lang.annotation.Target; 18 | 19 | /** 20 | * The PREDESTROY annotation is used on methods as a callback notification to 21 | * signal that the instance is in the process of being removed by the container. 22 | * The method annotated with PreDestroy is typically used to release resources 23 | * that it has been holding. 24 | */ 25 | 26 | @Documented 27 | @Retention(RUNTIME) 28 | @Target(METHOD) 29 | public @interface PREDESTROY { 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/annotation/PROTOTYPE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox.annotation; 11 | 12 | import java.lang.annotation.ElementType; 13 | import java.lang.annotation.Retention; 14 | import java.lang.annotation.RetentionPolicy; 15 | import java.lang.annotation.Target; 16 | 17 | /** 18 | * Mark a bean is prototype, not singleton, it means each time will build a new 19 | * instance. 20 | * 21 | * @author Yong Zhu 22 | * @since 2.4 23 | * 24 | */ 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target({ ElementType.TYPE }) 27 | public @interface PROTOTYPE { 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/annotation/QUALIFILER.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox.annotation; 11 | 12 | import static java.lang.annotation.ElementType.ANNOTATION_TYPE; 13 | 14 | import java.lang.annotation.ElementType; 15 | import java.lang.annotation.Retention; 16 | import java.lang.annotation.RetentionPolicy; 17 | import java.lang.annotation.Target; 18 | 19 | /** 20 | * QUALIFILER similar like jsr330's Qualifiler 21 | * 22 | * @author Yong Zhu 23 | * @since 2.4.7 24 | * 25 | */ 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target({ ANNOTATION_TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER }) 28 | public @interface QUALIFILER { 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jbeanbox/annotation/VALUE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy of 4 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 5 | * applicable law or agreed to in writing, software distributed under the 6 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 7 | * OF ANY KIND, either express or implied. See the License for the specific 8 | * language governing permissions and limitations under the License. 9 | */ 10 | package com.github.drinkjava2.jbeanbox.annotation; 11 | 12 | import java.lang.annotation.ElementType; 13 | import java.lang.annotation.Retention; 14 | import java.lang.annotation.RetentionPolicy; 15 | import java.lang.annotation.Target; 16 | 17 | /** 18 | * VALUE for inject a String String or primative value, similar like Spring's 19 | * Value annotation, current version jBeanBox does not read values from property 20 | * file, to do that need use BeanBoxContext's setValueTranslator method to 21 | * customize the value transalator 22 | * 23 | * @author Yong Zhu 24 | * @since 2.4.7 25 | * 26 | */ 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target({ ElementType.FIELD, ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER }) 29 | public @interface VALUE { 30 | public String value(); 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdbpro/CustomizedSqlItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.jdbpro; 17 | 18 | /** 19 | * Sql Operation Type 20 | * 21 | * @author Yong Zhu 22 | * @since 1.7.0.3 23 | */ 24 | public interface CustomizedSqlItem { 25 | /** 26 | * Prepare special SQL items 27 | * 28 | * @param ps 29 | * PreparedSQL instance 30 | */ 31 | public void doPrepare(PreparedSQL ps); 32 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdbpro/JDBPRO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.github.drinkjava2.jdbpro; 17 | 18 | /** 19 | * JDBPRO is deprecated from 5.xx version and may be deleted in future version, 20 | * Keep this this class is for compatible purpose only 21 | * 22 | * @deprecated use DB instead 23 | * @author Yong Zhu 24 | */ 25 | @Deprecated 26 | public abstract class JDBPRO {//NOSONAR 27 | // do not change this file 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdbpro/LinkArrayList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.github.drinkjava2.jdbpro; 17 | 18 | import java.util.ArrayList; 19 | 20 | /** 21 | * LinkArrayList make ArrayList support link style 22 | * 23 | * @author Yong Zhu 24 | * @since 2.0.0 25 | */ 26 | 27 | @SuppressWarnings("serial") 28 | public class LinkArrayList extends ArrayList { 29 | 30 | public LinkArrayList frontAdd(T element) { 31 | super.add(0, element); 32 | return this; 33 | } 34 | 35 | public LinkArrayList append(T element) { 36 | super.add(element); 37 | return this; 38 | } 39 | 40 | public LinkArrayList insert(int index, T element) { 41 | super.add(index, element); 42 | return this; 43 | } 44 | 45 | public Object[] toObjectArray() { 46 | return this.toArray(new Object[this.size()]); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdbpro/PackageInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdbpro; 13 | 14 | /** 15 | * jDbPro is a separate project has its own Maven central releases. 16 | */ 17 | public class PackageInfo {// NOSONAR 18 | 19 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdbpro/SqlItemHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.drinkjava2.jdbpro; 17 | 18 | /** 19 | * SqlItemHandler handle a SqlItem 20 | * 21 | * @author Yong Zhu 22 | * @since 5.0.4 23 | */ 24 | public interface SqlItemHandler { 25 | 26 | /** 27 | * Return true if item be handled into SQL and Parameters, stored in 28 | * preparedSQL, otherwise return false to indicate item not be handled 29 | */ 30 | public boolean handle(PreparedSQL preparedSQL, Object item); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdbpro/TenantGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.github.drinkjava2.jdbpro; 17 | 18 | /** 19 | * Tenant interface 20 | * 21 | * @since 5.0.3 22 | */ 23 | public interface TenantGetter { 24 | 25 | public ImprovedQueryRunner getTenant(); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdbpro/TxBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdbpro; 13 | 14 | /** 15 | * The interface for DbContext.tx method use 16 | * 17 | *

18 |  * Usage:
19 |  * DbContext db=new DbContext(ds);
20 |  * db.tx(new TxBody(){ 
21 |  * 		public void run(){ 
22 |  * 			new User().setName("Tom").insert();
23 |  * 			db.iExecute("delete from order where userId=?",param("Sam"));
24 |  * 	   }}); 
25 |  * 
26 |  * or 
27 |  * 
28 |  * boolean result=db.tryTx(()->{new User().setName("Tom").insert();
29 |  * 			  db.iExecute("delete from order where userId=?",param("Sam"));  
30 |  *     });
31 |  * 
32 |  * 
33 | */ 34 | public interface TxBody { 35 | public void run(); 36 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdbpro/handler/PaginHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdbpro.handler; 13 | 14 | import com.github.drinkjava2.jdbpro.DefaultOrderSqlHandler; 15 | import com.github.drinkjava2.jdbpro.ImprovedQueryRunner; 16 | import com.github.drinkjava2.jdbpro.PreparedSQL; 17 | 18 | /** 19 | * PaginHandler is a SqlHandler used to translate SQL to paginated SQL 20 | * 21 | * @author Yong Zhu 22 | * @since 1.0.0 23 | */ 24 | public class PaginHandler extends DefaultOrderSqlHandler { 25 | int pageNumber; 26 | int pageSize; 27 | 28 | public PaginHandler(int pageNumber, int pageSize) { 29 | this.pageNumber = pageNumber; 30 | this.pageSize = pageSize; 31 | } 32 | 33 | @Override 34 | public void beforeExecute(ImprovedQueryRunner runner, PreparedSQL ps) { 35 | ps.setSql(runner.getDialect().pagin(pageNumber, pageSize, ps.getSql())); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/PackageInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects; 13 | 14 | /** 15 | * jDialect is a separate project has its own Maven central releases. 16 | */ 17 | public class PackageInfo {// NOSONAR 18 | 19 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/AutoId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 15 | import static java.lang.annotation.ElementType.FIELD; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * A shortcut annotation equal to @GenertedValue(strategy=GenerationType.AUTO) 22 | */ 23 | @Target(FIELD) 24 | @Retention(RUNTIME) 25 | public @interface AutoId { 26 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/CreateTimestamp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * Mark a CreateTimestamp column, explained by ORM tool 22 | * 23 | * @author Yong Zhu 24 | * @since 4.0.2 25 | */ 26 | @Target({ FIELD }) 27 | @Retention(RUNTIME) 28 | 29 | public @interface CreateTimestamp { 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/CreatedBy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * Mark a CreatedBy column, explained by ORM tool 22 | * 23 | * @author Yong Zhu 24 | * @since 4.0.2 25 | */ 26 | @Target({ FIELD }) 27 | @Retention(RUNTIME) 28 | 29 | public @interface CreatedBy { 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/IdentityId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 15 | import static java.lang.annotation.ElementType.FIELD; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * A shortcut annotation equal to 22 | * @GenertedValue(strategy=GenerationType.IDENTITY) 23 | */ 24 | @Target(FIELD) 25 | @Retention(RUNTIME) 26 | public @interface IdentityId { 27 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/LastModifiedBy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * Mark a LastModifiedBy column, explained by ORM tool 22 | * 23 | * @author Yong Zhu 24 | * @since 4.0.2 25 | */ 26 | @Target({ FIELD }) 27 | @Retention(RUNTIME) 28 | 29 | public @interface LastModifiedBy { 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/ShardDatabase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 16 | import java.lang.annotation.Retention; 17 | import java.lang.annotation.Target; 18 | 19 | /** 20 | * To mark this column is a ShardDatabase column, one table only allow 1 column 21 | * be marked as ShardDatabase column 22 | * 23 | * @author Yong Zhu 24 | * @since 1.0.5 25 | */ 26 | 27 | @Target(FIELD) 28 | @Retention(RUNTIME) 29 | public @interface ShardDatabase { 30 | String[] value(); 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/ShardTable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 16 | import java.lang.annotation.Retention; 17 | import java.lang.annotation.Target; 18 | 19 | /** 20 | * To mark this column is a shardTable column, one table only allow 1 column be 21 | * marked as shardiTable column 22 | * 23 | * @author Yong Zhu 24 | * @since 1.0.5 25 | */ 26 | 27 | @Target(FIELD) 28 | @Retention(RUNTIME) 29 | public @interface ShardTable { 30 | String[] value(); 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/SingleIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 16 | import java.lang.annotation.Retention; 17 | import java.lang.annotation.Target; 18 | 19 | /** 20 | * A shortcut annotation of Index, only for one column 21 | */ 22 | @Target(FIELD) 23 | @Retention(RUNTIME) 24 | public @interface SingleIndex { 25 | 26 | /** 27 | * (Optional) The name of the index; defaults to a provider-generated name. 28 | */ 29 | String name() default ""; 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/SingleUnique.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 16 | import java.lang.annotation.Retention; 17 | import java.lang.annotation.Target; 18 | 19 | 20 | /** 21 | * A shortcut annotation of Unique, only for one column 22 | * 23 | * @author Yong Zhu 24 | * @since 1.0.5 25 | */ 26 | 27 | @Target(FIELD) 28 | @Retention(RUNTIME) 29 | public @interface SingleUnique { 30 | 31 | /** 32 | * (Optional) The name of the index; defaults to a provider-generated name. 33 | */ 34 | String name() default ""; 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/TimeStampId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 15 | import static java.lang.annotation.ElementType.FIELD; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * A shortcut annotation equal to @GenertedValue(strategy=GenerationType.TIMESTAMP_ID) 22 | */ 23 | @Target(FIELD) 24 | @Retention(RUNTIME) 25 | public @interface TimeStampId { 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/UUID.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 15 | import static java.lang.annotation.ElementType.FIELD; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * A shortcut annotation equal to @GenertedValue(strategy=GenerationType.UUID) 22 | */ 23 | @Target(FIELD) 24 | @Retention(RUNTIME) 25 | public @interface UUID { 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/UUID25.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 15 | import static java.lang.annotation.ElementType.FIELD; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * A shortcut annotation equal to @GenertedValue(strategy=GenerationType.UUID25) 22 | */ 23 | @Target(FIELD) 24 | @Retention(RUNTIME) 25 | public @interface UUID25 { 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/UUID26.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 15 | import static java.lang.annotation.ElementType.FIELD; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * A shortcut annotation equal to @GenertedValue(strategy=GenerationType.UUID26) 22 | */ 23 | @Target(FIELD) 24 | @Retention(RUNTIME) 25 | public @interface UUID26 { 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/UUID32.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 15 | import static java.lang.annotation.ElementType.FIELD; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * A shortcut annotation equal to @GenertedValue(strategy=GenerationType.UUID32) 22 | */ 23 | @Target(FIELD) 24 | @Retention(RUNTIME) 25 | public @interface UUID32 { 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/UUID36.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 15 | import static java.lang.annotation.ElementType.FIELD; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * A shortcut annotation equal to @GenertedValue(strategy=GenerationType.UUID36) 22 | */ 23 | @Target(FIELD) 24 | @Retention(RUNTIME) 25 | public @interface UUID36 { 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jdia/UpdateTimestamp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jdialects.annotation.jdia; 13 | 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 16 | 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * Mark a UpdateTimestamp column, explained by ORM tool 22 | * 23 | * @author Yong Zhu 24 | * @since 4.0.2 25 | */ 26 | @Target({ FIELD }) 27 | @Retention(RUNTIME) 28 | 29 | public @interface UpdateTimestamp { 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jpa/EnumType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package com.github.drinkjava2.jdialects.annotation.jpa; 17 | 18 | /** 19 | * Defines mapping for enumerated types. The constants of this 20 | * enumerated type specify how a persistent property or 21 | * field of an enumerated type should be persisted. 22 | * 23 | * @since Java Persistence 1.0 24 | */ 25 | public enum EnumType { 26 | /** Persist enumerated type property or field as an integer. */ 27 | ORDINAL, 28 | 29 | /** Persist enumerated type property or field as a string. */ 30 | STRING 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/annotation/jpa/TemporalType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 6 | * which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Eclipse Distribution License is available at 9 | * http://www.eclipse.org/org/documents/edl-v10.php. 10 | * 11 | * Contributors: 12 | * Linda DeMichiel - Java Persistence 2.1 13 | * Linda DeMichiel - Java Persistence 2.0 14 | * 15 | ******************************************************************************/ 16 | package com.github.drinkjava2.jdialects.annotation.jpa; 17 | 18 | /** 19 | * Type used to indicate a specific mapping of java.util.Date 20 | * or java.util.Calendar. 21 | * 22 | * @since Java Persistence 1.0 23 | */ 24 | public enum TemporalType { 25 | 26 | /** Map as java.sql.Date */ 27 | DATE, 28 | 29 | /** Map as java.sql.Time */ 30 | TIME, 31 | 32 | /** Map as java.sql.Timestamp */ 33 | TIMESTAMP 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/converter/BasicJdbcToJavaConverter.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jdialects.converter; 2 | 3 | public class BasicJdbcToJavaConverter implements JdbcToJavaConverter { 4 | public static final BasicJdbcToJavaConverter instance = new BasicJdbcToJavaConverter(); 5 | 6 | @Override 7 | public Object convert(Object value) { 8 | return value; 9 | } 10 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/converter/JavaConverter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.github.drinkjava2.jdialects.converter; 17 | 18 | /** 19 | * JdbcTypeConverter, used to conver jdbc value to java, or java value to jdbc 20 | * parameter for SQL 21 | * 22 | * @author yongz 23 | * @since 5.0.0 24 | * 25 | */ 26 | public interface JavaConverter { 27 | 28 | /** 29 | * Convert java value to targetType java value 30 | * @param value 31 | * @param targetType 32 | * @return new value 33 | */ 34 | public Object convert(Object value, Class targetType); 35 | 36 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/converter/JavaToJdbcConverter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.github.drinkjava2.jdialects.converter; 17 | 18 | /** 19 | * JavaToJdbcConverter used to convert Java value to JDBC value 20 | * 21 | * @author yongz 22 | * @since 5.0.0 23 | * 24 | */ 25 | public interface JavaToJdbcConverter { 26 | 27 | /** Convert Java value to JDBC value */ 28 | public Object convert(Object value); 29 | 30 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/converter/JdbcToJavaConverter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.github.drinkjava2.jdialects.converter; 17 | 18 | /** 19 | * JdbcToJavaConverter used to convert jdbc value to java value 20 | * 21 | * @author yongz 22 | * @since 5.0.0 23 | * 24 | */ 25 | public interface JdbcToJavaConverter { 26 | 27 | /** Convert jdbc value to java value */ 28 | public Object convert(Object value); 29 | 30 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jdialects/springsrc/PackageInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | 17 | package com.github.drinkjava2.jdialects.springsrc; 18 | 19 | /** 20 | * All .java files in this folder are copied from Spring4.3.9.Release, no any 21 | * change except the package name 22 | * 23 | * @author Yong Zhu 24 | * @since 1.7.0 25 | */ 26 | public abstract class PackageInfo { 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jlogs/EmptyLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.github.drinkjava2.jlogs; 17 | 18 | /** 19 | * EmptyLog is an empty implementation of Log 20 | * 21 | * @author Yong Zhu 22 | * @since 1.7.0 23 | */ 24 | @SuppressWarnings("all") 25 | public class EmptyLog implements Log { 26 | 27 | public EmptyLog(Class clazz) { 28 | } 29 | 30 | @Override 31 | public void info(String msg) { 32 | } 33 | 34 | @Override 35 | public void warn(String msg) { 36 | } 37 | 38 | @Override 39 | public void warn(String msg, Throwable t) { 40 | } 41 | 42 | @Override 43 | public void error(String msg) { 44 | 45 | } 46 | 47 | @Override 48 | public void error(String msg, Throwable t) { 49 | } 50 | 51 | @Override 52 | public void debug(String msg) { 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jsqlbox/EntityType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jsqlbox; 13 | 14 | /** 15 | * EntityType means a standard Java Bean be mapped to a database table 16 | * 17 | * @author Yong Zhu 18 | * @since 2.0.4 19 | */ 20 | public interface EntityType { 21 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jsqlbox/JSQLBOX.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jsqlbox; 13 | 14 | /** 15 | * JSQLBOX is deprecated from 4.xx version and may be deleted in future version, 16 | * Keep this this class is for compatible purpose only 17 | * 18 | * @deprecated use DB instead 19 | * 20 | * @author Yong Zhu 21 | * @since 1.0.8 22 | */ 23 | @Deprecated 24 | public abstract class JSQLBOX extends DB {// NOSONAR 25 | // do not change this file 26 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jsqlbox/SqlBoxContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jsqlbox; 13 | 14 | import javax.sql.DataSource; 15 | 16 | import com.github.drinkjava2.jdialects.Dialect; 17 | 18 | /** 19 | * SqlBoxContext is extended from DbContext 20 | * 21 | * @author Yong Zhu 22 | * @since 1.0.0 23 | * @Deprecated From V4.0 Suggest use DbContext 24 | */ 25 | @Deprecated 26 | public class SqlBoxContext extends DbContext {//NOSONAR 27 | public SqlBoxContext() { 28 | super(); 29 | } 30 | 31 | public SqlBoxContext(DataSource ds) { 32 | super(ds); 33 | } 34 | 35 | public SqlBoxContext(DataSource ds, Dialect dialect) { 36 | super(ds, dialect); 37 | } 38 | 39 | public static void setGlobalSqlBoxContext(DbContext dc) { 40 | DbContext.setGlobalDbContext(dc); 41 | } 42 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jsqlbox/Tail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jsqlbox; 13 | 14 | /** 15 | * Tail is an empty entity only used to deal tables no any entity mapping, so 16 | * each CURD need add a tail("table") as parameter, for example: 17 | * 18 | * new Tail().putTail("user_name", "Tom", "age", 10).insert(JSQLBOX.tail("some_table")); 19 | * 20 | * @author Yong Zhu 21 | * @since 2.0.4 22 | */ 23 | public class Tail extends ActiveRecord { 24 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jsqlbox/TailType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jsqlbox; 13 | 14 | import java.util.Map; 15 | 16 | /** 17 | * TailType has a tails() method return a map instance stored tail values 18 | * 19 | * @author Yong Zhu 20 | * @since 2.0.4 21 | */ 22 | public interface TailType { 23 | public Map tails(); 24 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jsqlbox/gtx/GtxTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Original Author 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jsqlbox.gtx; 13 | 14 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 15 | 16 | /** 17 | * GtxIdTag used for save a gtxid tag in DBs 18 | */ 19 | public class GtxTag { 20 | @Id 21 | private String gid; // the gtxId 22 | 23 | public GtxTag() {// default constructor 24 | } 25 | 26 | public GtxTag(String gid) { 27 | this.gid = gid; 28 | } 29 | 30 | public String getGid() { 31 | return gid; 32 | } 33 | 34 | public GtxTag setGid(String gid) { 35 | this.gid = gid; 36 | return this; 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jtransactions/DataSourceHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jtransactions; 13 | 14 | import javax.sql.DataSource; 15 | 16 | /** 17 | * DataSourceHolder hold a dataSource, it should have a getDataSource method and 18 | * a getHolder method 19 | * 20 | * @author Yong Zhu 21 | * @since 2.0.7 22 | */ 23 | public interface DataSourceHolder { 24 | public DataSource getDataSource(); 25 | 26 | public Object getHolder(); // the holder who hold the data source 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/drinkjava2/jtransactions/PackageInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.github.drinkjava2.jtransactions; 13 | 14 | /** 15 | * jTransactions is a separate project has its own Maven central releases. 16 | */ 17 | public class PackageInfo {// NOSONAR 18 | } 19 | -------------------------------------------------------------------------------- /core/src/main/java/javax/inject/Named.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The JSR-330 Expert Group 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package javax.inject; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.Documented; 21 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 | 23 | /** 24 | * String-based {@linkplain Qualifier qualifier}. 25 | * 26 | *

Example usage: 27 | * 28 | *

29 |  *   public class Car {
30 |  *     @Inject @Named("driver") Seat driverSeat;
31 |  *     @Inject @Named("passenger") Seat passengerSeat;
32 |  *     ...
33 |  *   }
34 | */ 35 | @Qualifier 36 | @Documented 37 | @Retention(RUNTIME) 38 | public @interface Named { 39 | 40 | /** The name. */ 41 | String value() default ""; 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/javax/inject/Singleton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The JSR-330 Expert Group 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package javax.inject; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.Retention; 21 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 | 23 | /** 24 | * Identifies a type that the injector only instantiates once. Not inherited. 25 | * 26 | * @see javax.inject.Scope @Scope 27 | */ 28 | @Scope 29 | @Documented 30 | @Retention(RUNTIME) 31 | public @interface Singleton {} 32 | -------------------------------------------------------------------------------- /core/src/main/java/org/aopalliance/aop/Advice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.aopalliance.aop; 18 | 19 | /** 20 | * Tag interface for Advice. Implementations can be any type 21 | * of advice, such as Interceptors. 22 | * 23 | * @author Rod Johnson 24 | * @version $Id: Advice.java,v 1.1 2004/03/19 17:02:16 johnsonr Exp $ 25 | */ 26 | public interface Advice { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/org/aopalliance/intercept/ConstructorInvocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.aopalliance.intercept; 18 | 19 | import java.lang.reflect.Constructor; 20 | 21 | /** 22 | * Description of an invocation to a constuctor, given to an 23 | * interceptor upon constructor-call. 24 | * 25 | *

A constructor invocation is a joinpoint and can be intercepted 26 | * by a constructor interceptor. 27 | * 28 | * @author Rod Johnson 29 | * @see ConstructorInterceptor 30 | */ 31 | public interface ConstructorInvocation extends Invocation { 32 | 33 | /** 34 | * Get the constructor being called. 35 | *

This method is a friendly implementation of the 36 | * {@link Joinpoint#getStaticPart()} method (same result). 37 | * @return the constructor being called 38 | */ 39 | Constructor getConstructor(); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/org/aopalliance/intercept/Invocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.aopalliance.intercept; 18 | 19 | /** 20 | * This interface represents an invocation in the program. 21 | * 22 | *

An invocation is a joinpoint and can be intercepted by an 23 | * interceptor. 24 | * 25 | * @author Rod Johnson 26 | */ 27 | public interface Invocation extends Joinpoint { 28 | 29 | /** 30 | * Get the arguments as an array object. 31 | * It is possible to change element values within this 32 | * array to change the arguments. 33 | * @return the argument of the invocation 34 | */ 35 | Object[] getArguments(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/org/aopalliance/intercept/MethodInvocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * 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, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.aopalliance.intercept; 18 | 19 | import java.lang.reflect.Method; 20 | 21 | /** 22 | * Description of an invocation to a method, given to an interceptor 23 | * upon method-call. 24 | * 25 | *

A method invocation is a joinpoint and can be intercepted by a 26 | * method interceptor. 27 | * 28 | * @author Rod Johnson 29 | * @see MethodInterceptor 30 | */ 31 | public interface MethodInvocation extends Invocation { 32 | 33 | /** 34 | * Get the method being called. 35 | *

This method is a frienly implementation of the 36 | * {@link Joinpoint#getStaticPart()} method (same result). 37 | * @return the method being called 38 | */ 39 | Method getMethod(); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. 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, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.commons.dbutils.handlers.columns; 18 | 19 | import java.sql.ResultSet; 20 | import java.sql.SQLException; 21 | import java.sql.SQLXML; 22 | 23 | import org.apache.commons.dbutils.ColumnHandler; 24 | 25 | public class SQLXMLColumnHandler implements ColumnHandler { 26 | @Override 27 | public boolean match(Class propType) { 28 | return propType.equals(SQLXML.class); 29 | } 30 | 31 | @Override 32 | public Object apply(ResultSet rs, int columnIndex) throws SQLException { 33 | return rs.getSQLXML(columnIndex); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. 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, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.commons.dbutils.handlers.columns; 18 | 19 | import java.sql.ResultSet; 20 | import java.sql.SQLException; 21 | 22 | import org.apache.commons.dbutils.ColumnHandler; 23 | 24 | public class StringColumnHandler implements ColumnHandler { 25 | @Override 26 | public boolean match(Class propType) { 27 | return propType.equals(String.class); 28 | } 29 | 30 | @Override 31 | public Object apply(ResultSet rs, int columnIndex) throws SQLException { 32 | return rs.getString(columnIndex); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/org/apache/commons/dbutils/handlers/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. 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, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /** 19 | * Implementations of the org.apache.commons.dbutils.ResultSetHandler interface. 20 | */ 21 | package org.apache.commons.dbutils.handlers; 22 | -------------------------------------------------------------------------------- /core/src/main/java/org/apache/commons/dbutils/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. 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, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /** 19 | * DbUtils is a small set of classes designed to make working with JDBC easier. JDBC resource cleanup code is mundane, 20 | * error prone work so these classes abstract out all of the cleanup tasks from your code leaving you with what you 21 | * really wanted to do with JDBC in the first place: query and update data. 22 | * 23 | * This package contains the core classes and interfaces - DbUtils, QueryRunner and the ResultSetHandler interface 24 | * should be your first items of interest. 25 | */ 26 | package org.apache.commons.dbutils; 27 | -------------------------------------------------------------------------------- /core/src/main/java/org/apache/commons/dbutils/wrappers/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. 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, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /** 19 | * Wrappers that add functionality to java.sql classes. 20 | */ 21 | package org.apache.commons.dbutils.wrappers; 22 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/common/Readme.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.common; 2 | 3 | /** 4 | * Read me 5 | * 6 | * @author Yong Zhu 7 | * @since 2.0.5 8 | */ 9 | public class Readme { 10 | // Classes in common folder will be used for all unit test 11 | } 12 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/common/Systemout.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.common; 2 | 3 | /** 4 | * Debug Util 5 | * 6 | * @author Yong Zhu 7 | * @since 2.0.5 8 | */ 9 | @SuppressWarnings("all") 10 | public class Systemout { 11 | private static boolean allowPrint = false; //开发期打开好显示输出内容,提交时关闭以减少命令行输出 12 | 13 | public static boolean isAllowPrint() { 14 | return allowPrint; 15 | } 16 | 17 | public static void setAllowPrint(boolean allowPrint) { 18 | Systemout.allowPrint = allowPrint; 19 | } 20 | 21 | public static void print(Object obj) { 22 | if (allowPrint) 23 | System.out.print(obj); 24 | } 25 | 26 | public static void println(Object obj) { 27 | if (allowPrint) 28 | System.out.println(obj); 29 | } 30 | 31 | public static void println() { 32 | if (allowPrint) 33 | System.out.println(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jdialects/NamingConversionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 | * use this file except in compliance with the License. 5 | */ 6 | package com.github.drinkjava2.jdialects; 7 | 8 | import org.junit.Assert; 9 | import org.junit.Test; 10 | 11 | /** 12 | * 13 | * @author Yong Z. 14 | * @since 5.0.10 15 | * 16 | */ 17 | public class NamingConversionTest { 18 | 19 | @Test 20 | public void doTest() { 21 | Assert.assertEquals("naming_conversion_test", NamingConversion.LOWER_CASE_UNDERSCORE.getTableName(NamingConversionTest.class)); 22 | Assert.assertEquals("order_price", NamingConversion.LOWER_CASE_UNDERSCORE.getColumnName("OrderPrice")); 23 | Assert.assertEquals("NAMING_CONVERSION_TEST", NamingConversion.UPPER_CASE_UNDERSCORE.getTableName(NamingConversionTest.class)); 24 | Assert.assertEquals("ORDER_PRICE", NamingConversion.UPPER_CASE_UNDERSCORE.getColumnName("OrderPrice")); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jdialects/ToExcelTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 | * use this file except in compliance with the License. 5 | */ 6 | package com.github.drinkjava2.jdialects; 7 | 8 | import java.sql.SQLException; 9 | 10 | import org.junit.Test; 11 | 12 | import com.github.drinkjava2.jdialects.config.JdialectsTestBase; 13 | import com.github.drinkjava2.jdialects.entity.RoleTB; 14 | import com.github.drinkjava2.jdialects.entity.UserTB; 15 | 16 | public class ToExcelTest extends JdialectsTestBase { 17 | 18 | private static boolean isWindows() { 19 | String os = System.getProperty("os.name"); 20 | return os.toLowerCase().startsWith("win"); 21 | } 22 | 23 | 24 | 25 | @Test 26 | public void doTestPackage2Excel() { 27 | if (isWindows()) 28 | TableModelUtils.entityPackage2Excel("com.github.drinkjava2.jdialects.entity", "c:/tmp/jsqlbox_test_packageOutput.csv"); 29 | } 30 | 31 | @Test 32 | public void doTestEntity2Excel() { 33 | if (isWindows()) 34 | TableModelUtils.entity2Excel("c:/tmp/jsqlbox_test_entitiesOutput.csv", RoleTB.class, UserTB.class); 35 | } 36 | 37 | @Test 38 | public void doTestDb2Excel() throws SQLException { 39 | if (isWindows()) 40 | TableModelUtils.db2Excel(ds.getConnection(), Dialect.MySQL57Dialect, "c:/tmp/jsqlbox_test_dbOutput.csv"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jdialects/entity/RoleTB.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jdialects.entity; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Transient; 6 | 7 | @Table(name = "roletb") 8 | public class RoleTB { 9 | @Id 10 | String id; 11 | 12 | String roleName; 13 | 14 | @Transient 15 | UserTB user; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | 25 | public String getRoleName() { 26 | return roleName; 27 | } 28 | 29 | public void setRoleName(String roleName) { 30 | this.roleName = roleName; 31 | } 32 | 33 | public UserTB getUser() { 34 | return user; 35 | } 36 | 37 | public void setUser(UserTB user) { 38 | this.user = user; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jdialects/entity/UserTB.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jdialects.entity; 2 | 3 | import java.util.List; 4 | 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 6 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 7 | import com.github.drinkjava2.jdialects.annotation.jpa.Transient; 8 | 9 | @Table(name = "usertb") 10 | public class UserTB { 11 | @Id 12 | String id; 13 | 14 | String userName; 15 | 16 | String teatherId; 17 | 18 | String bossId; 19 | 20 | Integer age; 21 | 22 | @Transient 23 | List role; 24 | 25 | public String getId() { 26 | return id; 27 | } 28 | 29 | public void setId(String id) { 30 | this.id = id; 31 | } 32 | 33 | public String getUserName() { 34 | return userName; 35 | } 36 | 37 | public void setUserName(String userName) { 38 | this.userName = userName; 39 | } 40 | 41 | public String getTeatherId() { 42 | return teatherId; 43 | } 44 | 45 | public void setTeatherId(String teatherId) { 46 | this.teatherId = teatherId; 47 | } 48 | 49 | public String getBossId() { 50 | return bossId; 51 | } 52 | 53 | public void setBossId(String bossId) { 54 | this.bossId = bossId; 55 | } 56 | 57 | public Integer getAge() { 58 | return age; 59 | } 60 | 61 | public void setAge(Integer age) { 62 | this.age = age; 63 | } 64 | 65 | public List getRole() { 66 | return role; 67 | } 68 | 69 | public void setRole(List role) { 70 | this.role = role; 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jdialects/function/DDLFormatterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 | * use this file except in compliance with the License. 5 | */ 6 | package com.github.drinkjava2.jdialects.function; 7 | 8 | import org.junit.Test; 9 | 10 | import com.github.drinkjava2.common.Systemout; 11 | import com.github.drinkjava2.jdialects.DDLFormatter; 12 | 13 | /** 14 | * This is for DDLFormatter Test 15 | * 16 | * @author Yong Z. 17 | * 18 | */ 19 | public class DDLFormatterTest { 20 | 21 | @Test 22 | public void testDDLFormatter() { 23 | Systemout.println(DDLFormatter.format( 24 | "create column table customertable (id varchar(32) not null, customer_name varchar(30), primary key (id))")); 25 | Systemout.println(DDLFormatter.format( 26 | "create table customertable (id varchar(32) not null, customer_name varchar(30), primary key (id)) engine=InnoDB")); 27 | String ddl = "create table users(" 28 | + "id int(5), name varchar(10), \t \n age int, price float(10,3), address char)engine=innodb charset=utf8"; 29 | Systemout.println(DDLFormatter.format(ddl)); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jdialects/function/SqlFormatterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 | * use this file except in compliance with the License. 5 | */ 6 | package com.github.drinkjava2.jdialects.function; 7 | 8 | import org.junit.Test; 9 | 10 | import com.github.drinkjava2.common.Systemout; 11 | import com.github.drinkjava2.jdialects.SqlFormatter; 12 | 13 | /** 14 | * This is for DDLFormatter Test 15 | * 16 | * @author Yong Z. 17 | * 18 | */ 19 | public class SqlFormatterTest { 20 | 21 | @Test 22 | public void testDDLFormatter() { 23 | Systemout.println( 24 | SqlFormatter.format("select \t * from users \t \n where '1 = 1 ' or ' or 2=2'\r\n" 25 | + "or 3=3 order by id")); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/benchmark/DemoCustomer.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.benchmark; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 5 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 6 | 7 | @Table(name = "sys_customer") 8 | public class DemoCustomer extends ActiveRecord{ 9 | @Id 10 | private Integer id; 11 | 12 | private String code; 13 | 14 | private String name; 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public String getCode() { 25 | return code; 26 | } 27 | 28 | public void setCode(String code) { 29 | this.code = code; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/benchmark/DemoOrder.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.benchmark; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jdia.SingleFKey; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Column; 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Entity; 6 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 7 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 8 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 9 | 10 | @Table(name = "sys_order") 11 | @Entity(name = "sys_order") 12 | public class DemoOrder extends ActiveRecord { 13 | @Id 14 | private Integer id; 15 | 16 | private String name; 17 | 18 | @Column(name = "cust_id") 19 | @SingleFKey(refs = { "sys_customer", "id" }) 20 | private Integer custId; 21 | 22 | DemoCustomer demoCustomer; 23 | 24 | public Integer getId() { 25 | return id; 26 | } 27 | 28 | public void setId(Integer id) { 29 | this.id = id; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | public DemoCustomer getDemoCustomer() { 41 | return demoCustomer; 42 | } 43 | 44 | public void setDemoCustomer(DemoCustomer demoCustomer) { 45 | this.demoCustomer = demoCustomer; 46 | } 47 | 48 | public Integer getCustId() { 49 | return custId; 50 | } 51 | 52 | public void setCustId(Integer custId) { 53 | this.custId = custId; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/benchmark/DemoUser.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.benchmark; 2 | 3 | import static com.github.drinkjava2.jsqlbox.DB.noPagin; 4 | 5 | import java.util.List; 6 | 7 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 8 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 9 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 10 | 11 | @Table(name = "sys_user") 12 | public class DemoUser extends ActiveRecord { 13 | 14 | @Id 15 | private Integer id; 16 | 17 | private String code; 18 | 19 | public Integer getId() { 20 | return id; 21 | } 22 | 23 | public void setId(Integer id) { 24 | this.id = id; 25 | } 26 | 27 | public String getCode() { 28 | return code; 29 | } 30 | 31 | public void setCode(String code) { 32 | this.code = code; 33 | } 34 | 35 | public void pageQuery(Object... conditions) { 36 | this.countAll(" where 1=1 ", conditions, noPagin()); 37 | // Or iQueryForLongValue("select count(1) from sys_user where 1=1 ", conditions, 38 | // noPagin()); 39 | 40 | List users = this.findAll(" where 1=1 ", conditions, " order by id"); 41 | // Or iQueryForEntityList(DemoUser.class, "select * from sys_user where 1=1 ", 42 | // conditions, " order by id"); 43 | 44 | if (users.isEmpty()) 45 | throw new RuntimeException("pageQuery error"); 46 | 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/benchmark/TestServiceInterface.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.benchmark; 2 | 3 | public interface TestServiceInterface { 4 | 5 | /** 6 | * 测试添加的方法 7 | */ 8 | void testAdd(); 9 | 10 | /** 11 | * 测试根据id查询的方法 12 | */ 13 | void testUnique(); 14 | 15 | /** 16 | * 测试根据id更新数据的方法 17 | */ 18 | void testUpdateById(); 19 | 20 | /** 21 | * 分页查询 22 | */ 23 | void testPageQuery(); 24 | 25 | /** 26 | * 27 | */ 28 | void testExampleQuery(); 29 | 30 | void testOrmQUery(); 31 | } 32 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/function/TextUtilsTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * 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, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.github.drinkjava2.jsqlbox.function; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Test; 20 | 21 | import com.github.drinkjava2.jdbpro.TextUtils; 22 | 23 | import text.TextTest; 24 | 25 | /** 26 | * TextUtils is base class for Java text support (multiple line Strings). 27 | * 28 | * @author Yong Zhu 29 | */ 30 | public class TextUtilsTest { 31 | 32 | @Test 33 | public void doTextTest() { 34 | String str = TextUtils.getJavaSourceCodeUTF8(TextTest.class); 35 | Assert.assertTrue(str.indexOf("public class ") > -1); 36 | } 37 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/function/entitynet/entity/Address.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.function.entitynet.entity; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jdia.SingleFKey; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 6 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 7 | 8 | @Table(name = "addresstb") 9 | public class Address extends ActiveRecord

{ 10 | @Id 11 | String id; 12 | String addressName; 13 | 14 | @SingleFKey(refs = { "usertb", "id" }) 15 | String userId; 16 | 17 | User user; 18 | 19 | public String getId() { 20 | return id; 21 | } 22 | 23 | public void setId(String id) { 24 | this.id = id; 25 | } 26 | 27 | public String getAddressName() { 28 | return addressName; 29 | } 30 | 31 | public void setAddressName(String addressName) { 32 | this.addressName = addressName; 33 | } 34 | 35 | public String getUserId() { 36 | return userId; 37 | } 38 | 39 | public void setUserId(String userId) { 40 | this.userId = userId; 41 | } 42 | 43 | public User getUser() { 44 | return user; 45 | } 46 | 47 | public void setUser(User user) { 48 | this.user = user; 49 | } 50 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/function/entitynet/entity/Email.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.function.entitynet.entity; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jdia.SingleFKey; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 6 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 7 | 8 | @Table(name = "emailtb") 9 | public class Email extends ActiveRecord { 10 | @Id 11 | String id; 12 | String emailName; 13 | 14 | @SingleFKey(refs = { "usertb", "id" }) 15 | String userId; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | 25 | public String getEmailName() { 26 | return emailName; 27 | } 28 | 29 | public void setEmailName(String emailName) { 30 | this.emailName = emailName; 31 | } 32 | 33 | public String getUserId() { 34 | return userId; 35 | } 36 | 37 | public void setUserId(String userId) { 38 | this.userId = userId; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/function/entitynet/entity/Privilege.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.function.entitynet.entity; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 5 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 6 | 7 | @Table(name = "privilegetb") 8 | public class Privilege extends ActiveRecord { 9 | @Id 10 | String id; 11 | String privilegeName; 12 | User user; 13 | 14 | public String getId() { 15 | return id; 16 | } 17 | 18 | public void setId(String id) { 19 | this.id = id; 20 | } 21 | 22 | public String getPrivilegeName() { 23 | return privilegeName; 24 | } 25 | 26 | public void setPrivilegeName(String privilegeName) { 27 | this.privilegeName = privilegeName; 28 | } 29 | 30 | public User getUser() { 31 | return user; 32 | } 33 | 34 | public void setUser(User user) { 35 | this.user = user; 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/function/entitynet/entity/Role.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.function.entitynet.entity; 2 | 3 | import java.util.List; 4 | 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 6 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 7 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 8 | 9 | @Table(name = "roletb") 10 | public class Role extends ActiveRecord { 11 | @Id 12 | String id; 13 | 14 | String roleName; 15 | 16 | User user; 17 | 18 | List rolePrivilegeList; 19 | 20 | public String getId() { 21 | return id; 22 | } 23 | 24 | public void setId(String id) { 25 | this.id = id; 26 | } 27 | 28 | public String getRoleName() { 29 | return roleName; 30 | } 31 | 32 | public void setRoleName(String roleName) { 33 | this.roleName = roleName; 34 | } 35 | 36 | public User getUser() { 37 | return user; 38 | } 39 | 40 | public void setUser(User user) { 41 | this.user = user; 42 | } 43 | 44 | public List getRolePrivilegeList() { 45 | return rolePrivilegeList; 46 | } 47 | 48 | public void setRolePrivilegeList(List rolePrivilegeList) { 49 | this.rolePrivilegeList = rolePrivilegeList; 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/function/entitynet/entity/RolePrivilege.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.function.entitynet.entity; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jdia.SingleFKey; 4 | import com.github.drinkjava2.jdialects.annotation.jdia.UUID25; 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 6 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 7 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 8 | 9 | @Table(name = "roleprivilegetb") 10 | public class RolePrivilege extends ActiveRecord { 11 | @Id 12 | @UUID25 13 | String id; 14 | 15 | @SingleFKey(refs = { "roletb", "id" }) 16 | String rid; 17 | 18 | @SingleFKey(refs = { "privilegetb", "id" }) 19 | String pid; 20 | 21 | Privilege privilege; 22 | 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | public void setId(String id) { 28 | this.id = id; 29 | } 30 | 31 | public String getRid() { 32 | return rid; 33 | } 34 | 35 | public void setRid(String rid) { 36 | this.rid = rid; 37 | } 38 | 39 | public String getPid() { 40 | return pid; 41 | } 42 | 43 | public void setPid(String pid) { 44 | this.pid = pid; 45 | } 46 | 47 | public Privilege getPrivilege() { 48 | return privilege; 49 | } 50 | 51 | public void setPrivilege(Privilege privilege) { 52 | this.privilege = privilege; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/function/jtransactions/Usr.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.function.jtransactions; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jdia.UUID32; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 6 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 7 | 8 | @Table(name = "usrtb") 9 | public class Usr extends ActiveRecord { 10 | @UUID32 11 | @Id 12 | String id; 13 | String firstName; 14 | String lastName; 15 | Integer age; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public Usr setId(String id) { 22 | this.id = id; 23 | return this; 24 | } 25 | 26 | public String getFirstName() { 27 | return firstName; 28 | } 29 | 30 | public Usr setFirstName(String firstName) { 31 | this.firstName = firstName; 32 | return this; 33 | } 34 | 35 | public String getLastName() { 36 | return lastName; 37 | } 38 | 39 | public Usr setLastName(String lastName) { 40 | this.lastName = lastName; 41 | return this; 42 | } 43 | 44 | public Integer getAge() { 45 | return age; 46 | } 47 | 48 | public Usr setAge(Integer age) { 49 | this.age = age; 50 | return this; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/issues/IYDU7_orm_demo/Ademo.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.issues.IYDU7_orm_demo; 2 | 3 | import java.util.List; 4 | 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 6 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 7 | 8 | public class Ademo extends ActiveRecord { 9 | @Id 10 | String aid; 11 | 12 | String bid; 13 | 14 | Bdemo bdemo; 15 | 16 | List cdemoList; 17 | 18 | String atext; 19 | 20 | public String getAid() { 21 | return aid; 22 | } 23 | 24 | public void setAid(String aid) { 25 | this.aid = aid; 26 | } 27 | 28 | public String getBid() { 29 | return bid; 30 | } 31 | 32 | public void setBid(String bid) { 33 | this.bid = bid; 34 | } 35 | 36 | public Bdemo getBdemo() { 37 | return bdemo; 38 | } 39 | 40 | public void setBdemo(Bdemo bdemo) { 41 | this.bdemo = bdemo; 42 | } 43 | 44 | public List getCdemoList() { 45 | return cdemoList; 46 | } 47 | 48 | public void setCdemoList(List cdemoList) { 49 | this.cdemoList = cdemoList; 50 | } 51 | 52 | public String getAtext() { 53 | return atext; 54 | } 55 | 56 | public void setAtext(String atext) { 57 | this.atext = atext; 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/issues/IYDU7_orm_demo/Bdemo.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.issues.IYDU7_orm_demo; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 4 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 5 | 6 | public class Bdemo extends ActiveRecord { 7 | @Id 8 | String bid; 9 | String btext; 10 | 11 | public String getBid() { 12 | return bid; 13 | } 14 | 15 | public void setBid(String bid) { 16 | this.bid = bid; 17 | } 18 | 19 | public String getBtext() { 20 | return btext; 21 | } 22 | 23 | public void setBtext(String btext) { 24 | this.btext = btext; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/issues/IYDU7_orm_demo/Cdemo.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.issues.IYDU7_orm_demo; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 4 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 5 | 6 | public class Cdemo extends ActiveRecord { 7 | @Id 8 | String cid; 9 | String ctext; 10 | String aid; 11 | 12 | public String getCid() { 13 | return cid; 14 | } 15 | 16 | public void setCid(String cid) { 17 | this.cid = cid; 18 | } 19 | 20 | public String getCtext() { 21 | return ctext; 22 | } 23 | 24 | public void setCtext(String ctext) { 25 | this.ctext = ctext; 26 | } 27 | 28 | public String getAid() { 29 | return aid; 30 | } 31 | 32 | public void setAid(String aid) { 33 | this.aid = aid; 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/issues/Readme.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.issues; 2 | 3 | /** 4 | * All testers in issues folder are not important, are temporary testing for 5 | * issues, may delete in future 6 | */ 7 | public class Readme { 8 | } -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/java8/ActiveEntityTest.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.java8; 2 | 3 | /*- JAVA8_BEGIN */ 4 | import static com.github.drinkjava2.jsqlbox.DB.par; 5 | 6 | import java.util.List; 7 | 8 | import org.junit.Assert; 9 | import org.junit.Test; 10 | 11 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 12 | import com.github.drinkjava2.jsqlbox.ActiveEntity; 13 | import com.github.drinkjava2.jsqlbox.DB; 14 | import com.github.drinkjava2.jsqlbox.config.TestBase; 15 | 16 | public class ActiveEntityTest extends TestBase implements ActiveEntity { 17 | @Id 18 | private String name; 19 | private Integer age; 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | public Integer getAge() { 30 | return age; 31 | } 32 | 33 | public void setAge(Integer age) { 34 | this.age = age; 35 | } 36 | 37 | @Test 38 | public void doTest() { 39 | quietDropTables(ActiveEntityTest.class); 40 | createAndRegTables(ActiveEntityTest.class); 41 | for (int i = 0; i < 100; i++) 42 | new ActiveEntityTest().putField("name", "name" + i, "age", i).insert(); 43 | Assert.assertEquals(100, DB.qryLongValue("select count(*) from ActiveEntityTest")); 44 | List userList = new ActiveEntityTest().findBySQL("select * from ActiveEntityTest where age>=?", par(50)); 45 | Assert.assertEquals(50, userList.size()); 46 | } 47 | 48 | } 49 | /* JAVA8_END */ -------------------------------------------------------------------------------- /core/src/test/java/com/github/drinkjava2/jsqlbox/java8/User.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.jsqlbox.java8; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jdia.UUID25; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 5 | import com.github.drinkjava2.jdialects.annotation.jpa.Table; 6 | import com.github.drinkjava2.jsqlbox.ActiveRecord; 7 | 8 | @Table(name = "usertb") 9 | public class User extends ActiveRecord { 10 | 11 | @UUID25 12 | @Id 13 | public String id; 14 | 15 | public String name; 16 | 17 | public String address; 18 | 19 | public Integer age; 20 | 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | public void setId(String id) { 26 | this.id = id; 27 | } 28 | 29 | public Integer getAge() { 30 | return age; 31 | } 32 | 33 | public void setAge(Integer age) { 34 | this.age = age; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public String getAddress() { 46 | return address; 47 | } 48 | 49 | public void setAddress(String address) { 50 | this.address = address; 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /demo/jsqlbox-actframework/README.md: -------------------------------------------------------------------------------- 1 | ### Transaction App Demo 2 | This is a demo project to show use jSqlBox in ActFramework. 3 | 4 | A simple Transaction Application built on top of ActFramework and jSqlBox 5 | To run this application: 6 | 1. Inside the demo project folder jsqlbox-in-actframework, type `mvn clean compile exec:exec` 7 | 2. Go to your browser and type `http://localhost`. 8 | This demo use H2 memory database do test. 9 | 10 | 这个项目用来演示jSqlBox在ActFramework中的配置和使用。因为ActFramework目前不支持AOP联盟标准接口,为了使用jSqlBox的声明式事务,这个例子里使用了独立的第三方IOC/AOP工具Guice和jBeanBox两种演示。 11 | 12 | 命令行下输入: mvn clean compile exec:exec 13 | 浏览器下查看: http://localhost 14 | 15 | (注意这个示例可能有个问题,DOS窗口关闭后,后台的Web服务不能自动退出,并占用Web端口,必须在windows下打开任务管理器手工杀掉一个Java.exe进程,这与ActFramework的Web服务有关,已向作者提交issue) -------------------------------------------------------------------------------- /demo/jsqlbox-actframework/maven_clean.bat: -------------------------------------------------------------------------------- 1 | call mvn clean 2 | call del .act.* 3 | call del act.* -------------------------------------------------------------------------------- /demo/jsqlbox-actframework/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:clean 2 | call del .act.* 3 | call del act.* -------------------------------------------------------------------------------- /demo/jsqlbox-actframework/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-actframework/mvn clean compile execexec.bat: -------------------------------------------------------------------------------- 1 | call mvn clean compile exec:exec 2 | pause -------------------------------------------------------------------------------- /demo/jsqlbox-actframework/src/main/java/demo/transaction/jsqlbox/MyTX.java: -------------------------------------------------------------------------------- 1 | package demo.transaction.jsqlbox; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import com.github.drinkjava2.jbeanbox.annotation.AOP; 9 | 10 | import demo.transaction.jsqlbox.TransactionDemo.TinyTxBox; 11 | 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target({ ElementType.METHOD }) 14 | @AOP 15 | public @interface MyTX { 16 | public Class value() default TinyTxBox.class; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /demo/jsqlbox-actframework/src/main/resources/conf/application.properties: -------------------------------------------------------------------------------- 1 | http.port=80 2 | act.cli=false -------------------------------------------------------------------------------- /demo/jsqlbox-atomikos/README.md: -------------------------------------------------------------------------------- 1 | ## jsqlbox-xa-atomikos 2 | This is a demo project to show use jSqlBox with Atomikos 3 | 4 | 这是一个演示项目,演示jSqlBox进行分库操作时,利用atomikos来实现分布式事务以保证多个数据库之间的数据一致性。 5 | 用到以下工具: H2(Database) + jBeanBox(IOC/AOP) + jSqlBox(ORM/Sharding) + Spring XA(XA support for Atomikos) + Atomikos(XA Transaction) 6 | 7 | 备注:利用XA协议实现分布式事务有它的问题,因为XA协议效率低、理论上也不能保证100%的数据完整性。自jSqlBox3.0.0起,已经自带了支持分库分表分布式事务的GtxConnectionManager,推荐试用。 8 | 9 | 运行方式: maven test 10 | 11 | 本示例参考了网上以下文章: 12 | https://www.atomikos.com/Main/InstallingTransactionsEssentials 13 | http://forum.spring.io/forum/spring-projects/integration/119662-spring-integration-flow-and-xa-transactions/page2 14 | https://www.ibm.com/developerworks/cn/java/j-lo-jta/index.html 15 | http://blog.51cto.com/aiilive/1658102 16 | http://blog.itpub.net/28624388/viewspace-2137095/ 17 | http://www.cnblogs.com/cczhoufeng/archive/2012/05/16/2502769.html 18 | https://my.oschina.net/pingpangkuangmo/blog/423210 19 | http://sparkgis.com/java/2017/12/spring-%E5%A4%9A%E6%95%B0%E6%8D%AE%E6%BA%90-%E9%9B%86%E6%88%90jta-atomikos%E5%AE%9E%E7%8E%B0%E5%8A%A8%E6%80%81%E5%88%87%E6%8D%A2%E6%95%B0%E6%8D%AE%E6%BA%90-%E5%8E%9F-spring-%E5%A4%9A%E6%95%B0/ 20 | https://blog.csdn.net/luo_deng/article/details/50525073 21 | 22 | -------------------------------------------------------------------------------- /demo/jsqlbox-atomikos/maven_clean.bat: -------------------------------------------------------------------------------- 1 | call mvn clean 2 | del tmlog*.log 3 | del tmlog.lck -------------------------------------------------------------------------------- /demo/jsqlbox-atomikos/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-atomikos/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-atomikos/maven_test.bat: -------------------------------------------------------------------------------- 1 | call mvn clean test 2 | @pause -------------------------------------------------------------------------------- /demo/jsqlbox-atomikos/src/test/resources/jta.properties: -------------------------------------------------------------------------------- 1 | com.atomikos.icatch.registered=true -------------------------------------------------------------------------------- /demo/jsqlbox-atomikos/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | org.slf4j.simpleLogger.log.com.atomikos=info -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/README.md: -------------------------------------------------------------------------------- 1 | ## jSqlBox-BeetlSql 2 | This is a demo project to show how to develop customized Sql template engine in jSqlBox. 3 | 4 | 这是一个演示项目,演示在jSqlBox中用使用BeetlSql作为模板引擎。 5 | 编译及运行本项目需Java8, Tomcat7以上环境。 6 | 因为BeetlSql开发组可能没有想到有人要抽取它的模板引擎,所以模板功能与持久层功能结合太密,不太容易剥离开,采用了一些非常规手段,而且有些小问题,例如要提供一个数据源给BeetlSQL初始化,对于一个模板功能来说这是没必要的。 -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/command.bat: -------------------------------------------------------------------------------- 1 | cmd -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/maven_clean.bat: -------------------------------------------------------------------------------- 1 | mvn clean -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/maven_test.bat: -------------------------------------------------------------------------------- 1 | call mvn clean test 2 | @pause -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/src/test/java/com/github/drinkjava2/beetlsqldemo/SQLGrammarCreator.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.beetlsqldemo; 2 | 3 | import org.beetl.core.engine.GrammarCreator; 4 | import org.beetl.core.statement.Expression; 5 | import org.beetl.core.statement.FormatExpression; 6 | import org.beetl.core.statement.PlaceholderST; 7 | 8 | public class SQLGrammarCreator extends GrammarCreator { 9 | 10 | public PlaceholderST createTextOutputSt(Expression exp, FormatExpression format) { 11 | check("TextOutputSt"); 12 | return new SQLPlaceholderST(exp, format, null); 13 | } 14 | 15 | public PlaceholderST createTextOutputSt2(Expression exp, FormatExpression format) { 16 | return new PlaceholderST(exp, format, null); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/src/test/java/com/github/drinkjava2/beetlsqldemo/SQLPlaceholderST.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.beetlsqldemo; 2 | 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import org.beetl.core.Context; 8 | import org.beetl.core.exception.BeetlException; 9 | import org.beetl.core.statement.Expression; 10 | import org.beetl.core.statement.FormatExpression; 11 | import org.beetl.core.statement.GrammarToken; 12 | import org.beetl.core.statement.PlaceholderST; 13 | 14 | public class SQLPlaceholderST extends PlaceholderST { 15 | private static final long serialVersionUID = 1L; 16 | 17 | public SQLPlaceholderST(Expression exp, FormatExpression format, GrammarToken token) { 18 | super(exp, format, token); 19 | } 20 | 21 | @SuppressWarnings("all") 22 | @Override 23 | public final void execute(Context ctx) { 24 | try { 25 | Object value = expression.evaluate(ctx); 26 | if (format != null) 27 | value = format.evaluateValue(value, ctx); 28 | ctx.byteWriter.writeString("?"); 29 | List list = (List) ctx.getGlobal("__SqlParam"); 30 | if (list == null) { 31 | list = new ArrayList(); 32 | ctx.set("__SqlParam", list); 33 | } 34 | list.add(value); 35 | } catch (IOException e) { 36 | BeetlException be = new BeetlException(BeetlException.CLIENT_IO_ERROR_ERROR, e.getMessage(), e); 37 | be.pushToken(this.token); 38 | throw be; 39 | } 40 | 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/src/test/java/com/github/drinkjava2/beetlsqldemo/SQLTemplateEngine.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.beetlsqldemo; 2 | 3 | import org.beetl.core.GroupTemplate; 4 | import org.beetl.core.engine.DefaultTemplateEngine; 5 | import org.beetl.core.engine.GrammarCreator; 6 | 7 | public class SQLTemplateEngine extends DefaultTemplateEngine { 8 | 9 | @Override 10 | protected GrammarCreator getGrammerCreator(GroupTemplate gt) { 11 | return new SQLGrammarCreator(); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/src/test/resources/common-logging.properties: -------------------------------------------------------------------------------- 1 | #if commons log jar found in class path, will use it, otherwise will use JDK logger. 2 | 3 | #if found commons log jar, this configuration file will effect 4 | 5 | #Below line tell commons log to load Log4j 6 | 7 | 8 | 9 | 10 | 11 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger 12 | -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, stdout 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.Target=System.out 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | #log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{20}:%L-%m%n 6 | log4j.appender.stdout.layout.ConversionPattern=%m%n -------------------------------------------------------------------------------- /demo/jsqlbox-beetl/src/test/resources/sql/SQLs.java: -------------------------------------------------------------------------------- 1 | package sql; 2 | 3 | import com.github.drinkjava2.jdbpro.Text; 4 | 5 | /** 6 | * This is a sample to show put SQL in multiple line Strings(Text), a plug-in 7 | * called "build-helper-maven-plugin" in pom.xml is required (can see the 8 | * pom.xml file of this project), otherwise need manually put a copy of java 9 | * source code file in resources folder. 10 | * 11 | * If IDE is Eclipse, comments in this file will not be formatted, because it 12 | * use /*- comments 13 | * 14 | * 15 | * @author Yong Zhu 16 | * @since 2.0.4 17 | */ 18 | public class SQLs { 19 | public static class SelectUsers1 extends Text { 20 | /*- 21 | select * from users where 22 | age>#{age} or name='${name}' 23 | */ 24 | } 25 | 26 | public static class SelectUsers2 extends Text { 27 | /*- 28 | select u.* from users u where 1=1 29 | <%if(!isEmpty(u.age)){%> 30 | and u.age>#{u.age} 31 | <%}%> 32 | <%if(!isEmpty(u.name)){%> 33 | and u.name=#{u.name} 34 | <%}%> 35 | */ 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /demo/jsqlbox-helloworld/maven_clean.bat: -------------------------------------------------------------------------------- 1 | mvn clean -------------------------------------------------------------------------------- /demo/jsqlbox-helloworld/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-helloworld/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/README.md: -------------------------------------------------------------------------------- 1 | ## jBooox 2 | This is a simple web demo project use jbeanbox + jwebbox + jsqlbox. 3 | 4 | 这是一个传统WebApp演示项目,主要架构基于 jbeanbox + jwebbox + jsqlbox,因为三个开源项目都以Box结尾, 所以项目简称jBooox。 5 | 编译及运行本项目需Java8, Tomcat7以上环境,必须发布到Tomcat目录下运行。 如果想在其它Servlet环境(如undertow等嵌入式容器)下运行,请参见GoSqlGo项目中的jbooox的演示。 6 | 7 | jBooox项目的架构特点是各个模块之间完全独立,每个模块都在Maven中央库都有单独发布。 8 | 9 | jBooox项目各模块简介: 10 | * jSqlBox是一个持久层工具,支持多种SQL写法,自带声明式事务(内含jTransactions模块)。 11 | * jBeanBox是一个IOC/AOP工具, 与它等效的工具是Spring内核、Guice等。 12 | * jWebBox是一个只有千行源码的后端页面布局工具,用于替代Apache-Tiles的布局功能,在本项目中客串充当MVC中的Controller角色。 13 | 14 | jBooox是个示例项目,除了本文外没有更多文档,设计意图都体现在示例代码中,请自行翻阅源代码。 15 | 16 | 17 | 运行方式:修改deploy_tomcat.bat批处理文本,指向本机的Tomcat路径,双击运行 18 | 查看:浏览器输入 http://localhost 19 | 单元测试:运行mvn test -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/deploy_tomcat.bat: -------------------------------------------------------------------------------- 1 | call mvn clean -DskipTests package 2 | 3 | set TomcatFolder=c:\tomcat8 4 | rd /s/q /q %TomcatFolder%\logs 5 | md %TomcatFolder%\logs 6 | rd /s/q /q %TomcatFolder%\work 7 | md %TomcatFolder%\work 8 | rd /s/q /q %TomcatFolder%\webapps 9 | md %TomcatFolder%\webapps 10 | cd target 11 | del ROOT.war 12 | ren *.war ROOT.war 13 | copy ROOT.war %TomcatFolder%\webapps\ /y 14 | call %TomcatFolder%\bin\startup.bat 15 | start http://127.0.0.1 -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/deploy_weblogic.bat: -------------------------------------------------------------------------------- 1 | call mvn clean -DskipTests package 2 | @echo off 3 | 4 | @echo on 5 | cd target 6 | del ROOT.war 7 | ren *.war ROOT.war 8 | 9 | copy ROOT.war C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\autodeploy\ /y 10 | 11 | call C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\startWebLogic.cmd 12 | 13 | start http://127.0.0.1 -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/maven_clean.bat: -------------------------------------------------------------------------------- 1 | mvn clean -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/maven_test.bat: -------------------------------------------------------------------------------- 1 | call mvn clean test 2 | @pause -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/java/com/jsqlboxdemo/controller/home.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.jsqlboxdemo.controller; 13 | 14 | /** 15 | * This is a Demo to show use jWebBox as controller, WebBox is not thread safe, 16 | * to use WebBox act as controller, always use a IOC/AOP tool to get a new 17 | * instance or new proxy instance (for transaction) for each thread 18 | * 19 | * @author Yong Zhu 20 | */ 21 | @SuppressWarnings("all") 22 | public class home { 23 | 24 | public static class home_default extends BaseBox { 25 | { 26 | setPage("/WEB-INF/pages/home.jsp"); 27 | } 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/java/com/jsqlboxdemo/service/TeamService.java: -------------------------------------------------------------------------------- 1 | package com.jsqlboxdemo.service; 2 | 3 | import java.util.List; 4 | 5 | import com.github.drinkjava2.jsqlbox.DB; 6 | import com.jsqlboxdemo.init.Initializer.TX; 7 | 8 | import model.Team; 9 | 10 | /** 11 | * This TeamService class should use a AOP tool to build a singleton instance to 12 | * make methods to controlled in transaction. 13 | * 14 | * @author Yong Zhu 15 | * @since 1.0.2 16 | */ 17 | public class TeamService { 18 | 19 | public List listAll() { 20 | return DB.entityFind(Team.class); 21 | } 22 | 23 | @TX 24 | public List listEqual(Integer rating) { 25 | return new Team().queryTeamsRatingEqualTo(rating); 26 | } 27 | 28 | @TX 29 | public List listNotEqual(Integer rating) { 30 | return new Team().queryTeamsRatingNotEqual(rating); 31 | } 32 | 33 | @TX 34 | public List listBigger(Integer rating) { 35 | return new Team().queryTeamsRatingBiggerThan(rating); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/resources/jlogs.properties: -------------------------------------------------------------------------------- 1 | log=com.jsqlboxdemo.logger.SampleSLF4JLog -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/webapp/META-INF/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/webapp/WEB-INF/pages/home.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 3 | pageEncoding="ISO-8859-1"%> 4 | 5 | 6 | 7 | 8 | Home page 9 | 10 | 11 |

Home page

12 |

13 | ${message}
14 | Add new team
15 | List all teams
16 | List teams rating=0
17 | List teams rating<>0
18 | List teams rating>10
19 | 20 | 21 |

22 | 23 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/webapp/WEB-INF/pages/team_add.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 4 | pageEncoding="ISO-8859-1"%> 5 | 6 | 7 | 8 | 9 | 10 | Add team page 11 | 12 | 13 |

Add team page

14 |

Here you can add a new team.

15 | ${message}
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
Name:
Rating:
33 |
34 | 35 |

Home page

36 | 37 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/webapp/WEB-INF/pages/team_edit.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 2 | 3 | 4 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 5 | pageEncoding="ISO-8859-1"%> 6 | 7 | 8 | 9 | 10 | 11 | Edit team page 12 | 13 | 14 |

Edit team page

15 |

Here you can edit the existing team.

16 |

${message}

17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
Name:
Rating:
34 |
35 | 36 |

Home page

37 | 38 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/webapp/WEB-INF/pages/team_list.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 2 | 3 | 4 | 5 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 6 | pageEncoding="ISO-8859-1"%> 7 | 8 | 9 | 10 | 11 | List of teams 12 | 13 | 14 |

List of teams

15 |

Here you can see the list of the teams, edit them, remove or update.

16 | ${message}
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 34 | 35 | 36 |
idnameratingactions
${team.id}${team.name}${team.rating} 30 | Edit
31 | Delete
32 |
37 | 38 |

Home page

39 | 40 | 41 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/webapp/WEB-INF/weblogic.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | / 4 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/main/webapp/htm2box.jsp: -------------------------------------------------------------------------------- 1 | <% 2 | com.jsqlboxdemo.dispatcher.Dispatcher.dispach(pageContext); 3 | %> -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/test/java/com/jsqlboxdemo/integration/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 7 | * applicable law or agreed to in writing, software distributed under the 8 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific 10 | * language governing permissions and limitations under the License. 11 | */ 12 | package com.jsqlboxdemo.integration; 13 | 14 | /** 15 | * This is Integration test demo 16 | * 17 | * @author Yong Zhu 18 | */ 19 | @SuppressWarnings("all") 20 | public class IntegrationTest { 21 | // To add in future, use embedded Jetty + Spring-Boot or HttpClient 22 | } 23 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/test/java/com/jsqlboxdemo/log/LogTest.java: -------------------------------------------------------------------------------- 1 | package com.jsqlboxdemo.log; 2 | 3 | import org.junit.Test; 4 | 5 | import com.github.drinkjava2.jlogs.Log; 6 | import com.github.drinkjava2.jlogs.LogFactory; 7 | 8 | /** 9 | * This is unit test for services 10 | * 11 | * @author Yong Zhu 12 | * @since 1.0.2 13 | */ 14 | public class LogTest { 15 | Log log = LogFactory.getLog(LogTest.class); 16 | 17 | @Test 18 | public void logTest() { 19 | log.info("Log test"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/test/java/com/jsqlboxdemo/service/TeamServiceTest.java: -------------------------------------------------------------------------------- 1 | package com.jsqlboxdemo.service; 2 | 3 | import java.util.List; 4 | 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | import com.jsqlboxdemo.TestBase; 9 | 10 | import model.Team; 11 | 12 | /** 13 | * This is unit test for services 14 | * 15 | * @author Yong Zhu 16 | * @since 1.0.2 17 | */ 18 | public class TeamServiceTest extends TestBase { 19 | 20 | @Test 21 | public void listAllTest() { 22 | List teams = teamServices.listAll(); 23 | Assert.assertEquals(5, teams.size()); 24 | } 25 | 26 | @Test 27 | public void ListEqualTest() { 28 | List teams = teamServices.listEqual(10); 29 | Assert.assertEquals(1, teams.size()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/test/resources/common-logging.properties: -------------------------------------------------------------------------------- 1 | #if commons log jar found in class path, will use it, otherwise will use JDK logger. 2 | 3 | #if found commons log jar, this configuration file will effect 4 | 5 | #Below line tell commons log to load Log4j 6 | 7 | 8 | 9 | 10 | 11 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger 12 | -------------------------------------------------------------------------------- /demo/jsqlbox-jbooox/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, stdout 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.Target=System.out 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | #log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{20}:%L-%m%n 6 | log4j.appender.stdout.layout.ConversionPattern=%m%n -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/Readme.md: -------------------------------------------------------------------------------- 1 | 项目启动步骤 2 | 3 | 1. 启动jFinal: 双击批处理文件 maven start jfinal.bat 4 | 2. 在浏览器查看效果: http://localhost 5 | 6 | 注意数据的第一行演示删不掉,目的是为了演示jSqlBox使用jFinal的声明式事务,删除第一行会抛出一个Div/0错误,事务会自动回滚。 7 | 8 | 注意:如果要导入Eclipse中运行,必须: 9 | 1)命令行下运行maven_eclipse:eclipse,生成Eclipse的配置文件.classpath和.project,导入Eclipse 10 | 2) 修改源代码中DemoConfig.java中的path="webapp" 为path="target/jsqlbox-in-jfinal-1.0" 11 | 3)运行"maven_clean_package.bat"批处理文件,重新编译项目(以后每次更改源码后都需要) 12 | 4) 选中DemoConfig.java,选择“Run as” ->"Java Application" 13 | 14 | 15 | 注意: 16 | Tomcat下运行项目需要先删除jetty-server-xxx.jar或改变pom.xml中此项scope为"privided",否则可能会有冲突。 17 | 本演示项目需Java1.8或更高版本。 18 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/maven start jfinal.bat: -------------------------------------------------------------------------------- 1 | call mvn clean package 2 | cd target 3 | xcopy ".\jsqlbox-jfinal-1.0\*.*" ".\classes\webapp\" /S /D /Y /Q >nul 4 | cd classes 5 | java -classpath .;.\\webapp\WEB-INF\lib\* com.demo.common.DemoConfig 6 | @pause -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/maven_clean.bat: -------------------------------------------------------------------------------- 1 | mvn clean -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/maven_clean_package.bat: -------------------------------------------------------------------------------- 1 | call mvn clean package 2 | @pause -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/java/com/demo/blog/BlogController.java: -------------------------------------------------------------------------------- 1 | package com.demo.blog; 2 | 3 | import com.demo.common.Blog; 4 | import com.jfinal.aop.Before; 5 | import com.jfinal.core.Controller; 6 | 7 | /** 8 | * 本 demo 仅表达最为粗浅的 jfinal 用法,更为有价值的实用的企业级用法 详见 JFinal 俱乐部: 9 | * http://jfinal.com/club 10 | * 11 | * BlogController 所有 sql 与业务逻辑写在 Model 或 Service 中,不要写在 Controller 12 | * 中,养成好习惯,有利于大型项目的开发与维护 13 | */ 14 | @Before(BlogInterceptor.class) 15 | public class BlogController extends Controller { 16 | 17 | BlogService service = BlogService.me; 18 | 19 | public void index() { 20 | setAttr("blogPage", service.paginate(getParaToInt(0, 1), 10)); 21 | render("blog.html"); 22 | } 23 | 24 | public void add() { 25 | } 26 | 27 | static int nextId=1000; 28 | 29 | /** 30 | * save 与 update 的业务逻辑在实际应用中也应该放在 serivce 之中, 并要对数据进正确性进行验证,在此仅为了偷懒 31 | */ 32 | @Before(BlogValidator.class) 33 | public void save() { 34 | getBean(Blog.class).putField("id", nextId++).insert(); 35 | redirect("/blog"); 36 | } 37 | 38 | public void edit() { 39 | setAttr("blog", service.findById(getParaToInt())); 40 | } 41 | 42 | /** 43 | * save 与 update 的业务逻辑在实际应用中也应该放在 serivce 之中, 并要对数据进正确性进行验证,在此仅为了偷懒 44 | */ 45 | @Before(BlogValidator.class) 46 | public void update() { 47 | getBean(Blog.class).update(); 48 | redirect("/blog"); 49 | } 50 | 51 | public void delete() { 52 | service.deleteById(getParaToInt()); 53 | redirect("/blog"); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/java/com/demo/blog/BlogInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.demo.blog; 2 | 3 | import com.jfinal.aop.Interceptor; 4 | import com.jfinal.aop.Invocation; 5 | 6 | /** 7 | * 本 demo 仅表达最为粗浅的 jfinal 用法,更为有价值的实用的企业级用法 8 | * 详见 JFinal 俱乐部: http://jfinal.com/club 9 | * 10 | * BlogInterceptor 11 | * 此拦截器仅做为示例展示,在本 demo 中并不需要 12 | */ 13 | public class BlogInterceptor implements Interceptor { 14 | 15 | public void intercept(Invocation inv) { 16 | System.out.println("Before invoking " + inv.getActionKey()); 17 | inv.invoke(); 18 | System.out.println("After invoking " + inv.getActionKey()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/java/com/demo/blog/BlogValidator.java: -------------------------------------------------------------------------------- 1 | package com.demo.blog; 2 | 3 | import com.demo.common.Blog; 4 | import com.jfinal.core.Controller; 5 | import com.jfinal.validate.Validator; 6 | 7 | /** 8 | * 本 demo 仅表达最为粗浅的 jfinal 用法,更为有价值的实用的企业级用法 详见 JFinal 俱乐部: 9 | * http://jfinal.com/club 10 | * 11 | * BlogValidator. 12 | */ 13 | public class BlogValidator extends Validator { 14 | 15 | protected void validate(Controller controller) { 16 | validateRequiredString("blog.title", "titleMsg", "请输入Blog标题!"); 17 | validateRequiredString("blog.content", "contentMsg", "请输入Blog内容!"); 18 | } 19 | 20 | protected void handleError(Controller controller) { 21 | controller.keepBean(Blog.class); // 当切换到jSqlBox后,keepModel方法失效要用keepBean方法 22 | String actionKey = getActionKey(); 23 | if (actionKey.equals("/blog/save")) 24 | controller.render("add.html"); 25 | else if (actionKey.equals("/blog/update")) 26 | controller.render("edit.html"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/java/com/demo/common/Blog.java: -------------------------------------------------------------------------------- 1 | package com.demo.common; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 4 | import com.github.drinkjava2.jsqlbox.ActiveEntity; 5 | 6 | /** 7 | * 本 demo 仅表达最为粗浅的 jfinal 用法,更为有价值的实用的企业级用法 详见 JFinal 俱乐部: 8 | * http://jfinal.com/club 9 | * 10 | * Blog model. 数据库字段名建议使用驼峰命名规则,便于与 java 代码保持一致,如字段名: userId 11 | */ 12 | public class Blog implements ActiveEntity { 13 | @Id 14 | private Integer id; 15 | private String title; 16 | private String content; 17 | 18 | public Integer getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Integer id) { 23 | this.id = id; 24 | } 25 | 26 | public String getTitle() { 27 | return title; 28 | } 29 | 30 | public void setTitle(String title) { 31 | this.title = title; 32 | } 33 | 34 | public String getContent() { 35 | return content; 36 | } 37 | 38 | public void setContent(String content) { 39 | this.content = content; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/java/com/demo/index/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.demo.index; 2 | 3 | import com.jfinal.core.Controller; 4 | 5 | /** 6 | * 本 demo 仅表达最为粗浅的 jfinal 用法,更为有价值的实用的企业级用法 7 | * 详见 JFinal 俱乐部: http://jfinal.com/club 8 | * 9 | * IndexController 10 | */ 11 | public class IndexController extends Controller { 12 | public void index() { 13 | render("index.html"); 14 | } 15 | } 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/resources/a_little_config.txt: -------------------------------------------------------------------------------- 1 | jdbcUrl = jdbc:h2:mem:DBName;MODE=MYSQL;DB_CLOSE_DELAY=-1;TRACE_LEVEL_SYSTEM_OUT=0 2 | user = sa 3 | password = 4 | devMode = false 5 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # log4j.rootLogger=WARN, stdout, file 2 | log4j.rootLogger=ERROR, stdout, file 3 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.stdout.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n 6 | 7 | # Output to the File 8 | log4j.appender.file=org.apache.log4j.DailyRollingFileAppender 9 | log4j.appender.file.DatePattern='_'yyyy-MM-dd'.log' 10 | log4j.appender.file.File=./jfinal_demo.log 11 | log4j.appender.file.layout=org.apache.log4j.PatternLayout 12 | log4j.appender.file.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jfinal 5 | com.jfinal.core.JFinalFilter 6 | 7 | configClass 8 | com.demo.common.DemoConfig 9 | 10 | 11 | 12 | 13 | jfinal 14 | /* 15 | 16 | -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/blog/_form.html: -------------------------------------------------------------------------------- 1 |
2 | 创建Blog 3 | 4 |
5 | 6 | #(titleMsg) 7 |
8 |
9 | 10 | #(contentMsg) 11 |
12 |
13 | 14 | 15 |
16 |
-------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/blog/add.html: -------------------------------------------------------------------------------- 1 | #@layout() 2 | #define main() 3 |

Blog管理 ---> 创建Blog 4 |

5 |
6 |
7 | #include("_form.html") 8 |
9 |
10 | #end -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/blog/blog.html: -------------------------------------------------------------------------------- 1 | #@layout() 2 | #define main() 3 |

Blog管理   4 | 创建Blog 5 |

6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | #for(x : blogPage.getList()) 16 | 17 | 18 | 19 | 23 | 24 | #end 25 | 26 |
id标题操作
#(x.id)#(x.title) 20 |   删除 21 |   修改 22 |
27 | #@paginate(blogPage.pageNumber, blogPage.totalPage, "/blog/") 28 |
29 | #end -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/blog/edit.html: -------------------------------------------------------------------------------- 1 | #@layout() 2 | #define main() 3 |

Blog管理 ---> 修改Blog 4 |

5 |
6 |
7 | #include("_form.html") 8 |
9 |
10 | #end -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/common/_layout.html: -------------------------------------------------------------------------------- 1 | #define layout() 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 | 15 | 21 |
22 |
23 | #@main() 24 |
25 |
26 | 27 | 28 | #end -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drinkjava2/jSqlBox/94e2e6ba9101b9aeab0493561aee2bc166957095/demo/jsqlbox-jfinal/src/main/webapp/favicon.ico -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/img/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drinkjava2/jSqlBox/94e2e6ba9101b9aeab0493561aee2bc166957095/demo/jsqlbox-jfinal/src/main/webapp/img/bg.gif -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/img/left2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drinkjava2/jSqlBox/94e2e6ba9101b9aeab0493561aee2bc166957095/demo/jsqlbox-jfinal/src/main/webapp/img/left2.gif -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/img/right2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drinkjava2/jSqlBox/94e2e6ba9101b9aeab0493561aee2bc166957095/demo/jsqlbox-jfinal/src/main/webapp/img/right2.gif -------------------------------------------------------------------------------- /demo/jsqlbox-jfinal/src/main/webapp/index/index.html: -------------------------------------------------------------------------------- 1 | #@layout() 2 | #define main() 3 |

JFinal Demo 项目首页

4 |
5 |

欢迎来到 JFinal极速开发世界!

6 | 7 |


8 | 9 | 本Demo采用 JFinal Template 作为视图文件。 10 | 点击此处开始试用Demo。 11 | 12 |











13 |











14 |
15 | #end -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/README.md: -------------------------------------------------------------------------------- 1 | ## jsqlbox-in-springboot-mybatis 2 | This is a demo project to show mixed use jSqlBox and MyBatis in SpringBoot. 3 | 4 | 这是一个为了演示jSqlBox和MyBatis在springboot环境中混用而创建的项目,项目架构是SpringBoot(用到了它的H2数据源支持、声明式事务、IOC/AOP、MVC) + jSqlBox + MyBatis 5 | 编译及运行本项目需Java8或以上环境。 6 | 7 | 编译及运行:mvn spring-boot:run 8 | 在浏览器查看: http://localhost 9 | 10 | 备注: 另外一种混用MyBatis和jSqlBoxr的方式是使用MyFat插件,它的原理是对MyBatis的SqlSession和Mapper进行了增强,将jSqlBox的功能织入到MyBatis中去,使用起来更方便,详见[MyFat](https://gitee.com/drinkjava2/myfat)项目介绍。 -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/maven_clean.bat: -------------------------------------------------------------------------------- 1 | mvn clean -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/maven_test.bat: -------------------------------------------------------------------------------- 1 | call mvn clean test 2 | @pause -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/mvn spring-boot run.bat: -------------------------------------------------------------------------------- 1 | call mvn spring-boot:run 2 | pause -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/src/main/java/com/example/jsqlboxinspringboot/entity/Customer.java: -------------------------------------------------------------------------------- 1 | package com.example.jsqlboxinspringboot.entity; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jdia.UUID32; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 5 | import com.github.drinkjava2.jsqlbox.ActiveEntity; 6 | 7 | public class Customer implements ActiveEntity { 8 | 9 | @Id 10 | @UUID32 11 | String id; 12 | 13 | String name; 14 | 15 | public String getId() { 16 | return id; 17 | } 18 | 19 | public void setId(String id) { 20 | this.id = id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/src/main/java/com/example/jsqlboxinspringboot/entity/CustomerMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.jsqlboxinspringboot.entity; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.apache.ibatis.annotations.Select; 9 | 10 | /** 11 | * User映射类 Created by Administrator on 2017/11/24. 12 | */ 13 | @Mapper 14 | public interface CustomerMapper { 15 | 16 | @Select("SELECT * FROM Customer") 17 | List findAllCustomers(); 18 | 19 | @Insert("INSERT INTO Customer(id, name) VALUES(#{id}, #{name})") 20 | int insert(@Param("id") String id, @Param("name") String name); 21 | 22 | } -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=80 -------------------------------------------------------------------------------- /demo/jsqlbox-mybatis/src/test/java/com/example/jsqlboxinspringboot/JsqlboxInSpringbootApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.jsqlboxinspringboot; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class JsqlboxInSpringbootApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/README.md: -------------------------------------------------------------------------------- 1 | ## jSqlBox-querydsl 2 | This is a demo project to show how to use querydsl-maven-plugin to generate QClass and used in jSqlBox 3 | 4 | Q类可用于写出可重构的SQL, 这个演示项目演示Q类的两种生成方式: 5 | 6 | 1.利用querydsl-maven-plugin插件生成QClass并在jSqlBox中使用 7 | a. 先运行maven_eclipse_eclipse.bat批处理,生成QClass, 如果已存在QClass类,必须先运行maven_eclipse_clean.bat清除已有的设置 8 | b. jSqlBox的DbContext初始化时,设定一个定制的SqlItemHandler 9 | c. 在jSqlBox的qry系列方法中,可以直接使用QClass的属性作为SQL的一部分,运行期间会自动将这个属性转化为对应数据库表的列名来拼接SQL 10 | 11 | 12 | 2.利用jSqlBox自带的根据数据库生成源码功能,直接从数据库生成Q类源代码,这种方式可以自定义类名,示例中自定义为P类 13 | 用法示例:TableModelUtils.db2QClassSrcFiles(ctx.getDataSource(), ctx.getDialect(), "c:/temp", "com.github.drinkjava2.jsqlboxdemo", "P"); 14 | jSqlBox自带功能生成的源码示例如下: 15 | ``` 16 | package com.github.drinkjava2.jsqlboxdemo; 17 | 18 | public class PUserDemo { 19 | public static final PUserDemo userDemo = new PUserDemo(); 20 | 21 | public String toString(){ 22 | return "user_demo"; 23 | } 24 | 25 | public final String id = "id"; 26 | 27 | public final String userAge = "user_age"; 28 | 29 | public final String userName = "user_name"; 30 | 31 | } 32 | ``` 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/command.bat: -------------------------------------------------------------------------------- 1 | cmd -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/maven_clean.bat: -------------------------------------------------------------------------------- 1 | mvn clean -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/maven_test.bat: -------------------------------------------------------------------------------- 1 | call mvn clean test 2 | @pause -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/src/main/java/com/github/drinkjava2/User.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | 8 | import com.github.drinkjava2.jdialects.annotation.jdia.UUID25; 9 | import com.github.drinkjava2.jsqlbox.ActiveEntity; 10 | 11 | @Entity 12 | @Table(name = "user_demo") 13 | public class User implements ActiveEntity { 14 | 15 | @UUID25 16 | @Id 17 | private Integer id; 18 | 19 | @Column(name = "user_name") 20 | private String userName; 21 | 22 | @Column(name = "user_age") 23 | private Integer userAge; 24 | 25 | public Integer getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Integer id) { 30 | this.id = id; 31 | } 32 | 33 | public String getUserName() { 34 | return userName; 35 | } 36 | 37 | public void setUserName(String userName) { 38 | this.userName = userName; 39 | } 40 | 41 | public Integer getUserAge() { 42 | return userAge; 43 | } 44 | 45 | public void setUserAge(Integer userAge) { 46 | this.userAge = userAge; 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/src/main/java/com/github/drinkjava2/demo/jsqlbox1/QUserDemo.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.demo.jsqlbox1; 2 | 3 | public class QUserDemo {//注意这个文件是jSqlBox根据数据库自动生成的 4 | public static final QUserDemo instance = new QUserDemo(); 5 | 6 | public String toString(){ 7 | return "user_demo"; 8 | } 9 | 10 | public final String id = "id"; 11 | 12 | public final String user_age = "user_age"; 13 | 14 | public final String user_name = "user_name"; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /demo/jsqlbox-qclass/src/main/java/com/github/drinkjava2/demo/jsqlbox2/QUserDemo.java: -------------------------------------------------------------------------------- 1 | package com.github.drinkjava2.demo.jsqlbox2; 2 | 3 | public class QUserDemo {//注意这个文件是jSqlBox根据数据库自动生成的 4 | public static final QUserDemo userDemo = new QUserDemo(); 5 | 6 | public String toString(){ 7 | return "user_demo"; 8 | } 9 | 10 | public final String id = "id"; 11 | 12 | public final String userAge = "user_age"; 13 | 14 | public final String userName = "user_name"; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/README.md: -------------------------------------------------------------------------------- 1 | ## jsqlbox-in-spring 2 | This is a demo project to show use jSqlBox in Spring. 3 | 4 | 这是一个传统WebApp演示项目,必须发布到Tomcat或WebLogic下运行,已有点过时,推荐使用内嵌Web服务模式,见jsqlbox-in-springboot目录下示例。 5 | 6 | 本演示项目主体部分来源于https://github.com/Fruzenshtein/spr-mvc-hib 演示项目,原项目架构是Hibernate + SpringTx + SpringIOC + SpringMVC + MySql,本项目将其中的Hibernate用jSqlBox替换掉,MySql用H2内存数据库替换掉(以避免配置数据库的麻烦),其余部分不变。 7 | 编译及运行本项目需Java8, Tomcat7以上环境,必须发布到Tomcat目录下运行。 8 | 9 | 运行方式:修改deploy_tomcat.bat批处理文本,指向本机的Tomcat路径,双击运行 10 | 查看:浏览器输入 http://localhost 11 | 单元测试:运行 mvn test 12 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/deploy_tomcat.bat: -------------------------------------------------------------------------------- 1 | call mvn clean -DskipTests package 2 | 3 | rd /s/q /q C:\tomcat8\logs 4 | md C:\tomcat8\logs 5 | 6 | rd /s/q /q C:\tomcat8\work 7 | md C:\tomcat7\work 8 | 9 | rd /s/q /q C:\tomcat8\webapps 10 | md C:\tomcat8\webapps 11 | 12 | cd target 13 | del ROOT.war 14 | ren *.war ROOT.war 15 | copy ROOT.war C:\tomcat8\webapps\ /y 16 | 17 | c: 18 | cd C:\tomcat8\bin\ 19 | call startup.bat 20 | 21 | start http://127.0.0.1 22 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/deploy_weblogic.bat: -------------------------------------------------------------------------------- 1 | call mvn clean -DskipTests package 2 | @echo off 3 | 4 | @echo on 5 | cd target 6 | del ROOT.war 7 | ren *.war ROOT.war 8 | 9 | copy ROOT.war C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\autodeploy\ /y 10 | 11 | call C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\startWebLogic.cmd 12 | 13 | rem To avoid input http://127.0.0.1/ROOT, need put a weblogic.xml file in web-inf folder 14 | start http://127.0.0.1/ -------------------------------------------------------------------------------- /demo/jsqlbox-spring/maven_clean.bat: -------------------------------------------------------------------------------- 1 | mvn clean -------------------------------------------------------------------------------- /demo/jsqlbox-spring/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-spring/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | pause -------------------------------------------------------------------------------- /demo/jsqlbox-spring/maven_test.bat: -------------------------------------------------------------------------------- 1 | call mvn clean test 2 | pause -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/java/com/demo/controller/LinkController.java: -------------------------------------------------------------------------------- 1 | package com.demo.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.servlet.ModelAndView; 6 | 7 | @Controller 8 | public class LinkController { 9 | 10 | @RequestMapping(value="/") 11 | public ModelAndView mainPage() { 12 | return new ModelAndView("home"); 13 | } 14 | 15 | @RequestMapping(value="/index") 16 | public ModelAndView indexPage() { 17 | return new ModelAndView("home"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/java/com/demo/service/TeamService.java: -------------------------------------------------------------------------------- 1 | package com.demo.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.stereotype.Service; 6 | import org.springframework.transaction.annotation.Transactional; 7 | 8 | import com.demo.model.Team; 9 | import com.github.drinkjava2.jsqlbox.DB; 10 | import com.github.drinkjava2.jsqlbox.JSQLBOX; 11 | import com.github.drinkjava2.jsqlbox.handler.EntityListHandler; 12 | 13 | @Service 14 | @Transactional 15 | public class TeamService { 16 | 17 | public void addTeam(Team team) { 18 | team.insert(); 19 | } 20 | 21 | public void updateTeam(Team team) { 22 | team.update(); 23 | } 24 | 25 | public Team getTeam(Integer id) { 26 | return new Team().loadById(id); 27 | } 28 | 29 | public void deleteTeam(int id) { 30 | new Team().putField("id", id).delete(); 31 | } 32 | 33 | public List getTeams() { 34 | return new Team().finaAllTeams(); 35 | } 36 | 37 | public List getTeamByName(String name) { 38 | return JSQLBOX.qry(new EntityListHandler(), Team.class, "select t.* from teams t where t.name=?", DB.par(name)); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/resources/common-logging.properties: -------------------------------------------------------------------------------- 1 | #if commons log jar found in class path, will use it, otherwise will use JDK logger. 2 | 3 | #if found commons log jar, this configuration file will effect 4 | 5 | #Below line tell commons log to load Log4j 6 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger 7 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, stdout 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.Target=System.out 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | #log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{20}:%L-%m%n 6 | log4j.appender.stdout.layout.ConversionPattern=%m%n -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Fruzenshtein 3 | Build-Jdk: 1.7.0_09 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/webapp/META-INF/maven/com.mvchib/spring/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sat Apr 27 14:25:18 EEST 2013 3 | version=0.0.1-SNAPSHOT 4 | groupId=com.mvchib 5 | m2e.projectName=spr-mvc-hib 6 | m2e.projectLocation=E\:\\spring_progs\\spr-mvc-hib 7 | artifactId=spring 8 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/webapp/WEB-INF/pages/add-team-form.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> 2 | 3 | 4 | 5 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 6 | pageEncoding="ISO-8859-1"%> 7 | 8 | 9 | 10 | 11 | 12 | Add team page 13 | 14 | 15 |

Add team page

16 |

Here you can add a new team.

17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
Name:
Rating:
34 |
35 | 36 |

Home page

37 | 38 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/webapp/WEB-INF/pages/edit-team-form.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> 2 | 3 | 4 | 5 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 6 | pageEncoding="ISO-8859-1"%> 7 | 8 | 9 | 10 | 11 | 12 | Edit team page 13 | 14 | 15 |

Edit team page

16 |

Here you can edit the existing team.

17 |

${message}

18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
Name:
Rating:
35 |
36 | 37 |

Home page

38 | 39 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/webapp/WEB-INF/pages/home.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 3 | pageEncoding="ISO-8859-1"%> 4 | 5 | 6 | 7 | 8 | Home page 9 | 10 | 11 |

Home page

12 |

13 | ${message}
14 | Add new team
15 | Team list
16 |

17 | 18 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/webapp/WEB-INF/pages/list-of-teams.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 2 | 3 | 4 | 5 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 6 | pageEncoding="ISO-8859-1"%> 7 | 8 | 9 | 10 | 11 | List of teams 12 | 13 | 14 |

List of teams

15 |

Here you can see the list of the teams, edit them, remove or update.

16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 |
idnameratingactions
${team.id}${team.name}${team.rating} 29 | Edit
30 | Delete
31 |
36 | 37 |

Home page

38 | 39 | 40 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/main/webapp/WEB-INF/weblogic.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | / 4 | -------------------------------------------------------------------------------- /demo/jsqlbox-spring/src/test/java/com/demo/init/BaseTestConfig.java: -------------------------------------------------------------------------------- 1 | package com.demo.init; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 7 | import org.springframework.web.servlet.view.JstlView; 8 | import org.springframework.web.servlet.view.UrlBasedViewResolver; 9 | 10 | @Configuration 11 | @ComponentScan("com.demo") 12 | @EnableWebMvc 13 | public class BaseTestConfig { 14 | 15 | @Bean 16 | public UrlBasedViewResolver setupViewResolver() { 17 | UrlBasedViewResolver resolver = new UrlBasedViewResolver(); 18 | resolver.setPrefix("/WEB-INF/pages/"); 19 | resolver.setSuffix(".jsp"); 20 | resolver.setViewClass(JstlView.class); 21 | return resolver; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/README.md: -------------------------------------------------------------------------------- 1 | ## jsqlbox-in-springboot 2 | This is a demo project to show use jSqlBox in SpringBoot. 3 | 4 | 这是一个为了演示jSqlBox在springboot环境中使用而创建的项目,项目架构是SpringBoot(用到了它的H2数据源支持、声明式事务、IOC/AOP、MVC) + jSqlBox 5 | 编译及运行本项目需Java8或以上环境。 6 | 7 | 编译及运行:mvn spring-boot:run 8 | 在浏览器查看: http://localhost -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/maven_clean.bat: -------------------------------------------------------------------------------- 1 | mvn clean -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/maven_eclipse_clean.bat: -------------------------------------------------------------------------------- 1 | mvn eclipse:clean -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/maven_eclipse_eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:eclipse 2 | call pause -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/maven_test.bat: -------------------------------------------------------------------------------- 1 | call mvn clean test 2 | @pause -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/mvn spring-boot run.bat: -------------------------------------------------------------------------------- 1 | call mvn spring-boot:run 2 | pause -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/src/main/java/com/example/jsqlboxinspringboot/entity/Customer.java: -------------------------------------------------------------------------------- 1 | package com.example.jsqlboxinspringboot.entity; 2 | 3 | import com.github.drinkjava2.jdialects.annotation.jdia.UUID32; 4 | import com.github.drinkjava2.jdialects.annotation.jpa.Id; 5 | import com.github.drinkjava2.jsqlbox.ActiveEntity; 6 | 7 | public class Customer implements ActiveEntity { 8 | 9 | @Id 10 | @UUID32 11 | String id; 12 | 13 | String name; 14 | 15 | public String getId() { 16 | return id; 17 | } 18 | 19 | public void setId(String id) { 20 | this.id = id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/src/main/java/com/example/jsqlboxinspringboot/services/Services.java: -------------------------------------------------------------------------------- 1 | package com.example.jsqlboxinspringboot.services; 2 | 3 | import static com.github.drinkjava2.jsqlbox.DB.entityCount; 4 | 5 | import org.springframework.stereotype.Service; 6 | import org.springframework.transaction.annotation.Transactional; 7 | 8 | import com.example.jsqlboxinspringboot.entity.Customer; 9 | 10 | @Service 11 | public class Services { 12 | 13 | @Transactional 14 | public void insertOne() { 15 | new Customer().putField("name", "Custome A").insert(); 16 | } 17 | 18 | @Transactional 19 | public void errorInsert() { 20 | new Customer().putField("name", "Another B").insert(); 21 | System.out.println("Now have " + entityCount(Customer.class) + " records in database, but will roll back to " 22 | + (entityCount(Customer.class) - 1) + " records because Div/0 exception will happen."); 23 | System.out.println(1 / 0); // div 0!, show transaction roll back 24 | } 25 | } -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=80 -------------------------------------------------------------------------------- /demo/jsqlbox-springboot/src/test/java/com/example/jsqlboxinspringboot/JsqlboxInSpringbootApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.jsqlboxinspringboot; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class JsqlboxInSpringbootApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /demo/mvn_clean_all.bat: -------------------------------------------------------------------------------- 1 | cd jsqlbox-actframework 2 | call mvn clean 3 | call mvn eclipse:clean 4 | call del .act.* 5 | call del act.* 6 | cd.. 7 | 8 | cd jsqlbox-atomikos 9 | call mvn clean 10 | call mvn eclipse:clean 11 | del tmlog*.log 12 | del tmlog.lck 13 | cd.. 14 | 15 | cd jsqlbox-beetl 16 | call mvn clean 17 | call mvn eclipse:clean 18 | cd.. 19 | 20 | cd jsqlbox-jbooox 21 | call mvn clean 22 | call mvn eclipse:clean 23 | cd.. 24 | 25 | cd jsqlbox-jfinal 26 | call mvn clean 27 | call mvn eclipse:clean 28 | call del *.log 29 | cd.. 30 | 31 | cd jsqlbox-mybatis 32 | call mvn clean 33 | call mvn eclipse:clean 34 | cd.. 35 | 36 | cd jsqlbox-qclass 37 | call mvn clean 38 | call mvn eclipse:clean 39 | cd.. 40 | 41 | cd jsqlbox-spring 42 | call mvn clean 43 | call mvn eclipse:clean 44 | cd.. 45 | 46 | cd jsqlbox-springboot 47 | call mvn clean 48 | call mvn eclipse:clean 49 | cd.. 50 | 51 | -------------------------------------------------------------------------------- /demo/mvn_eclipse_all.bat: -------------------------------------------------------------------------------- 1 | cd jsqlbox-actframework 2 | call mvn clean 3 | call mvn eclipse:eclipse 4 | cd.. 5 | 6 | cd jsqlbox-atomikos 7 | call mvn clean 8 | call mvn eclipse:eclipse 9 | cd.. 10 | 11 | cd jsqlbox-beetl 12 | call mvn clean 13 | call mvn eclipse:eclipse 14 | cd.. 15 | 16 | cd jsqlbox-jbooox 17 | call mvn clean 18 | call mvn eclipse:eclipse 19 | cd.. 20 | 21 | cd jsqlbox-jfinal 22 | call mvn clean 23 | call mvn eclipse:eclipse 24 | cd.. 25 | 26 | cd jsqlbox-mybatis 27 | call mvn clean 28 | call mvn eclipse:eclipse 29 | cd.. 30 | 31 | cd jsqlbox-qclass 32 | call mvn clean 33 | call mvn eclipse:eclipse 34 | cd.. 35 | 36 | cd jsqlbox-spring 37 | call mvn clean 38 | call mvn eclipse:eclipse 39 | cd.. 40 | 41 | cd jsqlbox-springboot 42 | call mvn clean 43 | call mvn eclipse:eclipse 44 | cd.. -------------------------------------------------------------------------------- /jsqlbox-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drinkjava2/jSqlBox/94e2e6ba9101b9aeab0493561aee2bc166957095/jsqlbox-logo.png -------------------------------------------------------------------------------- /orm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drinkjava2/jSqlBox/94e2e6ba9101b9aeab0493561aee2bc166957095/orm.png -------------------------------------------------------------------------------- /tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drinkjava2/jSqlBox/94e2e6ba9101b9aeab0493561aee2bc166957095/tree.png --------------------------------------------------------------------------------