Compare commits

...
Author SHA1 Message Date
Rob Bygrave e027110006 [maven-release-plugin] prepare release ebean-9.5.1 2016-12-10 00:08:42 +13:00
Rob Bygrave b5e6e9a66c Bump pom to 9.5.1-SNAPSHOT 2016-12-10 00:06:09 +13:00
Rob Bygrave 514047e680 #918 - Remove DbMigrationConfig.generateOnStart() ... migrate to offline generation 2016-12-10 00:04:41 +13:00
Rob Bygrave a727a98a21 #917 - ENH: Add findNative() ... ala automatic mapping of native SQL into object graphs / paths. 2016-12-09 23:45:57 +13:00
Rob Bygrave e75b5e8b30 #916 - Refactor internals - bump use of 31 in hashes to 92821 2016-12-08 23:28:58 +13:00
Rob Bygrave ad0e085ff5 #915 - Refactor internals - Change update plan to string key 2016-12-08 23:23:19 +13:00
Rob Bygrave 322a2f500d No effective change - move method - BeanDescriptor.merge() 2016-12-08 23:01:05 +13:00
Rob Bygrave 1c7454d249 [maven-release-plugin] prepare for next development iteration 2016-12-08 22:26:13 +13:00
Rob Bygrave e1efca6736 [maven-release-plugin] prepare release ebean-9.4.2 2016-12-08 22:26:04 +13:00
Rob Bygrave 8ae61074ad #914 - Fix multi-tenancy support such that it automatically propagates the tenantId for lazy loading 2016-12-08 22:04:18 +13:00
Rob Bygrave c3bc0c4975 #913 - IllegalArgumentException: No enum constant com.avaje.ebean.config.Platform.HSQLDB 2016-12-07 21:58:07 +13:00
Rob Bygrave 611bba272a Modify testAggregationCount to make MySql happy - avoid count(u1.*) 2016-12-07 21:39:26 +13:00
Rob Bygrave 4c9ec38c88 [maven-release-plugin] prepare for next development iteration 2016-12-06 23:44:35 +13:00
Rob Bygrave e2731a99be [maven-release-plugin] prepare release ebean-9.4.1 2016-12-06 23:44:26 +13:00
Rob Bygrave 7d56df3b23 Bump pom to 9.4.1-SNAPSHOT 2016-12-06 23:43:37 +13:00
Rob Bygrave bebef48332 Update test ebean.properties 2016-12-03 22:03:55 +13:00
Rob Bygrave f66ea12fbf #912 - Refactor - move platform specfic code into subpackages 2016-12-03 15:39:24 +13:00
Rob Bygrave b08f1580f9 #910 - SQL Server update - Add ANSI based row limiter (2012+) and make as default platform 2016-12-03 15:10:11 +13:00
Rob Bygrave 707912f7ad No effective change - add some wait into history test (TestHistoryInsert) 2016-12-03 13:55:45 +13:00
Rob Bygrave 5ce31b16d4 #910 - SQL Server update - refactor rename platform to SqlServerPlatform 2016-12-03 13:30:17 +13:00
Rob Bygrave a5945b1d5d #911 - SQL Server - remove old MsSqlServer2000Platform (expecting users migrated to SQL Server 2005+) 2016-12-03 13:24:52 +13:00
Rob Bygrave b8577ae6d0 #910 - SQL Server update - tidy whitespace for MsSqlServer2005SqlLimiter 2016-12-03 13:19:15 +13:00
Rob Bygrave 14dedb7b9a #910 - SQL Server update 2016-12-03 13:18:33 +13:00
Rob Bygrave 2dbd543127 #909 - @Lob with @Size ... produces incorrect DDL for Postgres 2016-12-03 08:42:46 +13:00
Rob Bygrave cc989af1c6 #908 - Remove support for Immutable Compound Values 2016-12-02 22:49:00 +13:00
Rob Bygrave 0aad285f35 #907 - Remove Model.Finder ... migrate to Finder 2016-12-02 21:47:30 +13:00
Rob Bygrave a3754e31f2 #906 - Add NamingConvention Support for JoinColumn (OneToMany, ManyToOne) - was PR #887 2016-12-02 21:21:19 +13:00
Rob Bygrave 1dd0f3f609 [maven-release-plugin] prepare for next development iteration 2016-12-01 21:04:18 +13:00
Rob Bygrave f9b381b10a [maven-release-plugin] prepare release ebean-9.3.1 2016-12-01 21:04:09 +13:00
Rob Bygrave 6e2d7a89f8 #493 - ENH: Multi-tenant support - update bootup DataSource check 2016-12-01 21:02:52 +13:00
Rob Bygrave dfa336239f #493 - ENH: Multi-tenant support - update bootup DataSource check 2016-12-01 20:43:47 +13:00
Rob Bygrave 3a28dd0d55 #493 - ENH: Multi-tenant support - nice error when explicit DatabasePlatform not set, turn off DDL run automatically 2016-12-01 20:23:42 +13:00
Rob Bygrave 502e9daaf2 #493 - ENH: Multi-tenant support - cache tidy up 2016-12-01 00:27:32 +13:00
Rob Bygrave b7c92aec3d No effective change - rename var 2016-11-30 23:09:31 +13:00
Rob Bygrave c0341458c3 #493 - ENH: Multi-tenant support 2016-11-29 01:34:45 +13:00
Rob Bygrave aecac211d9 pom bump ebean-annotation to 1.4 2016-11-28 22:55:57 +13:00
Rob Bygrave c46b235eff #904 - ENH: Add @PreSoftDelete @PostSoftDelete ... such that methods on beans can be used for these callbacks 2016-11-28 22:24:17 +13:00
Rob Bygrave a585447dc9 #903 - Refactor: Internals, BeanPropertyAccess getter and setter methods can be cached and don't need constructor 2016-11-28 22:02:45 +13:00
Rob Bygrave 85bb05d90e Bump ebean-annotation to 1.4-SNAPSHOT 2016-11-28 21:51:37 +13:00
Rob Bygrave 027dd1eba9 #899 - @Unmapped JSON, handle wildcard use (Kotlin Any) 2016-11-28 21:29:16 +13:00
Rob Bygrave 588d5c5cfa #902 - EJsonWriter.write(Object object, Writer writer) ... closes the writer but should not 2016-11-28 21:27:14 +13:00
Rob Bygrave 7ba86f7cf2 #901 - ENH: Use "db" as default EbeanServer name 2016-11-26 00:54:11 +13:00
Rob Bygrave 609dc233a8 #899 - ENH: Add @UnmappedJson support ... (mostly for document store only use / ElasticSearch) 2016-11-25 23:58:55 +13:00
Rob Bygrave 5d7c287821 Bump pom to 9.3.1-SNAPSHOT 2016-11-25 21:18:35 +13:00
Rob Bygrave ff325057c4 #882 - ENH: Support document store only - Add Query.setDocIndexName() 2016-11-25 21:18:16 +13:00
Rob Bygrave cc6469851b #897 - Remove @EmbeddedColumns ... replace with @Embedded(prefix="...") 2016-11-24 22:05:27 +13:00
Rob Bygrave 7f31104439 #827 - ENH: Add support for AttributeConverter from JPA 2.1 2016-11-24 20:21:48 +13:00
Rob Bygrave 2ab98a922d #896 - Bump persistence API 2.1.2 with @Repeatable annotations (most notably, @AttributeOverride and @JoinColumn) 2016-11-24 19:47:08 +13:00
Rob Bygrave 063c1825ca #895 - Refactor: Remove unnecessary coalesce on soft delete (as predicate on left join etc) 2016-11-24 17:19:46 +13:00
Rob Bygrave d0e9c6a218 No effective change - explicit import required 2016-11-24 02:22:23 +13:00
Rob Bygrave 81d829f74e #894 - ENH: Add support for @OneToMany orphanRemoval = true (which is the same as @PrivateOwned) 2016-11-24 02:21:54 +13:00
Rob Bygrave b4a0d9f5ea #893 - Move to persistence API version 2.1.1 2016-11-24 02:17:54 +13:00
Rob Bygrave f0044aba91 #892 - Refactor: Replace Ebean's QueryEachWhileConsumer with java.util.function.Predicate 2016-11-24 00:19:16 +13:00
Rob Bygrave 6f322dcfb2 #891 - Refactor: Replace Ebean's QueryEachConsumer with java.util.function.Consumer 2016-11-24 00:02:23 +13:00
Rob Bygrave a391a25b7f No effective change - update Javadoc on QueryIterator with try with resources 2016-11-23 23:44:54 +13:00
Rob Bygrave 4af350bd14 No effective change - modify one of the QueryIterator tests to use try with resources 2016-11-23 23:40:57 +13:00
Rob Bygrave cdb319f0ef #885 - DbMigrationConfig.loadSettings config has wrong 2016-11-23 23:30:23 +13:00
Rob Bygrave 60ed64cb37 #883 Soft-delete when using fetch (not including soft deleted children) 2016-11-23 23:12:37 +13:00
Rob Bygrave 79efe006ec #888 - Move annotations - remove types that are now in ebean-annotation 2016-11-23 22:05:05 +13:00
Rob Bygrave 70f929949d #888 - Move annotations - bump dependency to ebean-annotation 1.1 (released) 2016-11-23 21:58:17 +13:00
Rob Bygrave d7916eb3ee #888 - Move Ebean annotations into a separate module (initial remove) 2016-11-23 20:36:00 +13:00
Rob Bygrave f724982776 #889 - Refactor: Change @Where @Formula to use Platform (enum) rather than DatabasePlatform (class) 2016-11-23 20:33:35 +13:00
Rob Bygrave 182a47697e #882 - ENH: Support document store only use (ie. Use @DocStore without @Entity and persist, fetch only against ElasticSearch with no SQL DB) 2016-11-21 00:17:28 +13:00
Rob Bygrave d6b37bdf83 No effective change - format only 2016-11-21 00:00:00 +13:00
Rob BygraveandGitHub 0bc2dc7d4c Merge pull request #847 from FOCONIS/feature/platform-dependent-annotations
platform dependent @Formula and @Where annotations
2016-11-20 20:56:27 +13:00
Roland Praml 1263f0f049 Merge remote-tracking branch 'ebean/master' into feature/platform-dependent-annotations
# Conflicts:
#	src/main/java/com/avaje/ebean/annotation/Formula.java
#	src/main/java/com/avaje/ebeaninternal/server/deploy/parse/AnnotationParser.java
2016-11-17 13:31:22 +01:00
Rob Bygrave f4b32e89f5 [maven-release-plugin] prepare for next development iteration 2016-11-17 23:55:50 +13:00
Rob Bygrave 54711a96d3 [maven-release-plugin] prepare release ebean-9.2.1 2016-11-17 23:55:41 +13:00
Rob Bygrave 6ca5ec986c #881 - Split DocPropertyType.STRING into KEYWORD and TEXT ... for ElasticSearch 5.x support 2016-11-17 23:31:43 +13:00
Rob Bygrave 40029edca8 Bump pom to 9.2.1-SNAPSHOT (for doc type split from String to Keyword & Text 2016-11-17 23:01:31 +13:00
Rob Bygrave 4159af9002 No effective change - logback-test.xml 2016-11-17 23:00:14 +13:00
Rob Bygrave b0dae02c42 #881 - Split DocPropertyType.STRING into KEYWORD and TEXT ... for ElasticSearch 5.x support 2016-11-17 22:59:50 +13:00
Rob Bygrave 0322b37ae7 no effective change - format test code 2016-11-17 20:17:46 +13:00
Rob Bygrave 58760fe001 no effective change - format test code 2016-11-17 20:17:21 +13:00
Rob Bygrave 99f3bc8c54 no effective change - format and javadoc 2016-11-17 20:14:35 +13:00
Rob Bygrave d3bf219129 no effective change - format 2016-11-17 20:06:58 +13:00
Rob Bygrave 57813179b2 no effective change - format 2016-11-17 20:05:04 +13:00
Rob Bygrave c410700433 no effective change - format 2016-11-17 20:00:01 +13:00
Rob Bygrave 697e4dd0da no effective change - format and javadoc 2016-11-17 19:58:37 +13:00
Rob Bygrave 60dfe6308e no effective change - format and javadoc 2016-11-17 19:54:54 +13:00
Rob Bygrave 002d7d9f27 no effective change - format only 2016-11-17 19:24:38 +13:00
Rob Bygrave 2dceccfa78 no effective change - format only 2016-11-17 19:22:58 +13:00
Rob Bygrave 5cf9d14237 no effective change - format only 2016-11-17 19:21:17 +13:00
Rob Bygrave bdd4370fe3 no effective change - format only 2016-11-17 19:17:34 +13:00
Rob Bygrave 63b08af3d2 no effective change - format only 2016-11-17 19:14:02 +13:00
Rob Bygrave 983306ed86 no effective change - format only 2016-11-17 19:11:28 +13:00
Rob Bygrave 15973c8992 no effective change - format only 2016-11-17 19:10:02 +13:00
Rob Bygrave b49a52057a no effective change - format only 2016-11-17 19:07:23 +13:00
Rob Bygrave 82151872fd no effective change - format only 2016-11-17 19:06:26 +13:00
Rob Bygrave 709d4151f2 no effective change - format only 2016-11-17 17:21:25 +13:00
Rob Bygrave d8e3f127c0 no effective change - reduce access to AbstractBeanCollection 2016-11-17 17:20:27 +13:00
Rob Bygrave f4e422a239 no effective change - formatting only 2016-11-17 17:15:49 +13:00
Rob Bygrave 442f24124c #879 - Ebean not fetching complete list of attribute beans when equals(Object o) is implemented 2016-11-17 17:15:14 +13:00
Rob Bygrave 259814f4d9 #849 - AbstractNamingConvention.getTableName inheritance logic differs from InheritInfo 2016-11-16 21:57:38 +13:00
Rob BygraveandGitHub 41a860ebb9 Merge pull request #874 from FOCONIS/feature/inheritance
Feature/inheritance
2016-11-16 21:14:41 +13:00
Rob Bygrave 2584fe9b7b [maven-release-plugin] prepare for next development iteration 2016-11-16 00:24:54 +13:00
Rob Bygrave f815415eb0 [maven-release-plugin] prepare release ebean-9.1.2 2016-11-16 00:24:44 +13:00
Rob Bygrave cf81d1699b Modify scm in pom 2016-11-16 00:23:54 +13:00
Roland Praml 0f3f79ab2c ADD @OrderBy to fix Postgres-tests 2016-11-15 12:03:25 +01:00
Rob Bygrave de9576835c #872 - test models for DDL check constraint issue (not reproduced) 2016-11-15 23:27:08 +13:00
Roland Praml 7e7951df09 ADD @OrderBy to fix Postgres-tests 2016-11-15 11:15:54 +01:00
Rob Bygrave 632cf10096 #878 - @AttributeOverride (not wrapped in @AttributeOverrides) is not applied 2016-11-15 22:48:36 +13:00
Rob Bygrave d2b6d06da5 Merge branch 'master' of github.com:ebean-orm/ebean 2016-11-15 22:13:09 +13:00
Rob Bygrave b41f3e9d1f #877 - DBMigration Generates wrong ddl for UUID type 2016-11-15 22:12:54 +13:00
Rob BygraveandGitHub 8357d9c7e7 Merge pull request #876 from ksperling/batching-exception-safety
Batching exception safety: Fix test
2016-11-14 15:28:36 +13:00
Karsten Sperling 97f1834c4d Batching exception safety: Update test to reflect real world scenario more closely (and actually fail before the change) 2016-11-14 12:48:58 +13:00
Rob Bygrave 01f551a951 #875 - Changes to support ElasticSearch 5.x 2016-11-12 01:05:13 +13:00
Rob Bygrave 482d454fc3 #875 - Changes to support ElasticSearch 5.x 2016-11-11 23:43:13 +13:00
Roland Praml 7341f742de ADD missing join in test 2016-11-11 10:08:08 +01:00
Roland Praml ffb2d6a10c Merge remote-tracking branch 'ebean/master' into feature/inheritance 2016-11-11 09:57:50 +01:00
Roland Praml 56c96923c4 extended the test cases 2016-11-11 09:57:13 +01:00
Roland Praml e4e850717d FIX: @Formula: support for discriminator & joins added 2016-11-11 09:57:02 +01:00
Rob Bygrave 2953418683 No effective change - add .editorconfig 2016-11-11 17:14:12 +13:00
Rob Bygrave 5c142a61f6 No effective change - add javadoc 2016-11-11 17:11:15 +13:00
Rob BygraveandGitHub 74626184b2 Merge pull request #873 from ksperling/batching-exception-safety
Batching exception safety
2016-11-11 17:06:29 +13:00
Roland Praml 019fdd3a12 fix test 2016-11-09 16:31:26 +01:00
Roland Praml 119edbdb9d FIX: Missing comma in bindlog 2016-11-09 16:16:53 +01:00
Roland Praml e8237cc04f ENH: Support for @Formula in combination with @ManyToOne 2016-11-09 16:15:59 +01:00
Roland Praml 95ee163d8b extended test cases 2016-11-09 15:56:55 +01:00
Roland Praml 9a22f9735a no ebean code change: extended test case to use a bean in @Formula and return ID 2016-11-09 10:26:37 +01:00
Roland Praml 29dbd5ac5d No effective code change - add unit test to demonstrate inheritance use case 2016-11-09 10:11:00 +01:00
Karsten Sperling 8661e1fd3f Reset batch on rollback 2016-11-09 10:58:57 +13:00
Karsten Sperling 9569b1b0d5 Added test for exception safety when using batchOnCascade 2016-11-09 10:58:57 +13:00
Rob BygraveandGitHub 3eb9bc1d16 Merge pull request #870 from 0xbaadf00d/feature/use-foreach
Replace "for" with "foreach"
2016-11-08 23:42:12 +13:00
Thibault Meyer ec6a8f5ea2 Replace "for" with "foreach" 2016-11-08 09:06:13 +01:00
Rob Bygrave d6ba567763 [maven-release-plugin] prepare for next development iteration 2016-11-08 00:32:47 +13:00
Rob Bygrave 6826fe1015 [maven-release-plugin] prepare release ebean-9.1.1 2016-11-08 00:32:38 +13:00
Rob Bygrave e67860cbe3 Merge branch 'master' of https://github.com/ebean-orm/ebean 2016-11-08 00:27:40 +13:00
Rob Bygrave b41238ddbb No effective change - modify TestHistoryInsert for more wait time and logging (PG test failing sometimes in CI) 2016-11-08 00:25:13 +13:00
Rob BygraveandGitHub c0b1c3d3ee Merge pull request #868 from 0xbaadf00d/feature/array-copy-performance
Use "Collection.addAll(...)" rather than manually copying arrays
2016-11-08 00:16:33 +13:00
Rob Bygrave ae69fcb80a #862 - ENH: Change ServerConfig such that if H2 ... no using createOnly = true in case the test EbeanServer instance is created for each test (and hence we need to drop if the same in memory db is used) 2016-11-08 00:10:15 +13:00
Rob Bygrave 6c4c33f1f3 No effective change - reduce logging in test (for CI) 2016-11-08 00:03:15 +13:00
Rob Bygrave 2986290947 Refactor - change use of 31 prime in various hash to 92821 2016-11-07 23:57:51 +13:00
Rob Bygrave 376cb9ebcb #869 - Clash on bind hash value for query cache with consecutive values of "01","20" and "02", "10" 2016-11-07 23:47:29 +13:00
Rob Bygrave 5cf5629232 #869 - Test for ... Clash on bind hash value for query cache with consecutive values of "01","20" and "02", "10" 2016-11-07 23:46:28 +13:00
Thibault Meyer 98aa5e9da9 Use "Collection.addAll(...)" rather than manually copying arrays 2016-11-07 11:07:37 +01:00
Rob BygraveandGitHub ed1df5bcbb Merge pull request #864 from 0xbaadf00d/feature/redundant-local-var
Remove redundant local variables
2016-11-07 22:14:59 +13:00
Thibault Meyer 6704ccc6a7 Merge branch 'master' into feature/redundant-local-var 2016-11-07 10:11:03 +01:00
Thibault Meyer 5f35e3c944 Remove redundant local variables 2016-11-07 10:03:50 +01:00
Rob Bygrave 0893972115 Fix for running CI tests as Postgres (where we need to explicitly turn on DDL generation and running for the tests). 2016-11-07 22:00:33 +13:00
Rob Bygrave 7a8d1b85a9 #866 - Fix RawSql mapping such that it automatically maps foreign key columns 2016-11-07 21:57:03 +13:00
Rob Bygrave 686593e9e8 No effective change - tidy up test Order entity bean 2016-11-07 21:36:19 +13:00
Rob Bygrave d05b593432 #862 - ENH: Change ServerConfig such that if H2 is the DataSource/DatabasePlatform then automatically it sets up for testing (ddl generation) 2016-11-07 19:50:05 +13:00
Rob Bygrave b581c893ec No effective change - tidy up test conversation User entity bean 2016-11-07 19:47:34 +13:00
Rob Bygrave 63f852475d #863 - @Enumerated(EnumType.STRING) DayOfWeek day; ... incorrectly maps to SQL Integer type 2016-11-07 17:15:47 +13:00
Rob BygraveandGitHub 51364763fb Merge pull request #860 from 0xbaadf00d/feature/replace-anonymous-classes
Replace anonymous classes with lambda expressions
2016-11-07 13:02:33 +13:00
Rob BygraveandGitHub ea408fd4c7 Merge pull request #861 from 0xbaadf00d/feature/coding-style
Remove redundant "public" modifier for interface methods
2016-11-07 12:58:23 +13:00
Thibault Meyer 8dc521ca8b Remove redundant "public" modifier for interface methods 2016-11-06 11:48:59 +01:00
Thibault Meyer 6680e2ea75 Replace anonymous classes with lambda expressions 2016-11-06 11:17:53 +01:00
Rob BygraveandGitHub da30df3b2b Merge pull request #858 from 0xbaadf00d/feature/deprecated-api-usage
Deprecated API usage - Modify ScalarTypeJodaLocalTime to use toDateTimeToday().getMillis()
2016-11-06 22:59:32 +13:00
Rob BygraveandGitHub d12ea89388 Merge pull request #854 from 0xbaadf00d/feature/explicit-type-to-diamond
Replace explicit type with <>
2016-11-06 22:54:24 +13:00
Thibault Meyer e0931e41e5 Remove deprecated API usage 2016-11-06 10:50:31 +01:00
Rob BygraveandGitHub c98d258127 Merge pull request #857 from 0xbaadf00d/feature/boxing-unboxing
Remove unnecessary boxing and unboxing
2016-11-06 22:43:33 +13:00
Rob BygraveandGitHub a4922a5b1d Merge pull request #856 from 0xbaadf00d/feature/identical-catch
Change identical 'catch' statements
2016-11-06 22:42:13 +13:00
Rob BygraveandGitHub edb2a69f6e Merge pull request #853 from 0xbaadf00d/fix/javadoc-error
Javadoc error
2016-11-06 22:40:52 +13:00
Thibault Meyer b94f852b67 Remove unnecessary boxing and unboxing 2016-11-06 10:29:42 +01:00
Thibault Meyer a8778ef14c Change identical 'catch' statements 2016-11-06 10:26:13 +01:00
Rob Bygrave cbfce0d14d #855 - Fix @Aggregation lazy loading and base select issue 2016-11-06 22:18:23 +13:00
Thibault Meyer abb25d397a Fix comments 2016-11-06 10:03:33 +01:00
Thibault Meyer 969a3c8b8d Replace explicit type with <> 2016-11-06 10:00:12 +01:00
Rob Bygrave 2a6d38eef2 #852 - javax.persistence.PersistenceException: No ScalarType registered for class Foo$1 ... where Foo is an Enum where individual instances override a method (example below). 2016-11-06 20:33:56 +13:00
Rob Bygrave d84080fb76 Refactor - clean up DefaultTypeManager, diamond operator and access modifiers only 2016-11-06 19:45:46 +13:00
Rob Bygrave 54d7a6fb42 Refactor - clean up docstore api mapping, diamond operator only 2016-11-05 23:04:33 +13:00
Rob Bygrave e5356e7118 Refactor - tidy up in com.avaje.ebeaninternal util, no effective change 2016-11-05 23:01:03 +13:00
Rob Bygrave e83556cada Refactor - clean up OrmQueryDetailParser, remove unused sections 2016-11-05 22:51:51 +13:00
Rob Bygrave 201a2826ab Refactor - tidy up in com.avaje.ebeaninternal.server.querydefn, no effective change 2016-11-05 22:46:43 +13:00
Rob Bygrave 670bac52f8 Refactor - tidy up in com.avaje.ebeaninternal.server.query, no effective change 2016-11-05 22:32:36 +13:00
Rob Bygrave 77e3346d9e Refactor - clean up CQueryPlan, CQueryPlanStats 2016-11-05 15:11:17 +13:00
Rob Bygrave 4663162f95 Refactor - no effective chang - Add SpiQuery getOriginKey() 2016-11-05 14:48:03 +13:00
Rob BygraveandGitHub 83a3ef43bd Merge pull request #851 from FOCONIS/fix/javawarnings
FIX some java warnings / rawtypes
2016-11-05 09:23:07 +13:00
Roland Praml 3701b314a0 FIX some java warnings / rawtypes 2016-11-04 12:19:38 +01:00
Roland Praml 4fa9f739d4 Merge remote-tracking branch 'ebean/master' into feature/platform-dependent-annotations
# Conflicts:
#	pom.xml
2016-11-04 09:42:37 +01:00
Rob Bygrave fad8358a9d Bump to java8-parent, update to Java8 LongAdder 2016-11-04 20:04:25 +13:00
Rob Bygrave 78c4dbb44d [maven-release-plugin] prepare for next development iteration 2016-11-04 19:19:11 +13:00
Rob Bygrave 9c74520a4b [maven-release-plugin] prepare release ebean-8.8.1 2016-11-04 19:19:02 +13:00
Rob Bygrave c911c710d5 Bump pom to 8.8.1-SNAPSHOT 2016-11-04 01:17:08 +13:00
Rob Bygrave f08dd01035 #836 - ENH: Add support for @DbArray even for H2 db 2016-11-04 01:16:32 +13:00
Rob Bygrave a1b4af2716 Refactor - no effective change - remove un-required callback from PersistExecute to PersistRequestBean 2016-11-03 23:42:43 +13:00
Rob Bygrave 8c500c5836 #846 - Add soft delete related callbacks 2016-11-03 23:27:39 +13:00
Rob Bygrave c1d6cc7b75 Refactor - no real change - tighter access on SqlTreeNodeBean 2016-11-03 23:18:14 +13:00
Rob Bygrave d6fe16ffda Change permissions on travis scripts 2016-11-03 23:14:14 +13:00
Rob Bygrave d0230491e5 #99 - ENH (419) : Simplify aggregation queries - part 2 2016-11-03 23:06:54 +13:00
Roland Praml ba0509dadc Merge remote-tracking branch 'ebean/master' into feature/platform-dependent-annotations 2016-11-02 14:22:24 +01:00
Rob Bygrave 3526f71f0a #99 - ENH (419) : Simplify aggregation queries 2016-11-02 22:10:22 +13:00
Roland Praml 64c67e3755 removed debug code and completed documentation 2016-11-01 00:43:17 +01:00
Roland Praml 6142dd34f4 No effective code change - removed unused imports 2016-11-01 00:27:12 +01:00
Roland Praml 06e265ec47 Provide test case 2016-11-01 00:02:44 +01:00
Roland Praml 7b19973836 Better support for repeatable annotations (needs Java 8) 2016-10-31 23:36:43 +01:00
Rob Bygrave 18f943ab2b [maven-release-plugin] prepare for next development iteration 2016-10-31 21:59:39 +13:00
Rob Bygrave 03ff53c7af [maven-release-plugin] prepare release ebean-8.7.1 2016-10-31 21:59:30 +13:00
Rob Bygrave c20d111ea2 Bump version to 8.7.1-SNAPSHOT 2016-10-31 21:58:43 +13:00
Rob Bygrave 920fa73d11 #837 - ENH: Support using @HistoryExclude on normal properties (other than @ManyToMany) 2016-10-31 21:57:16 +13:00
Rob Bygrave cd62686337 #845 - Fix EQL parsing to support the 'inverse' form - e.g. where 'Rob' eq firstName (where the path is on the RHS rather than LHS) 2016-10-31 21:32:29 +13:00
Rob Bygrave e9ad459fa5 #843 - Change ServerConfig name to default to "db" (prior default was null) and defaultServer to true 2016-10-31 20:40:26 +13:00
Rob Bygrave ea5e9fa75a #842 - For @DbJson map the type Map<String, ?> (using the wildcard) ... the same as Map<String, Object> 2016-10-31 20:15:23 +13:00
Rob BygraveandGitHub d44460e180 Merge pull request #841 from FOCONIS/bugfix/softdelete-calls-wrong-lifecycle-method
Bugfix/softdelete calls wrong lifecycle method
2016-10-27 10:17:29 +13:00
Roland Praml 0e5ebf3fea FIX: softDeleting an entity calls now preUpdate/postUpdate 2016-10-26 15:47:54 +02:00
Roland Praml 42d35f8ec6 FIX: removed trailing commas in logs 2016-10-26 15:45:10 +02:00
Rob Bygrave 7f52e466e0 [maven-release-plugin] prepare for next development iteration 2016-10-25 22:23:13 +13:00
Rob Bygrave 861a8a4ee5 [maven-release-plugin] prepare release ebean-8.6.1 2016-10-25 22:23:04 +13:00
Rob Bygrave abe2f76d5c Bump pom to 8.6.1-SNAPSHOT 2016-10-25 22:22:16 +13:00
Rob Bygrave d0f75a940c #239 - Support Geometric types of Postgres, Also adding LineString, MultiLineString and MultiPoint 2016-10-25 22:19:33 +13:00
Rob Bygrave 44ad78b5e0 #239 - Support Geometric types of Postgres 2016-10-21 02:45:06 +13:00
Rob Bygrave 967b4de784 #239 - Support Geometric types of Postgres 2016-10-21 02:42:25 +13:00
Rob Bygrave ea45201905 [maven-release-plugin] prepare for next development iteration 2016-10-17 20:58:19 +13:00
Rob Bygrave 938f4ec9c2 [maven-release-plugin] prepare release ebean-8.5.1 2016-10-17 20:58:10 +13:00
Rob Bygrave 99bd2972d0 Bump pom version to 8.5.1-SNAPSHOT 2016-10-17 20:57:26 +13:00
Rob Bygrave deac291951 #835 - A query that includes a fetch() of a many that is @SoftDelete where all the rows are soft deleted returns incorrect results 2016-10-17 20:52:18 +13:00
Rob Bygrave 3161e24677 #835 - Tests for - A query that includes a fetch() of a many that is @SoftDelete where all the rows are soft deleted returns incorrect results 2016-10-17 20:51:22 +13:00
Rob Bygrave 37804bd083 Modify tests to avoid MySql keyword (mod) for column names 2016-10-17 20:50:48 +13:00
Rob Bygrave 0a2a987695 Modify tests to avoid Oracle keywords for column names 2016-10-15 17:03:32 +13:00
Rob Bygrave 4a085cb819 #834 - Oracle DDL for drop index and drop constraints incorrectly includes "if exits" 2016-10-15 17:02:44 +13:00
Rob Bygrave 67469ef4d3 No effective change - change Line endings to CR (from CRLF) 2016-10-15 14:39:20 +13:00
Rob Bygrave c3f43d503f #832 - Refactor: Change generated SQL to use "left join" rather than "left outer join" - change tests 2016-10-15 14:37:36 +13:00
Rob Bygrave 9158f46bb3 #832 - Refactor: Change generated SQL to use "left join" rather than "left outer join" 2016-10-15 14:36:11 +13:00
Rob Bygrave b3bfa88eb5 [maven-release-plugin] prepare for next development iteration 2016-10-15 01:14:29 +13:00
Rob Bygrave 185dec9c02 [maven-release-plugin] prepare release ebean-8.4.2 2016-10-15 01:14:18 +13:00
Rob Bygrave 20634233ca Update tests only - handle MySql specifics (boolean literal, lack of order by nulls last) 2016-10-15 00:55:09 +13:00
Rob Bygrave 7c9dda586e No effective change - format only 2016-10-14 23:49:00 +13:00
Rob BygraveandGitHub 3ca0f7b776 Merge pull request #828 from FOCONIS/feature/postconstruct
Feature/postconstruct
2016-10-14 23:44:45 +13:00
Rob Bygrave 85caca48de No effective change - add tests for naming convention on m2m columns 2016-10-14 23:29:50 +13:00
Rob Bygrave ff85a51994 No effective change - format only 2016-10-14 23:29:27 +13:00
Rob BygraveandGitHub 6dc3038d0d Merge pull request #830 from lvffilho/master
Add NamingConvention support to ManyToMany columns
2016-10-14 23:27:32 +13:00
Rob BygraveandGitHub c0fcb77f3d Merge pull request #829 from kdazzle/patch-1
Remove outdated findPageList(int, int) javadocs
2016-10-14 23:17:42 +13:00
Rob Bygrave da5d5296b6 #831 - EQL query language parser needs to throw exception on invalid query ... "find ..." - remove unhelpful tests 2016-10-14 21:09:23 +13:00
Rob Bygrave f04ab28c3f #831 - EQL query language parser needs to throw exception on invalid query ... "find ..." 2016-10-14 21:08:23 +13:00
Rob Bygrave d6cd41f8d2 #831 - EQL query language parser needs to throw exception on invalid query ... "find ..." - tests 2016-10-14 21:07:31 +13:00
Rob Bygrave 504a209a78 Merge branch 'master' of https://github.com/ebean-orm/ebean 2016-10-14 20:24:13 +13:00
Rob Bygrave 9f98b5333d Update tests - for asserts trim column alias from generated SQL if necessary (to support generating without column alias) 2016-10-14 20:23:36 +13:00
Eddie Mc Greal 2a600adbcf Added tests for EQL - syntactically incorrect und named parameter on LHS of comparison operator 2016-10-12 19:42:31 +02:00
Luiz Filho 9ce6007330 Add NamingConvention support to ManyToMany columns 2016-10-07 16:46:40 -03:00
Kyle ValadeandGitHub 7780dd6272 Remove outdated findPageList(int, int) javadocs
The class no longer supports that type of call
2016-10-07 12:26:06 -04:00
Roland Praml b01ddea781 FIX: fixed non-deterministic failing TestHistoryInsert testcase 2016-10-05 21:51:42 +02:00
Roland Praml b848587cd3 ADD: Testcases for PostConstruct 2016-10-05 21:51:04 +02:00
Roland Praml fe7e929a99 Refactor: Removed duplicate code from BootupClasses - use generics. 2016-10-05 21:50:22 +02:00
Roland Praml 3ee0b0224e ENH: Support for javax.annotation.PostConstruct. BeanPostConstructListener will be informed when an entity-bean is constructed/created to perform dependency-injection (e.g. Spring-Autowire) 2016-10-05 21:48:11 +02:00
Roland Praml 169eba4296 No effective code change - fixed commets 2016-10-05 21:39:44 +02:00
Robin Bygrave 91d3279061 [maven-release-plugin] prepare for next development iteration 2016-10-03 23:40:32 +13:00
Robin Bygrave b4b7c631da [maven-release-plugin] prepare release ebean-8.4.1 2016-10-03 23:40:22 +13:00
Robin Bygrave 4f98ca5d91 #821 - CQueryIteratorSimple not working with consecutive calls to hasNext() - ie. without matching calls to next() 2016-10-03 23:36:03 +13:00
Robin Bygrave 014a9aef6f #826 - Remove deprecated methods - migrate findRowCount() to findCount() & findFutureRowCount() to findFutureCount() 2016-10-03 22:31:33 +13:00
Robin Bygrave f21c33df7b Bump pom to 8.4.1-SNAPSHOT 2016-10-03 22:16:52 +13:00
Robin Bygrave f1eb494e0d #824 - Refactor com.avaje.ebean.config.dbplatform DbType & DbPlatformType - handle logical and plaform ddl conversion 2016-10-03 22:04:37 +13:00
Robin Bygrave d26203db1f #824 - Refactor com.avaje.ebean.config.dbplatform DbType & DbPlatformType - support custom DbType mapping options 2016-10-03 20:52:53 +13:00
Robin Bygrave abfe58fb06 #824 - Refactor com.avaje.ebean.config.dbplatform DbType & DbPlatformType - no effective change, tidy. 2016-09-23 00:27:39 +12:00
Robin Bygrave d0ad5f6c48 #824 - Refactor com.avaje.ebean.config.dbplatform DbType & DbPlatformType 2016-09-23 00:17:51 +12:00
Robin Bygrave bc4a246f33 [maven-release-plugin] prepare for next development iteration 2016-09-22 22:25:14 +12:00
Robin Bygrave 61f590944b [maven-release-plugin] prepare release ebean-8.3.1 2016-09-22 22:25:05 +12:00
Robin Bygrave 223e53416d Bump pom version to 8.3.1-SNAPSHOT 2016-09-22 22:24:17 +12:00
Robin Bygrave a3143b1cf6 #822 - EbeanServer.getBeanId(entity) does not trigger jdbc batch flush - when bean inserted with jdbc batch mode 2016-09-22 21:25:22 +12:00
Robin Bygrave bd3e7c8035 #823 - Remove deprecated API from PagedList 2016-09-22 21:02:28 +12:00
Robin Bygrave b753ce3a73 #820 - #718 Removed PagedList.getPageIndex() - Can it be added back? 2016-09-22 20:57:17 +12:00
Robin Bygrave a0f2ebe448 [maven-release-plugin] prepare for next development iteration 2016-09-01 21:08:23 +12:00
Robin Bygrave 7e7810602e [maven-release-plugin] prepare release ebean-8.2.3 2016-09-01 21:08:09 +12:00
Robin Bygrave d218fff374 #819 - Fix for bug in @ManyToOne relations with enabled soft-deletes 2016-08-31 23:03:00 +12:00
Rob BygraveandGitHub a0e927d353 Merge pull request #819 from FOCONIS/test-softdelete
ADD: testcase for bug in @ManyToOne relations with enabled soft-deletes
2016-08-31 22:05:46 +12:00
Robin Bygrave 51a58d4993 No effective change - remove whitespace in test 2016-08-31 20:57:24 +12:00
Roland Praml b9f0ee7ac0 ADD: testcase for https://groups.google.com/forum/#!topic/ebean/WKbGmROoIRA 2016-08-31 09:48:11 +02:00
Roland Praml 4f3b461f8e FIX: TestHistoryInsert / TestNewTypes failing nondeterministic 2016-08-30 09:14:22 +02:00
Roland Praml adfe5f0305 FIX: Bean did not get dirty when modified with ExpressionPath.pathSet 2016-08-30 09:13:44 +02:00
Robin Bygrave 1796c8b9bc #817 - SqlRow getBoolean() does not treat numeric 1 value as true (with MySql and other DB's without native boolean type) - Fix test for PG 2016-08-29 21:50:14 +12:00
Robin Bygrave 4bad4358f0 Merge branch 'master' of https://github.com/ebean-orm/ebean 2016-08-29 21:06:55 +12:00
Robin Bygrave 92665ebc3b Refactor - tidy of DefaultSqlRow - no logical change 2016-08-29 21:06:31 +12:00
Robin Bygrave 59670d0303 #817 - SqlRow getBoolean() does not treat numeric 1 value as true (with MySql and other DB's without native boolean type) 2016-08-29 20:54:49 +12:00
Robin Bygrave 244275fd72 #816 - Error saving circular relationships (when generated Id values) 2016-08-25 22:44:22 +12:00
Robin Bygrave d1e2176a5a [maven-release-plugin] prepare for next development iteration 2016-08-24 22:53:15 +12:00
Robin Bygrave 43968e70b8 [maven-release-plugin] prepare release ebean-8.2.2 2016-08-24 22:53:02 +12:00
Robin Bygrave 0aa3bd3c97 Update README 2016-08-24 22:52:02 +12:00
Robin Bygrave 2d85a9a20c Update README 2016-08-24 22:45:14 +12:00
Robin Bygrave 157dfcfeb6 #815 - ENH: When loading ebean-autotune.xml also look in resources (if not found as file) 2016-08-24 22:19:46 +12:00
Robin Bygrave 2b7c204072 No effective change - adjust tests for deleting OneToOne - Tire to Wheel 2016-08-24 21:32:10 +12:00
Robin Bygrave be731feb6b No effective change - adjust tests for H2 error vs Postgres truncate with oversized varchar input 2016-08-23 20:01:11 +12:00
Robin Bygrave da15d0b2c6 No effective change - format javadoc 2016-08-23 20:00:07 +12:00
Rob BygraveandGitHub 9c5fd496c1 Merge pull request #814 from FOCONIS/master
ENHANCEMENT: multiple indices & meta-annotation support similar to spring-framework
2016-08-23 19:43:04 +12:00
Roland Praml 5075ea32b4 Merge branch 'master' of github.com:FOCONIS/avaje-ebeanorm 2016-08-23 09:27:28 +02:00
Roland Praml f5c8d8896f Used @Repeatable feature from JDK8 for @Indices 2016-08-23 09:27:12 +02:00
Roland Praml 32fdff9f11 Used @Repeatable feature from JDK8 for @Indices 2016-08-22 10:00:13 +02:00
Roland Praml 87f6964995 Ignored tests that make problems with Postgres 2016-08-22 09:34:45 +02:00
Roland Praml b45226dd41 Merge remote-tracking branch 'ebean/master' 2016-08-16 11:06:47 +02:00
Roland Praml 992c40d362 no effective code change - fix indentions 2016-08-16 11:06:01 +02:00
Rob BygraveandGitHub 9144d60948 Merge pull request #813 from zhangshifeng/fix-artifactId
Update README.md and pom.xml for artifactId change
2016-08-13 11:23:04 +12:00
zhangshifeng 6396143d49 Update README.md and pom.xml for artifactId change 2016-08-12 17:20:29 +08:00
Robin Bygrave ce045ca0fe No effective change - remove unused methods (from ImportedId) 2016-08-11 20:22:35 +12:00
Robin Bygrave d722d34072 [maven-release-plugin] prepare for next development iteration 2016-08-05 13:53:23 +12:00
Robin Bygrave 2cc4c2c265 [maven-release-plugin] prepare release ebean-8.2.1 2016-08-05 13:53:03 +12:00
Robin Bygrave 0a830841c4 Bump pom to 8.2.1-SNAPSHOT 2016-08-05 13:52:09 +12:00
Robin Bygrave c427009b93 #812 - Remove deprecated includeSoftDeletes() ... migrate to setIncludeSoftDeletes() 2016-08-05 13:47:32 +12:00
Robin Bygrave 7f42d045ac No effective change - javadoc typo 2016-08-05 13:29:28 +12:00
Robin Bygrave 43afaf1344 #811 - ENH: Restore findIterate() as alternative to findEach / findEachWhile 2016-08-05 13:01:42 +12:00
Robin Bygrave 6c182ecaa5 #810 - ENH: Add transaction.isRollbackOnly() 2016-08-05 12:14:58 +12:00
Robin Bygrave fdb839f90e #809 - Add test / example showing ... transaction.setPersistCascade(false) and transaction.commitAndContinue(); 2016-08-05 11:20:12 +12:00
Robin Bygrave 16be213faf #808 - ENH: Add Transaction commitAndContinue() ... 2016-08-05 10:39:17 +12:00
Robin Bygrave 3344f0ddb0 Refactor - remove unused method JdbcTransaction.notifyQueryOnly(). 2016-08-04 23:25:50 +12:00
Robin Bygrave 479ac38537 #807 - Deprecate TransactionEventListener ... migrate to TransactionCallback 2016-08-04 23:17:57 +12:00
Robin Bygrave e30ad80f5f #806 - Deprecate OnQueryOnly.CLOSE ... 2016-08-04 23:02:26 +12:00
Robin Bygrave 08e46d6bf3 #805 - ENH: Add BeanState.resetForInsert() ... This resets bean state such that a save() results in an insert 2016-08-04 22:49:07 +12:00
Robin Bygrave 876476fdc1 #804 - Remove API - findMap(property, type) ... migrate to query.setMapKey() 2016-08-04 20:30:18 +12:00
Robin Bygrave 81de83a6e7 #803 - Fix generics on findMap() to ... <K> Map<K, T> findMap(); 2016-08-04 20:23:11 +12:00
Robin Bygrave b5b221ffb1 No effective change - remove unused constructors 2016-08-04 17:32:18 +12:00
Robin Bygrave 3c6eab6c85 #802 - Find generics on findIds() - refactor internals of find ids to use find single attribute 2016-08-04 17:28:41 +12:00
Robin Bygrave 1be30f1671 #125 - ENH: Add support for query returning a List of single Attribute type 2016-08-04 16:41:50 +12:00
Robin Bygrave 9a5cb242ce No effective change - remove commented out line from pom 2016-08-04 13:56:09 +12:00
Robin Bygrave ea69cae4a3 [maven-release-plugin] prepare for next development iteration 2016-08-03 16:24:43 +12:00
Robin Bygrave 629fb7a433 [maven-release-plugin] prepare release ebean-8.1.1 2016-08-03 16:24:23 +12:00
Robin Bygrave 4ff10da739 #801 - Change maven groupId ... to org.avaje.ebean, artifactId to ebean 2016-08-03 16:23:26 +12:00
Robin Bygrave 9472592a50 [maven-release-plugin] prepare for next development iteration 2016-08-03 00:40:37 +12:00
Robin Bygrave f42682ca90 [maven-release-plugin] prepare release avaje-ebeanorm-8.1.1 2016-08-03 00:40:18 +12:00
Robin Bygrave 5dc296e644 #798 - Add @Transactional based test 2016-08-03 00:38:58 +12:00
Robin Bygrave 380660913f No effective change - javadoc update on Query 2016-08-02 23:42:00 +12:00
Robin Bygrave d08ac6973e #800 - ENH: Add query.fetchQuery() and query.fetchLazy() ... as nicer alternatives to FetchConfig use 2016-08-02 23:33:02 +12:00
Robin Bygrave 9d23c1d56e #800 - ENH: Add query.fetchQuery() and query.fetchLazy() ... as nicer alternatives to FetchConfig use 2016-08-02 23:30:26 +12:00
Robin Bygrave b5d6c5f70b #800 - ENH: Add query.fetchQuery() and query.fetchLazy() ... as nicer alternatives to FetchConfig use 2016-08-02 23:30:04 +12:00
Robin Bygrave 3657d05774 #798 - ENH: Add support for transparent full JDBC batch. Via enhancement agent 8.1.1 ... 2016-08-02 21:41:13 +12:00
Robin Bygrave 2de8ae777d Merge branch 'wip/getterCallback' 2016-08-02 21:34:41 +12:00
Robin Bygrave 16950a5641 [maven-release-plugin] prepare for next development iteration 2016-08-02 21:32:08 +12:00
Robin Bygrave ad992d07ce [maven-release-plugin] prepare release avaje-ebeanorm-7.21.2 2016-08-02 21:31:47 +12:00
Robin Bygrave cbcec8f5ea No effective change - tidy 2016-08-02 20:32:59 +12:00
Robin Bygrave 6e2148d20b #799 - Query.fetch(path) when converted to query join default to batchSize 10 rather than 100 2016-08-02 20:19:38 +12:00
Robin Bygrave ca1c0a08f3 No effective change - remove whitespace on DLoadBeanContext 2016-08-02 20:14:46 +12:00
Robin Bygrave baa6fc355e No effective change - javadoc update on FetchConfig 2016-08-02 20:14:07 +12:00
Robin Bygrave dacdc26902 #798 - ENH: Add support for transparent full JDBC batch. Via enhancement agent 8.1.1 intercept bean getter to automatically flush the JDBC batch buffer. 2016-08-02 16:16:34 +12:00
Robin Bygrave 48edf64013 No effective change - typo in javadoc 2016-08-02 11:10:19 +12:00
Robin Bygrave e2ee6e8e98 No effective change - update tests with EBasicVer new constructor 2016-08-02 11:06:09 +12:00
Robin Bygrave e6e6a28245 No effective change - tidy asserts on TestQueryDistinct (AssertJ string contains etc) 2016-08-01 22:53:47 +12:00
Rob BygraveandGitHub 82a695a98a Merge pull request #797 from backslash47/master
Add check for distinct query when adding id attribute to order clause in paging query
2016-08-01 22:47:34 +12:00
Matus Zamborsky cdad31bd8a Added test for distinct paging query 2016-08-01 12:20:50 +02:00
Matus Zamborsky 4d16cf9caa Add check for distinct query when adding id attribute to order clause in paging query 2016-08-01 10:13:05 +02:00
Robin Bygrave 84a86cad0e #794 - Refactor - tidy code, remove unused mimetypes properties 2016-07-31 23:34:55 +12:00
Robin Bygrave dfdf87fa2d #794 - Refactor - tidy code, javadoc tidy 2016-07-31 23:33:29 +12:00
Robin Bygrave ee0615caec #794 - Refactor - tidy code, use uppercase L for Long literal 2016-07-31 23:33:07 +12:00
Robin Bygrave 79b8395f8f #794 - Refactor - tidy code, simplify if 2016-07-31 23:32:37 +12:00
Robin Bygrave 87c479cd95 #794 - Refactor - tidy code, remove unused imports 2016-07-31 23:24:30 +12:00
Robin Bygrave abbdda810a #794 - Refactor - tidy code, remove unused method arguments 2016-07-31 23:23:57 +12:00
Robin Bygrave e621900de9 #794 - Refactor - tidy code, remove unused method arguments 2016-07-31 23:23:43 +12:00
Robin Bygrave 76b33511e1 #793 - com.avaje.ebean.event.changelog.BeanChange not keeping passed id value 2016-07-31 23:14:08 +12:00
Robin Bygrave 77deab5cf0 #792 - Change Logging Rollback message on org.avaje.ebean.TXN from INFO level to DEBUG level 2016-07-31 22:52:48 +12:00
Robin Bygrave 4a9f8cef0e No effective change - rename SpiQuery method for m2mIncludeJoin and simplify OrmQueryPlanKey to associated intersection table name 2016-07-31 22:49:10 +12:00
Robin Bygrave 4d1340c16c No effective change - rename SpiQuery method for m2mIncludeJoin and simplify OrmQueryPlanKey to associated intersection table name 2016-07-31 22:46:07 +12:00
Robin Bygrave 74c6c71301 [maven-release-plugin] prepare for next development iteration 2016-07-31 21:28:17 +12:00
Robin Bygrave 0f0028eb1f [maven-release-plugin] prepare release avaje-ebeanorm-7.21.1 2016-07-31 21:27:58 +12:00
Robin Bygrave b4a1d52067 #791 - ENH: Add transaction.setRollbackOnly() ... (and Ebean.setRollbackOnly()) 2016-07-31 21:24:31 +12:00
Robin Bygrave d82148248c No effective change - javadoc tidy 2016-07-31 20:55:34 +12:00
Robin Bygrave dc7c854432 #788 - Deprecate findRowCount() ... add findCount(). Effectively renaming findRowCount() to findCount() 2016-07-31 19:06:21 +12:00
Robin Bygrave 7c83010df1 #788 - Deprecate findRowCount() ... add findCount(). Effectively renaming findRowCount() to findCount() 2016-07-31 16:39:23 +12:00
Robin Bygrave ed41e58073 Bump pom version to 7.21.1-SNAPSHOT 2016-07-31 16:01:00 +12:00
Robin Bygrave 5bab9eb648 #790 - DB Migration with multiple platforms (and no maven H2 dependency) gives: java.lang.NoClassDefFoundError: org/h2/api/Trigger 2016-07-31 15:59:54 +12:00
Robin Bygrave 5ce8eb6046 No effective change - remove unused methods 2016-07-31 15:02:05 +12:00
Robin Bygrave 56fee2ea9b #789 - findCount() ... with where raw(...) expression that includes a "many" produces incorrect SQL 2016-07-31 14:57:12 +12:00
Roland Praml 84f32c2ace ENH: support for multiple indices added 2016-07-30 16:06:01 +02:00
Roland Praml 85288a0652 Added a testcase that checks if meta-annotations are recognized 2016-07-30 13:13:54 +02:00
Roland Praml 3183287833 ENH: meta-annotation support similar to spring.
See http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-meta-annotations for detailed explanation
2016-07-30 12:44:14 +02:00
Robin Bygrave 780ee7c7c0 [maven-release-plugin] prepare for next development iteration 2016-07-25 23:37:18 +12:00
Robin Bygrave 2bac7bf84d [maven-release-plugin] prepare release avaje-ebeanorm-7.20.1 2016-07-25 23:36:58 +12:00
Robin Bygrave 499862438d Bump pom to 7.20.1-SNAPSHOT 2016-07-25 23:36:12 +12:00
Robin Bygrave 4ad0b7cf66 #786 - Bump avaje-dbmigration to 1.2.1 ... which uses autoCommit true when running drop-all ddl 2016-07-25 23:34:17 +12:00
Robin Bygrave 6108ef484b #782 - History Many-To-Many Lazy-Loads fail 2016-07-25 23:31:02 +12:00
Robin Bygrave b763f4c875 #783 - HistoryExclude Many-to-Many Query-Generation Error 2016-07-25 23:29:33 +12:00
Robin Bygrave ca7285b2ad #783 - tests for ... HistoryExclude Many-to-Many Query-Generation Error 2016-07-25 23:28:45 +12:00
Robin Bygrave 75b639bc15 #782 - tests for ... History Many-To-Many Lazy-Loads fail 2016-07-25 23:22:33 +12:00
Robin Bygrave 1a7c4dac3f #1 - Change DdlGenerator.runScript() so that it uses connection.setAutoCommit(true) for drop ddl - when expectErrors is true 2016-07-25 23:03:00 +12:00
Robin Bygrave 6828fa1786 #784 - DDL DB Migration - Add @ManyToOne does not generate Foreign key and index ddl statements in migration script 2016-07-25 20:44:15 +12:00
Robin Bygrave ba7e729ae1 #785 - Bump avaje-classpath-scanner-api dependency to 2.2 for Windows fixes to classpath-scanner 2016-07-25 11:39:41 +12:00
Rob BygraveandGitHub c3fba72a24 Merge pull request #781 from FOCONIS/master
FIX: PathTests - on Windows
2016-07-25 11:14:23 +12:00
Robin Bygrave ff401cfc72 [maven-release-plugin] prepare for next development iteration 2016-07-20 00:03:20 +12:00
Robin Bygrave 7902276296 [maven-release-plugin] prepare release avaje-ebeanorm-7.19.1 2016-07-20 00:02:59 +12:00
Robin Bygrave 95f7a85aa1 Bump version to 7.19.1-SNAPSHOT 2016-07-20 00:02:08 +12:00
Roland Praml cf9eb4ed97 FIX: PathTests - they fail on windows machine, because the OS translates "/tmp" to "c:\tmp". bumped classpath-canner to current API version 2016-07-19 13:25:53 +02:00
Robin Bygrave b5cb04a6ed #780 - Remove ServerConfig registerJmxMBeans ... as it is no longer used 2016-07-18 09:22:22 +12:00
Robin Bygrave 5a9193f732 #779 - Refactor - Tidy internals of DefaultOrmQuery, remove unused String query property. 2016-07-15 23:51:27 +12:00
Robin Bygrave 55584f09d5 #778 - ENH: Add support for loading named queries from ebean.xml 2016-07-15 23:33:09 +12:00
Robin Bygrave 05eb0bfc55 #777 - ENH: Add support for @NamedQuery and @NamedQueries 2016-07-15 23:15:18 +12:00
Robin Bygrave cf13119b49 #776 - Remove ServerConfig.cacheWarmingDelay ... as it is no longer used 2016-07-15 20:51:22 +12:00
Robin Bygrave e0eff149b5 #775 - Change DefaultBackgroundExecutor to use JDK cached thread pool (rather than configure min/max size etc) 2016-07-15 20:48:41 +12:00
Robin Bygrave 474c2d5595 EQL - Add / expose via EbeanServer.createQuery(type, eql) method 2016-07-13 16:40:52 +12:00
Robin Bygrave e58cec8bdd EQL - parsing order by clause 2016-07-13 15:28:06 +12:00
Robin Bygrave 9dd82c0dd7 EQL - parsing limit offset clause 2016-07-13 14:30:12 +12:00
Robin Bygrave 49d3cc91e4 EQL - parsing select clause with distinct option 2016-07-13 14:07:59 +12:00
Robin Bygrave a8c2fc2ed5 EQL - parsing select clause 2016-07-13 13:55:56 +12:00
Robin Bygrave 45d7e3cafd EQL - parsing fetch clause with lazy/query option 2016-07-13 13:04:38 +12:00
Robin Bygrave be6754bd06 EQL - parsing fetch clause 2016-07-13 11:01:44 +12:00
Robin Bygrave 83c16ad1c6 EQL - parsing IN expressions with named parameters 2016-07-13 10:12:15 +12:00
Robin Bygrave 3f8b389999 EQL - parsing BETWEEN property expressions 2016-07-13 09:48:58 +12:00
Robin Bygrave b4b6a13e75 EQL - parsing BETWEEN expressions 2016-07-13 09:30:00 +12:00
Robin Bygrave 3fad4aae2f EQL - parsing IN expressions 2016-07-12 23:29:34 +12:00
Robin Bygrave ceab95e6c2 EQL - Simplify nested query where expressions after parsing 2016-07-12 22:51:02 +12:00
Robin Bygrave 84b37fb014 EQL Named parameter support for Like and ieq 2016-07-12 21:56:43 +12:00
Robin Bygrave 1a1c432c2a Initial add of SpiNamedParam 2016-07-12 20:45:33 +12:00
Robin Bygrave 86faa947af No effective change - tidy tests 2016-07-12 16:22:18 +12:00
Robin Bygrave 6b54b6ef46 Refactor BeanPropertyAssocOne findByParentIds use of raw expression 2016-07-12 16:11:51 +12:00
Robin Bygrave d8dfd66af3 Refactor BeanPropertyAssocMany findByParentIds use of raw expression 2016-07-12 16:01:32 +12:00
Robin Bygrave 675c51b8c1 Add IEQ support 2016-07-12 15:22:04 +12:00
Robin Bygrave 3cd7ecaa4a Merge branch 'wip/eql1' into wip/eql2 2016-07-12 15:05:00 +12:00
Robin Bygrave 1b322955ee [maven-release-plugin] prepare for next development iteration 2016-07-11 21:31:44 +12:00
Robin Bygrave 8115c5e230 [maven-release-plugin] prepare release avaje-ebeanorm-7.18.1 2016-07-11 21:31:25 +12:00
Robin Bygrave ad180c5531 No effective change - reduce test logging 2016-07-11 21:27:34 +12:00
Robin Bygrave b454f46dd4 Bump pom to 7.18.1-SNAPSHOT 2016-07-11 21:27:06 +12:00
Robin Bygrave 8a853b28f3 #772 - DB Migration DDL - alter table add column ... needs type conversion when using multiple platforms. e.g. varchar(20) ... convert to varchar2(20) for Oracle 2016-07-11 21:25:58 +12:00
Robin Bygrave a1be7ba5dd #771 - DB Migration DDL when using multiple platforms ... destination into sub directories rather than file suffix 2016-07-11 21:17:12 +12:00
Robin Bygrave 3914516793 #770 - DB Migration DDL generation run offline when using multiple platforms 2016-07-11 20:20:26 +12:00
Robin Bygrave 8c5854f77c #770 - DB Migration DDL generation run offline when using multiple platforms 2016-07-11 20:14:29 +12:00
Robin Bygrave 0bc5b94eae #770 - DB Migration DDL generation run offline when using multiple platforms 2016-07-11 20:08:26 +12:00
Robin Bygrave 12fa287f35 #769 - DB Migration DDL generation for UUID type when generating multiple platforms 2016-07-11 19:54:50 +12:00
Robin Bygrave 2991cb9ad1 #768 - Query.setDisableLazyLoading(true) ... not disabling lazy loading on @ManyToOne reference bean 2016-07-11 15:09:59 +12:00
Robin Bygrave 3b7f5496a8 #767 - Query.setDisableLazyLoading(true) ... not disabling lazy loading on @OneToMany 2016-07-11 12:28:31 +12:00
Robin Bygrave 4be703ff6e #767 - Query.setDisableLazyLoading(true) ... not disabling lazy loading on @OneToMany 2016-07-11 11:58:02 +12:00
Robin Bygrave d2c5765ac1 No effective change - tidy comments 2016-07-11 11:24:57 +12:00
Robin Bygrave aaf256b9be #766 - RawSql should automatically map column alias with underscore to camelCase ... so item_total should automatically map to bean property itemTotal 2016-07-08 23:44:11 +12:00
Robin Bygrave c7c6410cd9 #765 - ENH: Add ebean.xml with support for named RawSql, also adds EbeanServer.createNamedQuery() 2016-07-08 22:35:04 +12:00
Robin Bygrave 2c3c23725a No effective change - reformat code 2016-07-08 15:37:26 +12:00
Robin Bygrave 92069c0319 #764 - NPE on BeanDescriptorManager.processViewInvalidation(BeanDescriptorManager.java:385) 2016-07-08 15:34:43 +12:00
Robin Bygrave 630ad66ff1 #763 - Internal Code cleanup - remove redundant null checking etc 2016-07-08 15:01:39 +12:00
Robin Bygrave b732b390c7 [maven-release-plugin] prepare for next development iteration 2016-07-07 21:51:15 +12:00
Robin Bygrave 8c62fcdcb2 [maven-release-plugin] prepare release avaje-ebeanorm-7.17.1 2016-07-07 21:50:53 +12:00
Robin Bygrave e458f577fe No effective change - reduce logging for BeanDescriptorManager entity count message from INFO to DEBUG 2016-07-07 21:49:43 +12:00
Robin Bygrave 23434bab8c Bump pom to 7.17.1-SNAPSHOT 2016-07-07 21:45:40 +12:00
Robin Bygrave c47b5a1595 #762 - Change H2 Platform to IDENTITY (from SEQUENCE) with version 1.4.192 2016-07-07 21:43:15 +12:00
Robin Bygrave 411846347b #762 - Change H2 Platform to IDENTITY (from SEQUENCE) with version 1.4.192 2016-07-07 21:33:19 +12:00
Robin Bygrave 3722d19424 #761 - Change default for persistBatchOnCascade to be platform specific rather than NONE 2016-07-07 21:19:08 +12:00
Robin Bygrave 04a7310e5d [maven-release-plugin] prepare for next development iteration 2016-07-06 12:27:45 +12:00
Robin Bygrave 3490e90f03 [maven-release-plugin] prepare release avaje-ebeanorm-7.16.3 2016-07-06 12:27:26 +12:00
Robin Bygrave d89817a5c5 #760 - Change @Transactional(batchSize=100) ... to imply batch mode (remove need to also specify batch=PersistBatch.ALL) 2016-07-06 12:26:18 +12:00
Robin Bygrave db1ba5f20e #759 - Use default value of 100 for JDBC buffer fetchSize for findEach() / findEachWhile() - Add global defaults ServerConfig jdbcFetchSizeFindEach, jdbcFetchSizeFindList 2016-07-04 21:56:33 +12:00
Robin Bygrave 4f9a9a5094 No effective change - remove unused method 2016-06-30 14:45:06 +12:00
Robin Bygrave 1c6ac1289d #758 - DDL - @Index(unique=true) on field/property not creating unique index 2016-06-30 13:59:38 +12:00
Robin Bygrave b96be84106 Merge branch 'master' of github.com:ebean-orm/avaje-ebeanorm 2016-06-30 05:38:32 +12:00
Robin Bygrave 3c40293183 #757 - Reduce logging of Commit message of org.avaje.ebean.TXN from INFO to DEBUG 2016-06-30 05:38:16 +12:00
Rob BygraveandGitHub a9a6031986 Merge pull request #755 from MatthewMerrill/patch-1
Javadoc typo in SqlUpdate
2016-06-28 09:32:27 +12:00
Robin Bygrave b82085da42 [maven-release-plugin] prepare for next development iteration 2016-06-28 07:13:26 +12:00
Matthew MerrillandGitHub 2c34bc1636 Example code typo
Change "there where" to "there were" and added space between modify count and next word.
2016-06-27 09:07:45 -07:00
Robin Bygrave a954f8e9e1 EQL - initial 2016-06-01 17:27:35 +12:00
1612 changed files with 41330 additions and 32505 deletions
+12
View File
@@ -0,0 +1,12 @@
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
spaces_around_operators = true
+5 -5
View File
@@ -6,12 +6,12 @@ Goto [https://ebean-orm.github.io/](http://ebean-orm.github.io/ "Ebean ORM's Web
## Maven cental links:
[Maven central - avaje-ebeanorm](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.avaje.ebeanorm%22%20AND%20a%3A%22avaje-ebeanorm%22 "maven central ebeanorm")
[Maven central - ebean](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.avaje.ebean%22%20AND%20a%3A%22ebean%22 "maven central ebean")
[Maven central - all related projects](http://search.maven.org/#search%7Cga%7C1%7Cavaje-ebeanorm "maven central ebeanorm")
[Maven central - all related projects](http://search.maven.org/#search%7Cga%7C1%7Cebean "maven central all related projects")
## Current versions
* [![Maven Central : avaje-ebeanorm](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebeanorm/avaje-ebeanorm/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebeanorm/avaje-ebeanorm) - avaje-ebeanorm
* [![Maven Central : avaje-ebeanorm-agent](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebeanorm/avaje-ebeanorm-agent/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebeanorm/avaje-ebeanorm-agent) - avaje-ebeanorm-agent
* [![Maven Central : avaje-ebeanorm-agent](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebeanorm/avaje-ebeanorm-mavenenhancer/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebeanorm/avaje-ebeanorm-mavenenhancer) - avaje-ebeanorm-mavenenhancer
* [![Maven Central : ebean](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebean/ebean/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebean/ebean) - ebean
* [![Maven Central : ebean-agent](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebean/ebean-agent/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebean/ebean-agent) - ebean-agent
* [![Maven Central : ebean-maven-plugin](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebean/ebean-maven-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebean/ebean-maven-plugin) - ebean-maven-plugin
+34 -49
View File
@@ -3,41 +3,25 @@
<parent>
<groupId>org.avaje</groupId>
<artifactId>oss-parent</artifactId>
<artifactId>java8-parent</artifactId>
<version>1.1</version>
</parent>
<groupId>org.avaje.ebeanorm</groupId>
<artifactId>avaje-ebeanorm</artifactId>
<version>7.16.2</version>
<groupId>org.avaje.ebean</groupId>
<artifactId>ebean</artifactId>
<version>9.5.1</version>
<packaging>jar</packaging>
<name>avaje-ebeanorm</name>
<name>ebean</name>
<url>http://ebean-orm.github.io/</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>rbygrave</id>
<name>Rob Bygrave</name>
<email>robin.bygrave@gmail.com</email>
</developer>
</developers>
<scm>
<developerConnection>scm:git:https://github.com/ebean-orm/avaje-ebeanorm.git</developerConnection>
<tag>avaje-ebeanorm-7.16.2</tag>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-9.5.1</tag>
</scm>
<dependencies>
@@ -49,9 +33,15 @@
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<groupId>org.avaje.ebean</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.avaje.ebean</groupId>
<artifactId>ebean-annotation</artifactId>
<version>1.5</version>
</dependency>
<dependency>
@@ -69,19 +59,19 @@
<dependency>
<groupId>org.avaje</groupId>
<artifactId>avaje-classpath-scanner-api</artifactId>
<version>2.1</version>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.avaje</groupId>
<artifactId>avaje-classpath-scanner</artifactId>
<version>2.1.1</version>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.avaje</groupId>
<artifactId>avaje-dbmigration</artifactId>
<version>1.1.1</version>
<version>1.2.1</version>
</dependency>
<dependency>
@@ -90,6 +80,12 @@
<version>[1.7.1,1.7.99)</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.5.3</version>
</dependency>
<!-- Jackson core used internally by Ebean -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@@ -166,9 +162,9 @@
</dependency>
<dependency>
<groupId>org.avaje.ebeanorm</groupId>
<artifactId>avaje-ebeanorm-agent</artifactId>
<version>4.11.1</version>
<groupId>org.avaje.ebean</groupId>
<artifactId>ebean-agent</artifactId>
<version>8.1.1</version>
<scope>test</scope>
</dependency>
@@ -177,10 +173,10 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.189</version>
<version>1.4.192</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
@@ -231,26 +227,15 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.avaje.ebeanorm</groupId>
<artifactId>avaje-ebeanorm-mavenenhancer</artifactId>
<version>4.11.1</version>
<groupId>org.avaje.ebean</groupId>
<artifactId>ebean-maven-plugin</artifactId>
<version>8.1.1</version>
<executions>
<execution>
<id>test</id>
<phase>process-test-classes</phase>
<configuration>
<classSource>target/test-classes</classSource>
<!--<packages>com.avaje.tests.**</packages>-->
<transformArgs>debug=1</transformArgs>
</configuration>
<goals>
@@ -298,7 +283,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<doctitle>Ebean 7</doctitle>
<doctitle>Ebean 9</doctitle>
<overview>src/main/java/com/avaje/ebean/overview.html</overview>
<source>1.8</source>
<doclet>org.avaje.doclet.PygmentsDoclet</doclet>
@@ -331,5 +316,5 @@
</plugins>
</build>
</project>
@@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit;
* code if you want. It can be useful for some server caching implementations
* (background population and trimming of the cache etc).
* </p>
*
*
* @author rbygrave
*/
public interface BackgroundExecutor {
+17 -10
View File
@@ -38,15 +38,18 @@ public interface BeanState {
*/
void setDisableLazyLoad(boolean disableLazyLoading);
/**
* Return true if the bean has lazy loading disabled.
*/
boolean isDisableLazyLoad();
/**
* Set the loaded state of the property given it's name.
*
* <p>
* Typically this would be used to set the loaded state of a property
* to false to ensure that the specific property is excluded from a
* stateless update.
* Typically this would be used to set the loaded state of a property
* to false to ensure that the specific property is excluded from a
* stateless update.
* </p>
*
* <pre>{@code
*
* // populate a bean via say JSON
@@ -59,8 +62,7 @@ public interface BeanState {
* user.update();
*
* }</pre>
*
*
* <p>
* This will throw an IllegalArgumentException if the property is unknown.
*/
void setPropertyLoaded(String propertyName, boolean loaded);
@@ -82,8 +84,8 @@ public interface BeanState {
/**
* Return a map of the updated properties and their new and old values.
*/
Map<String,ValuePair> getDirtyValues();
Map<String, ValuePair> getDirtyValues();
/**
* Return true if the bean is readOnly.
* <p>
@@ -115,4 +117,9 @@ public interface BeanState {
* for a fully loaded entity bean.
*/
void setLoaded();
}
/**
* Reset the bean putting it into NEW state such that a save() results in an insert.
*/
void resetForInsert();
}
+43 -49
View File
@@ -13,65 +13,66 @@ import java.sql.SQLException;
* <p>
* Example 1:
* </p>
*
* <pre class="code">
* String sql = &quot;{call sp_order_mod(?,?)}&quot;;
*
* <pre>{@code
*
* String sql = "{call sp_order_mod(?,?)}";
*
* CallableSql cs = Ebean.createCallableSql(sql);
* cs.setParameter(1, &quot;turbo&quot;);
* cs.setParameter(1, "turbo");
* cs.registerOut(2, Types.INTEGER);
*
*
* Ebean.execute(cs);
*
*
* // read the out parameter
* Integer returnValue = (Integer) cs.getObject(2);
* </pre>
*
*
* }</pre>
* <p>
* Example 2:<br>
* Includes batch mode, table modification information and label. Note that the
* label is really only to help people reading the transaction logs to identify
* the procedure called etc.
* </p>
*
* <pre class="code">
* String sql = &quot;{call sp_insert_order(?,?)}&quot;;
*
*
* <pre>{@code
*
* String sql = "{call sp_insert_order(?,?)}";
*
* CallableSql cs = Ebean.createCallableSql(sql);
*
*
* // Inform Ebean this stored procedure inserts into the
* // oe_order table and inserts + updates the oe_order_detail table.
* // this is used to invalidate objects in the cache
* cs.addModification(&quot;oe_order&quot;, true, false, false);
* cs.addModification(&quot;oe_order_detail&quot;, true, true, false);
*
* cs.addModification("oe_order", true, false, false);
* cs.addModification("oe_order_detail", true, true, false);
*
* Transaction t = Ebean.startTransaction();
*
*
* // execute using JDBC batching 10 statements at a time
* t.setBatchMode(true);
* t.setBatchSize(10);
* try {
* cs.setParameter(1, &quot;Was&quot;);
* cs.setParameter(2, &quot;Banana&quot;);
* cs.setParameter(1, "Was");
* cs.setParameter(2, "Banana");
* Ebean.execute(cs);
*
* cs.setParameter(1, &quot;Here&quot;);
* cs.setParameter(2, &quot;Kumera&quot;);
*
* cs.setParameter(1, "Here");
* cs.setParameter(2, "Kumera");
* Ebean.execute(cs);
*
* cs.setParameter(1, &quot;More&quot;);
* cs.setParameter(2, &quot;Apple&quot;);
*
* cs.setParameter(1, "More");
* cs.setParameter(2, "Apple");
* Ebean.execute(cs);
*
* // Ebean.externalModification(&quot;oe_order&quot;,true,false,false);
* // Ebean.externalModification(&quot;oe_order_detail&quot;,true,true,false);
*
* // Ebean.externalModification("oe_order",true,false,false);
* // Ebean.externalModification("oe_order_detail",true,true,false);
* Ebean.commitTransaction();
*
*
* } finally {
* Ebean.endTransaction();
* }
* </pre>
*
* }</pre>
*
* @see com.avaje.ebean.SqlUpdate
* @see com.avaje.ebean.Ebean#execute(CallableSql)
*/
@@ -119,21 +120,17 @@ public interface CallableSql {
* This is designed so that you do not need to set params in index order. You
* can set/register param 2 before param 1 etc.
* </p>
*
* @param position
* the index position of the parameter.
* @param value
* the value of the parameter.
*
* @param position the index position of the parameter.
* @param value the value of the parameter.
*/
CallableSql bind(int position, Object value);
/**
* Bind a positioned parameter (same as bind method).
*
* @param position
* the index position of the parameter.
* @param value
* the value of the parameter.
*
* @param position the index position of the parameter.
* @param value the value of the parameter.
*/
CallableSql setParameter(int position, Object value);
@@ -147,11 +144,9 @@ public interface CallableSql {
* This is designed so that you do not need to register params in index order.
* You can set/register param 2 before param 1 etc.
* </p>
*
* @param position
* the index position of the parameter (starts with 1).
* @param type
* the jdbc type of the OUT parameter that will be read.
*
* @param position the index position of the parameter (starts with 1).
* @param type the jdbc type of the OUT parameter that will be read.
*/
CallableSql registerOut(int position, int type);
@@ -168,7 +163,6 @@ public interface CallableSql {
Object getObject(int position);
/**
*
* You can extend this object and override this method for more advanced
* stored procedure calls. This would be the case when ResultSets are returned
* etc.
@@ -190,4 +184,4 @@ public interface CallableSql {
*/
CallableSql addModification(String tableName, boolean inserts, boolean updates, boolean deletes);
}
}
@@ -1,10 +1,9 @@
package com.avaje.ebean;
import java.util.ArrayList;
import com.avaje.ebean.RawSql.ColumnMapping;
import javax.persistence.PersistenceException;
import com.avaje.ebean.RawSql.ColumnMapping;
import java.util.ArrayList;
/**
* Parses columnMapping (select clause) mapping columns to bean properties.
@@ -30,7 +29,7 @@ final class DRawSqlColumnsParser {
private ColumnMapping parse() {
ArrayList<ColumnMapping.Column> columns = new ArrayList<ColumnMapping.Column>();
ArrayList<ColumnMapping.Column> columns = new ArrayList<>();
while (pos <= end) {
ColumnMapping.Column c = nextColumnInfo();
columns.add(c);
@@ -47,10 +46,10 @@ final class DRawSqlColumnsParser {
String[] split = colInfo.split("\\s(?=[^\\)]*(?:\\(|$))");
if (split.length > 1) {
ArrayList<String> tmp = new ArrayList<String>(split.length);
for (int i = 0; i < split.length; i++) {
if (!split[i].trim().isEmpty()) {
tmp.add(split[i].trim());
ArrayList<String> tmp = new ArrayList<>(split.length);
for (String aSplit : split) {
if (!aSplit.trim().isEmpty()) {
tmp.add(aSplit.trim());
}
}
split = tmp.toArray(new String[tmp.size()]);
@@ -66,15 +65,15 @@ final class DRawSqlColumnsParser {
if (split.length == 2) {
return new ColumnMapping.Column(indexPos++, split[0], split[1]);
}
// Ok, we now expect/require the AS keyword and it should be the
// second to last word in the colInfo content
// Ok, we now expect/require the AS keyword and it should be the
// second to last word in the colInfo content
if (!split[split.length - 2].equalsIgnoreCase("as")) {
throw new PersistenceException("Expecting AS keyword as second to last word when parsing column " + colInfo);
}
// build back the 'column formula' that precedes the AS keyword
StringBuilder sb = new StringBuilder();
sb.append(split[0]);
for (int i = 1; i < split.length-2; i++) {
for (int i = 1; i < split.length - 2; i++) {
sb.append(" ").append(split[i]);
}
return new ColumnMapping.Column(indexPos++, sb.toString(), split[split.length - 1]);
@@ -1,6 +1,7 @@
package com.avaje.ebean;
import com.avaje.ebean.RawSql.Sql;
import com.avaje.ebeaninternal.server.querydefn.SimpleTextParser;
/**
* Parses sql-select queries to try and determine the location where WHERE and
@@ -8,13 +9,13 @@ import com.avaje.ebean.RawSql.Sql;
*/
class DRawSqlParser {
public static final String $_AND_HAVING = "${andHaving}";
private static final String $_AND_HAVING = "${andHaving}";
public static final String $_HAVING = "${having}";
private static final String $_HAVING = "${having}";
public static final String $_AND_WHERE = "${andWhere}";
private static final String $_AND_WHERE = "${andWhere}";
public static final String $_WHERE = "${where}";
private static final String $_WHERE = "${where}";
private final SimpleTextParser textParser;
@@ -46,7 +47,7 @@ class DRawSqlParser {
private DRawSqlParser(String sqlString) {
sqlString = sqlString.trim();
sqlString = sqlString.replace('\n',' ');
sqlString = sqlString.replace('\n', ' ');
this.sql = sqlString;
this.hasPlaceHolders = findAndRemovePlaceHolders();
this.textParser = new SimpleTextParser(sqlString);
@@ -39,13 +39,13 @@ public final class DocStoreQueueEntry {
}
}
final Action type;
private final Action type;
final String queueId;
private final String queueId;
final String path;
private final String path;
final Object beanId;
private final Object beanId;
/**
* Construct for an INDEX or DELETE action.
@@ -6,6 +6,8 @@ import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* Document storage operations.
@@ -93,7 +95,6 @@ public interface DocumentStore {
* <p>
* Typically this is called indirectly by findPagedList() on the query that has setUseDocStore(true).
* </p>
*
* <pre>{@code
*
* PagedList<Customer> newCustomers =
@@ -104,7 +105,6 @@ public interface DocumentStore {
* .findPagedList();
*
* }</pre>
*
*/
<T> PagedList<T> findPagedList(DocQueryRequest<T> request);
@@ -117,7 +117,6 @@ public interface DocumentStore {
* <p>
* Typically this is called indirectly by findEach() on the query that has setUseDocStore(true).
* </p>
*
* <pre>{@code
*
* server.find(Order.class)
@@ -132,7 +131,7 @@ public interface DocumentStore {
*
* }</pre>
*/
<T> void findEach(DocQueryRequest<T> query, QueryEachConsumer<T> consumer);
<T> void findEach(DocQueryRequest<T> query, Consumer<T> consumer);
/**
* Execute the query against the document store with the expectation of a large set of results
@@ -146,8 +145,6 @@ public interface DocumentStore {
* <p>
* Typically this is called indirectly by findEachWhile() on the query that has setUseDocStore(true).
* </p>
*
*
* <pre>{@code
*
* server.find(Order.class)
@@ -166,7 +163,7 @@ public interface DocumentStore {
*
* }</pre>
*/
<T> void findEachWhile(DocQueryRequest<T> query, QueryEachWhileConsumer<T> consumer);
<T> void findEachWhile(DocQueryRequest<T> query, Predicate<T> consumer);
/**
* Process the queue entries sending updates to the document store or queuing them for later processing.
@@ -175,7 +172,6 @@ public interface DocumentStore {
/**
* Drop the index from the document store (similar to DDL drop table).
*
* <pre>{@code
*
* DocumentStore documentStore = server.docStore();
@@ -183,13 +179,11 @@ public interface DocumentStore {
* documentStore.dropIndex("product_copy");
*
* }</pre>
*
*/
void dropIndex(String indexName);
/**
* Create an index given a mapping file as a resource in the classPath (similar to DDL create table).
*
* <pre>{@code
*
* DocumentStore documentStore = server.docStore();
@@ -201,8 +195,8 @@ public interface DocumentStore {
*
* }</pre>
*
* @param indexName the name of the new index
* @param alias the alias of the index
* @param indexName the name of the new index
* @param alias the alias of the index
*/
void createIndex(String indexName, String alias);
@@ -222,7 +216,6 @@ public interface DocumentStore {
* documentStore.indexSettings("product", settings);
*
* }</pre>
*
* <pre>{@code
*
* // refresh_interval 1s ... restore after bulk loading
@@ -244,7 +237,6 @@ public interface DocumentStore {
* <p>
* This copy process does not use the database but instead will copy from the source index to a destination index.
* </p>
*
* <pre>{@code
*
* long copyCount = documentStore.copyIndex(Product.class, "product_copy");
@@ -263,7 +255,6 @@ public interface DocumentStore {
* <p>
* To support this the document needs to have a <code>@WhenModified</code> property.
* </p>
*
* <pre>{@code
*
* long copyCount = documentStore.copyIndex(Product.class, "product_copy", sinceMillis);
@@ -279,7 +270,6 @@ public interface DocumentStore {
/**
* Copy from a source index to a new index taking only the documents
* matching the given query.
*
* <pre>{@code
*
* // predicates to select the source documents to copy
+159 -157
View File
@@ -41,7 +41,6 @@ import java.util.concurrent.ConcurrentHashMap;
* {@link #find(Class)} that proxy through to the 'default' EbeanServer. This
* can be useful for applications that use a single database.</li>
* </ul>
*
* <p>
* For developer convenience Ebean has static methods that proxy through to the
* methods on the <em>'default'</em> EbeanServer. These methods are provided for
@@ -59,7 +58,6 @@ import java.util.concurrent.ConcurrentHashMap;
* created automatically they are configured using information in the
* ebean.properties file.
* </p>
*
* <pre>{@code
*
* // fetch shipped orders (and also their customer)
@@ -76,40 +74,36 @@ import java.util.concurrent.ConcurrentHashMap;
* }
*
* }</pre>
*
* <pre>{@code
*
* // fetch order 10, modify and save
* Order order = Ebean.find(Order.class, 10);
*
*
* OrderStatus shipped = Ebean.getReference(OrderStatus.class,"SHIPPED");
* order.setStatus(shipped);
* order.setShippedDate(shippedDate);
* ...
*
*
* // implicitly creates a transaction and commits
* Ebean.save(order);
*
* }</pre>
*
* <p>
* When you have multiple databases and need access to a specific one the
* {@link #getServer(String)} method provides access to the EbeanServer for that
* specific database.
* </p>
*
* <pre>{@code
*
* // Get access to the Human Resources EbeanServer/Database
* EbeanServer hrDb = Ebean.getServer("hr");
*
*
*
* // fetch contact 3 from the HR database
* Contact contact = hrDb.find(Contact.class, 3);
*
*
* contact.setName("I'm going to change");
* ...
*
*
* // save the contact back to the HR database
* hrDb.save(contact);
*
@@ -132,13 +126,13 @@ public final class Ebean {
/**
* Cache for fast concurrent read access.
*/
private final ConcurrentHashMap<String, EbeanServer> concMap = new ConcurrentHashMap<String, EbeanServer>();
private final ConcurrentHashMap<String, EbeanServer> concMap = new ConcurrentHashMap<>();
/**
* Cache for synchronized read, creation and put. Protected by the monitor
* object.
*/
private final HashMap<String, EbeanServer> syncMap = new HashMap<String, EbeanServer>();
private final HashMap<String, EbeanServer> syncMap = new HashMap<>();
private final Object monitor = new Object();
@@ -217,7 +211,7 @@ public final class Ebean {
private void register(EbeanServer server, boolean isDefaultServer) {
registerWithName(server.getName(), server, isDefaultServer);
}
private void registerWithName(String name, EbeanServer server, boolean isDefaultServer) {
synchronized (monitor) {
concMap.put(name, server);
@@ -242,16 +236,14 @@ public final class Ebean {
* transactions and the ability to use transactions created externally to
* Ebean.
* </p>
*
* <pre>{@code
* // use the "hr" database
* EbeanServer hrDatabase = Ebean.getServer("hr");
*
*
* Person person = hrDatabase.find(Person.class, 10);
* }</pre>
*
* @param name
* the name of the server, can use null for the 'default server'
*
* @param name the name of the server, can use null for the 'default server'
*/
public static EbeanServer getServer(String name) {
return serverMgr.get(name);
@@ -304,7 +296,7 @@ public final class Ebean {
serverMgr.registerWithName(name, server, defaultServer);
return originalPrimaryServer;
}
/**
* Return the next identity value for a given bean type.
* <p>
@@ -336,7 +328,6 @@ public final class Ebean {
* Example of using a transaction to span multiple calls to find(), save()
* etc.
* </p>
*
* <pre>{@code
*
* // start a transaction (stored in a ThreadLocal)
@@ -345,9 +336,9 @@ public final class Ebean {
* Order order = Ebean.find(Order.class,10); ...
*
* Ebean.save(order);
*
*
* Ebean.commitTransaction();
*
*
* } finally {
* // rollback if we didn't commit
* // i.e. an exception occurred before commitTransaction().
@@ -355,7 +346,6 @@ public final class Ebean {
* }
*
* }</pre>
*
* <p>
* If you want to externalise the transaction management then you should be
* able to do this via EbeanServer. Specifically with EbeanServer you can pass
@@ -371,10 +361,8 @@ public final class Ebean {
/**
* Start a transaction additionally specifying the isolation level.
*
* @param isolation
* the Transaction isolation level
*
*
* @param isolation the Transaction isolation level
*/
public static Transaction beginTransaction(TxIsolation isolation) {
return serverMgr.getDefaultServer().beginTransaction(isolation);
@@ -382,12 +370,10 @@ public final class Ebean {
/**
* Start a transaction typically specifying REQUIRES_NEW or REQUIRED semantics.
*
* <p>
* Note that this provides an try finally alternative to using {@link #execute(TxScope, TxCallable)} or
* {@link #execute(TxScope, TxRunnable)}.
* </p>
*
* <h3>REQUIRES_NEW example:</h3>
* <pre>{@code
* // Start a new transaction. If there is a current transaction
@@ -408,7 +394,6 @@ public final class Ebean {
* }
*
* }</pre>
*
* <h3>REQUIRED example:</h3>
* <pre>{@code
*
@@ -431,7 +416,7 @@ public final class Ebean {
*
* }</pre>
*/
public static Transaction beginTransaction(TxScope scope){
public static Transaction beginTransaction(TxScope scope) {
return serverMgr.getDefaultServer().beginTransaction(scope);
}
@@ -449,7 +434,6 @@ public final class Ebean {
* If there is no currently active transaction then a PersistenceException is thrown.
*
* @param transactionCallback the transaction callback to be registered with the current transaction
*
* @throws PersistenceException if there is no currently active transaction
*/
public static void register(TransactionCallback transactionCallback) throws PersistenceException {
@@ -480,7 +464,6 @@ public final class Ebean {
* <p>
* Code example:
* </p>
*
* <pre>{@code
* Ebean.beginTransaction();
* try {
@@ -488,7 +471,7 @@ public final class Ebean {
*
* // commit at the end
* Ebean.commitTransaction();
*
*
* } finally {
* // if commit didn't occur then rollback the transaction
* Ebean.endTransaction();
@@ -499,6 +482,13 @@ public final class Ebean {
serverMgr.getDefaultServer().endTransaction();
}
/**
* Mark the current transaction as rollback only.
*/
public static void setRollbackOnly() {
serverMgr.getDefaultServer().currentTransaction().setRollbackOnly();
}
/**
* Return a map of the differences between two objects of the same type.
* <p>
@@ -525,16 +515,14 @@ public final class Ebean {
* In this example below the details property has a CascadeType.ALL set so
* saving an order will also save all its details.
* </p>
*
* <pre>{@code
* public class Order { ...
*
*
* @OneToMany(cascade=CascadeType.ALL, mappedBy="order")
* List<OrderDetail> details;
* ...
* }
* }</pre>
*
* <p>
* When a save cascades via a OneToMany or ManyToMany Ebean will automatically
* set the 'parent' object to the 'detail' object. In the example below in
@@ -569,16 +557,15 @@ public final class Ebean {
* <p>
* An unmodified bean that is saved or updated is normally skipped and this marks the bean as
* dirty so that it is not skipped.
*
* <pre>{@code
*
*
* Customer customer = Ebean.find(Customer, id);
*
*
* // mark the bean as dirty so that a save() or update() will
* // increment the version property
* Ebean.markAsDirty(customer);
* Ebean.save(customer);
*
*
* }</pre>
*/
public static void markAsDirty(Object bean) throws OptimisticLockException {
@@ -607,17 +594,16 @@ public final class Ebean {
* controls if only the changed properties are included in the update or if all the loaded
* properties are included instead.
* </p>
*
* <pre>{@code
*
*
* // A 'stateless update' example
* Customer customer = new Customer();
* customer.setId(7);
* customer.setName("ModifiedNameNoOCC");
* ebeanServer.update(customer);
*
*
* }</pre>
*
*
* @see ServerConfig#setUpdatesDeleteMissingChildren(boolean)
* @see ServerConfig#setUpdateChangesOnly(boolean)
*/
@@ -724,7 +710,6 @@ public final class Ebean {
/**
* Refresh a 'many' property of a bean.
*
* <pre>{@code
*
* Order order = ...;
@@ -733,11 +718,9 @@ public final class Ebean {
* Ebean.refreshMany(order, "details");
*
* }</pre>
*
* @param bean
* the entity bean containing the List Set or Map to refresh.
* @param manyPropertyName
* the property name of the List Set or Map to refresh.
*
* @param bean the entity bean containing the List Set or Map to refresh.
* @param manyPropertyName the property name of the List Set or Map to refresh.
*/
public static void refreshMany(Object bean, String manyPropertyName) {
serverMgr.getDefaultServer().refreshMany(bean, manyPropertyName);
@@ -748,24 +731,21 @@ public final class Ebean {
* <p>
* This is sometimes described as a proxy (with lazy loading).
* </p>
*
* <pre>{@code
*
* Product product = Ebean.getReference(Product.class, 1);
*
*
* // You can get the id without causing a fetch/lazy load
* Integer productId = product.getId();
*
*
* // If you try to get any other property a fetch/lazy loading will occur
* // This will cause a query to execute...
* String name = product.getName();
*
* }</pre>
*
* @param beanType
* the type of entity bean
* @param id
* the id value
*
* @param beanType the type of entity bean
* @param id the id value
*/
public static <T> T getReference(Class<T> beanType, Object id) {
return serverMgr.getDefaultServer().getReference(beanType, id);
@@ -789,29 +769,26 @@ public final class Ebean {
* Note that the sorting uses a Comparator and Collections.sort(); and does
* not invoke a DB query.
* </p>
*
* <pre>{@code
*
*
* // find orders and their customers
* List<Order> list = Ebean.find(Order.class)
* .fetch("customer")
* .orderBy("id")
* .findList();
*
*
* // sort by customer name ascending, then by order shipDate
* // ... then by the order status descending
* Ebean.sort(list, "customer.name, shipDate, status desc");
*
*
* // sort by customer name descending (with nulls low)
* // ... then by the order id
* Ebean.sort(list, "customer.name desc nullsLow, id");
*
*
* }</pre>
*
* @param list
* the list of entity beans
* @param sortByClause
* the properties to sort the list by
*
* @param list the list of entity beans
* @param sortByClause the properties to sort the list by
*/
public static <T> void sort(List<T> list, String sortByClause) {
serverMgr.getDefaultServer().sort(list, sortByClause);
@@ -819,35 +796,35 @@ public final class Ebean {
/**
* Find a bean using its unique id. This will not use caching.
*
* <pre>{@code
*
* // Fetch order 1
* Order order = Ebean.find(Order.class, 1);
*
* }</pre>
*
* <p>
* If you want more control over the query then you can use createQuery() and
* Query.findUnique();
* </p>
*
* <pre>{@code
*
* // ... additionally fetching customer, customer shipping address,
* // order details, and the product associated with each order detail.
* // note: only product id and name is fetch (its a "partial object").
* // note: all other objects use "*" and have all their properties fetched.
*
*
* Query<Order> query = Ebean.find(Order.class)
* .setId(1)
* .fetch("customer")
* .fetch("customer.shippingAddress")
* .fetch("details")
* .query();
*
*
* // fetch associated products but only fetch their product id and name
* query.fetch("details.product", "name");
*
*
* // traverse the object graph...
*
*
* Order order = query.findUnique();
* Customer customer = order.getCustomer();
* Address shippingAddress = customer.getShippingAddress();
@@ -857,11 +834,9 @@ public final class Ebean {
* String productName = product.getName();
*
* }</pre>
*
* @param beanType
* the type of entity bean to fetch
* @param id
* the id value
*
* @param beanType the type of entity bean to fetch
* @param id the id value
*/
@Nullable
public static <T> T find(Class<T> beanType, Object id) {
@@ -896,7 +871,7 @@ public final class Ebean {
/**
* Create a CallableSql to execute a given stored procedure.
*
*
* @see CallableSql
*/
public static CallableSql createCallableSql(String sql) {
@@ -914,19 +889,18 @@ public final class Ebean {
* <p>
* An example:
* </p>
*
* <pre>{@code
*
*
* // The bean name and properties - "topic","postCount" and "id"
*
*
* // will be converted into their associated table and column names
* String updStatement = "update topic set postCount = :pc where id = :id";
*
*
* Update<Topic> update = Ebean.createUpdate(Topic.class, updStatement);
*
*
* update.set("pc", 9);
* update.set("id", 3);
*
*
* int rows = update.execute();
* System.out.println("rows updated:" + rows);
*
@@ -945,6 +919,21 @@ public final class Ebean {
return serverMgr.getDefaultServer().createCsvReader(beanType);
}
/**
* Create a named query.
* <p>
* For RawSql the named query is expected to be in ebean.xml.
* </p>
*
* @param beanType The type of entity bean
* @param namedQuery The name of the query
* @param <T> The type of entity bean
* @return The query
*/
public static <T> Query<T> createNamedQuery(Class<T> beanType, String namedQuery) {
return serverMgr.getDefaultServer().createNamedQuery(beanType, namedQuery);
}
/**
* Create a query for a type of entity bean.
* <p>
@@ -960,46 +949,51 @@ public final class Ebean {
* {@link Query#findSet()} etc will execute against the same EbeanServer from
* which is was created.
* </p>
*
*
* @param beanType the class of entity to be fetched
* @return A ORM Query object for this beanType
*/
public static <T> Query<T> createQuery(Class<T> beanType) {
return serverMgr.getDefaultServer().createQuery(beanType);
}
/**
* Parse the Ebean query language statement returning the query which can then
* be modified (add expressions, change order by clause, change maxRows, change
* fetch and select paths etc).
* <p>
* <h3>Example</h3>
* <pre>{@code
* // Find order 2 additionally fetching the customer, details and details.product
* // name.
*
*
* // Find order additionally fetching the customer, details and details.product name.
*
* String eql = "fetch customer fetch details fetch details.product (name) where id = :orderId ";
*
* Query<Order> query = Ebean.createQuery(Order.class, eql);
* query.setParameter("orderId", 2);
*
* Order order = query.findUnique();
*
* // This is the same as:
*
* Order order = Ebean.find(Order.class)
* .fetch("customer")
* .fetch("details")
* .fetch("detail.product", "name")
* .setId(2)
* .findUnique();
*
* // Find order 2 additionally fetching the customer, details and details.product
* // name.
* // Note: same query as above but using the query language
* // Note: using a named query would be preferred practice
*
* String oql = "find order fetch customer fetch details fetch details.product (name) where id = :orderId ";
*
* Query<Order> query = Ebean.find(Order.class);
* query.setQuery(oql);
* query.setParameter("orderId", 2);
*
* Order order = query.findUnique();
*
* // Using a named query
* Query<Order> query = Ebean.find(Order.class, "with.details");
* query.setParameter("orderId", 2);
*
* Order order = query.findUnique();
*
*
* }</pre>
*
* @param beanType
* the class of entity to be fetched
* @return A ORM Query object for this beanType
*
* @param beanType The type of bean to fetch
* @param eql The Ebean query
* @param <T> The type of the entity bean
* @return The query with expressions defined as per the parsed query statement
*/
public static <T> Query<T> createQuery(Class<T> beanType) {
public static <T> Query<T> createQuery(Class<T> beanType, String eql) {
return serverMgr.getDefaultServer().createQuery(beanType);
return serverMgr.getDefaultServer().createQuery(beanType, eql);
}
/**
@@ -1009,9 +1003,8 @@ public final class Ebean {
* exists is that people used to JPA will probably be looking for a
* createQuery method (the same as entityManager).
* </p>
*
* @param beanType
* the type of entity bean to find
*
* @param beanType the type of entity bean to find
* @return A ORM Query object for this beanType
*/
public static <T> Query<T> find(Class<T> beanType) {
@@ -1019,6 +1012,30 @@ public final class Ebean {
return serverMgr.getDefaultServer().find(beanType);
}
/**
* Create a query using native SQL.
* <p>
* The native SQL can contain named parameters or positioned parameters.
* </p>
* <pre>{@code
*
* String sql = "select c.id, c.name from customer c where c.name like ? order by c.name";
*
* Query<Customer> query = ebeanServer.findNative(Customer.class, sql);
* query.setParameter(1, "Rob%");
*
* List<Customer> customers = query.findList();
*
* }</pre>
*
* @param beanType The type of entity bean to fetch
* @param nativeSql The SQL that can contain named or positioned parameters
* @return The query to set parameters and execute
*/
public static <T> Query<T> findNative(Class<T> beanType, String nativeSql) {
return serverMgr.getDefaultServer().findNative(beanType, nativeSql);
}
/**
* Create an Update query to perform a bulk update.
* <p>
@@ -1072,28 +1089,24 @@ public final class Ebean {
* <p>
* Example:
* </p>
*
* <pre>{@code
*
* // example that uses 'named' parameters
* String s = "UPDATE f_topic set post_count = :count where id = :id"
*
*
* SqlUpdate update = Ebean.createSqlUpdate(s);
*
*
* update.setParameter("id", 1);
* update.setParameter("count", 50);
*
*
* int modifiedCount = Ebean.execute(update);
*
*
* String msg = "There where " + modifiedCount + "rows updated";
*
* }</pre>
*
* @param sqlUpdate
* the update sql potentially with bind values
*
*
* @param sqlUpdate the update sql potentially with bind values
* @return the number of rows updated or deleted. -1 if executed in batch.
*
* @see SqlUpdate
* @see CallableSql
* @see Ebean#execute(CallableSql)
@@ -1107,23 +1120,22 @@ public final class Ebean {
* <p>
* Example:
* </p>
*
* <pre>{@code
*
* String sql = "{call sp_order_modify(?,?,?)}";
*
*
* CallableSql cs = Ebean.createCallableSql(sql);
* cs.setParameter(1, 27);
* cs.setParameter(2, "SHIPPED");
* cs.registerOut(3, Types.INTEGER);
*
*
* Ebean.execute(cs);
*
*
* // read the out parameter
* Integer returnValue = (Integer) cs.getObject(3);
*
* }</pre>
*
*
* @see CallableSql
* @see Ebean#execute(SqlUpdate)
*/
@@ -1137,7 +1149,6 @@ public final class Ebean {
* The scope can control the transaction type, isolation and rollback
* semantics.
* </p>
*
* <pre>{@code
*
* // set specific transactional scope settings
@@ -1162,17 +1173,16 @@ public final class Ebean {
* The default scope runs with REQUIRED and by default will rollback on any
* exception (checked or runtime).
* </p>
*
* <pre>{@code
*
* Ebean.execute(new TxRunnable() {
* public void run() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
*
*
* u1.setName("u1 mod");
* u2.setName("u2 mod");
*
*
* Ebean.save(u1);
* Ebean.save(u2);
* }
@@ -1190,7 +1200,6 @@ public final class Ebean {
* The scope can control the transaction type, isolation and rollback
* semantics.
* </p>
*
* <pre>{@code
*
* // set specific transactional scope settings
@@ -1205,7 +1214,6 @@ public final class Ebean {
* });
*
* }</pre>
*
*/
public static <T> T execute(TxScope scope, TxCallable<T> c) {
return serverMgr.getDefaultServer().execute(scope, c);
@@ -1221,20 +1229,19 @@ public final class Ebean {
* This is basically the same as TxRunnable except that it returns an Object
* (and you specify the return type via generics).
* </p>
*
* <pre>{@code
*
* Ebean.execute(new TxCallable<String>() {
* public String call() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
*
*
* u1.setName("u1 mod");
* u2.setName("u2 mod");
*
*
* Ebean.save(u1);
* Ebean.save(u2);
*
*
* return u1.getEmail();
* }
* });
@@ -1269,15 +1276,11 @@ public final class Ebean {
* If there is NO current transaction when you call this method then this
* information is registered immediately (with the transaction manager).
* </p>
*
* @param tableName
* the name of the table that was modified
* @param inserts
* true if rows where inserted into the table
* @param updates
* true if rows on the table where updated
* @param deletes
* true if rows on the table where deleted
*
* @param tableName the name of the table that was modified
* @param inserts true if rows where inserted into the table
* @param updates true if rows on the table where updated
* @param deletes true if rows on the table where deleted
*/
public static void externalModification(String tableName, boolean inserts, boolean updates, boolean deletes) {
@@ -1296,7 +1299,6 @@ public final class Ebean {
/**
* Return the manager of the server cache ("L2" cache).
*
*/
public static ServerCacheManager getServerCacheManager() {
return serverMgr.getDefaultServer().getServerCacheManager();
+143 -20
View File
@@ -15,6 +15,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* Provides the API for fetching and saving beans to a particular DataSource.
@@ -167,8 +169,9 @@ public interface EbeanServer {
/**
* Create a new instance of T that is an EntityBean.
* <p>
* Generally not expected to be useful (now dynamic subclassing support was removed in
* favour of always using enhancement).
* Useful if you use BeanPostConstructListeners or &#64;PostConstruct Annotations.
* In this case you should not use "new Bean...()". Making all bean construtors protected
* could be a good idea here.
* </p>
*/
<T> T createEntityBean(Class<T> type);
@@ -199,6 +202,19 @@ public interface EbeanServer {
*/
<T> UpdateQuery<T> update(Class<T> beanType);
/**
* Create a named query.
* <p>
* For RawSql the named query is expected to be in ebean.xml.
* </p>
*
* @param beanType The type of entity bean
* @param namedQuery The name of the query
* @param <T> The type of entity bean
* @return The query
*/
<T> Query<T> createNamedQuery(Class<T> beanType, String namedQuery);
/**
* Create a query for an entity bean and synonym for {@link #find(Class)}.
*
@@ -206,6 +222,41 @@ public interface EbeanServer {
*/
<T> Query<T> createQuery(Class<T> beanType);
/**
* Parse the Ebean query language statement returning the query which can then
* be modified (add expressions, change order by clause, change maxRows, change
* fetch and select paths etc).
* <p>
* <h3>Example</h3>
* <pre>{@code
*
* // Find order additionally fetching the customer, details and details.product name.
*
* String eql = "fetch customer fetch details fetch details.product (name) where id = :orderId ";
*
* Query<Order> query = Ebean.createQuery(Order.class, eql);
* query.setParameter("orderId", 2);
*
* Order order = query.findUnique();
*
* // This is the same as:
*
* Order order = Ebean.find(Order.class)
* .fetch("customer")
* .fetch("details")
* .fetch("detail.product", "name")
* .setId(2)
* .findUnique();
*
* }</pre>
*
* @param beanType The type of bean to fetch
* @param eql The Ebean query
* @param <T> The type of the entity bean
* @return The query with expressions defined as per the parsed query statement
*/
<T> Query<T> createQuery(Class<T> beanType, String eql);
/**
* Create a query for a type of entity bean.
* <p>
@@ -247,6 +298,28 @@ public interface EbeanServer {
*/
<T> Query<T> find(Class<T> beanType);
/**
* Create a query using native SQL.
* <p>
* The native SQL can contain named parameters or positioned parameters.
* </p>
* <pre>{@code
*
* String sql = "select c.id, c.name from customer c where c.name like ? order by c.name";
*
* Query<Customer> query = ebeanServer.findNative(Customer.class, sql);
* query.setParameter(1, "Rob%");
*
* List<Customer> customers = query.findList();
*
* }</pre>
*
* @param beanType The type of entity bean to fetch
* @param nativeSql The SQL that can contain named or positioned parameters
* @return The query to set parameters and execute
*/
<T> Query<T> findNative(Class<T> beanType, String nativeSql);
/**
* Return the next unique identity value for a given bean type.
* <p>
@@ -689,20 +762,38 @@ public interface EbeanServer {
<T> T getReference(Class<T> beanType, Object id);
/**
* Return the number of 'top level' or 'root' entities this query should
* return.
* Return the number of 'top level' or 'root' entities this query should return.
*
* @see Query#findRowCount()
* @see com.avaje.ebean.Query#findFutureRowCount()
* @see Query#findCount()
* @see Query#findFutureCount()
*/
<T> int findRowCount(Query<T> query, Transaction transaction);
<T> int findCount(Query<T> query, Transaction transaction);
/**
* Return the Id values of the query as a List.
*
* @see com.avaje.ebean.Query#findIds()
* @see Query#findIds()
*/
<T> List<Object> findIds(Query<T> query, Transaction transaction);
<A, T> List<A> findIds(Query<T> query, Transaction transaction);
/**
* Return a QueryIterator for the query.
* <p>
* Generally using {@link #findEach(Query, Consumer, Transaction)} or
* {@link #findEachWhile(Query, Predicate, Transaction)} is preferred
* to findIterate(). The reason is that those methods automatically take care of
* closing the queryIterator (and the underlying jdbc statement and resultSet).
* </p>
* <p>
* This is similar to findEach in that not all the result beans need to be held
* in memory at the same time and as such is good for processing large queries.
* </p>
*
* @see Query#findIterate()
* @see Query#findEach(Consumer)
* @see Query#findEachWhile(Predicate)
*/
<T> QueryIterator<T> findIterate(Query<T> query, Transaction transaction);
/**
* Execute the query visiting the each bean one at a time.
@@ -729,10 +820,10 @@ public interface EbeanServer {
*
* }</pre>
*
* @see Query#findEach(QueryEachConsumer)
* @see Query#findEachWhile(QueryEachWhileConsumer)
* @see Query#findEach(Consumer)
* @see Query#findEachWhile(Predicate)
*/
<T> void findEach(Query<T> query, QueryEachConsumer<T> consumer, Transaction transaction);
<T> void findEach(Query<T> query, Consumer<T> consumer, Transaction transaction);
/**
* Execute the query visiting the each bean one at a time.
@@ -766,10 +857,10 @@ public interface EbeanServer {
*
* }</pre>
*
* @see Query#findEach(QueryEachConsumer)
* @see Query#findEachWhile(QueryEachWhileConsumer)
* @see Query#findEach(Consumer)
* @see Query#findEachWhile(Predicate)
*/
<T> void findEachWhile(Query<T> query, QueryEachWhileConsumer<T> consumer, Transaction transaction);
<T> void findEachWhile(Query<T> query, Predicate<T> consumer, Transaction transaction);
/**
* Return versions of a @History entity bean.
@@ -816,9 +907,9 @@ public interface EbeanServer {
* @param query the query to execute the row count on
* @param transaction the transaction (can be null).
* @return a Future object for the row count query
* @see com.avaje.ebean.Query#findFutureRowCount()
* @see com.avaje.ebean.Query#findFutureCount()
*/
<T> FutureRowCount<T> findFutureRowCount(Query<T> query, Transaction transaction);
<T> FutureRowCount<T> findFutureCount(Query<T> query, Transaction transaction);
/**
* Execute find Id's query in a background thread.
@@ -921,7 +1012,39 @@ public interface EbeanServer {
* @return the map of fetched beans.
* @see Query#findMap()
*/
<T> Map<?, T> findMap(Query<T> query, Transaction transaction);
<K, T> Map<K, T> findMap(Query<T> query, Transaction transaction);
/**
* Execute the query returning a list of values for a single property.
* <p>
* <h3>Example 1:</h3>
* <pre>{@code
*
* List<String> names =
* Ebean.find(Customer.class)
* .select("name")
* .orderBy().asc("name")
* .findSingleAttributeList();
*
* }</pre>
* <h3>Example 2:</h3>
* <pre>{@code
*
* List<String> names =
* Ebean.find(Customer.class)
* .setDistinct(true)
* .select("name")
* .where().eq("status", Customer.Status.NEW)
* .orderBy().asc("name")
* .setMaxRows(100)
* .findSingleAttributeList();
*
* }</pre>
*
* @return the list of values for the selected property
* @see Query#findSingleAttributeList()
*/
<A, T> List<A> findSingleAttributeList(Query<T> query, Transaction transaction);
/**
* Execute the query returning at most one entity bean or null (if no matching
@@ -994,7 +1117,7 @@ public interface EbeanServer {
* This streaming type query is useful for large query execution as only 1 row needs to be held in memory.
* </p>
*/
void findEach(SqlQuery query, QueryEachConsumer<SqlRow> consumer, Transaction transaction);
void findEach(SqlQuery query, Consumer<SqlRow> consumer, Transaction transaction);
/**
* Execute the SqlQuery iterating a row at a time with the ability to stop consuming part way through.
@@ -1005,7 +1128,7 @@ public interface EbeanServer {
* This streaming type query is useful for large query execution as only 1 row needs to be held in memory.
* </p>
*/
void findEachWhile(SqlQuery query, QueryEachWhileConsumer<SqlRow> consumer, Transaction transaction);
void findEachWhile(SqlQuery query, Predicate<SqlRow> consumer, Transaction transaction);
/**
* Execute the sql query returning a single MapBean or null.
@@ -36,7 +36,7 @@ public class EbeanServerFactory {
/**
* Initialise the container with clustering configuration.
*
* <p>
* Call this prior to creating any EbeanServer instances or alternatively set the
* ContainerConfig on the ServerConfig when creating the first EbeanServer instance.
*/
@@ -14,44 +14,44 @@ package com.avaje.ebean;
* To get control over the options you can create an ExampleExpression and set
* those options such as case insensitive etc.
* </p>
*
* <pre class="code">
*
* <pre>{@code
* // create an example bean and set the properties
* // with the query parameters you want
* Customer example = new Customer();
* example.setName(&quot;Rob%&quot;);
* example.setNotes(&quot;%something%&quot;);
*
* example.setName("Rob%");
* example.setNotes("%something%");
*
* List&lt;Customer&gt; list =
* Ebean.find(Customer.class)
* .where()
* // pass the bean into the where() clause
* .exampleLike(example)
* // you can add other expressions to the same query
* .gt(&quot;id&quot;, 2)
* .gt("id", 2)
* .findList();
*
* </pre>
*
*
* }</pre>
*
* Similarly you can create an ExampleExpression
*
* <pre>
*
* <pre>{@code
*
* Customer example = new Customer();
* example.setName(&quot;Rob%&quot;);
* example.setNotes(&quot;%something%&quot;);
*
* example.setName("Rob%");
* example.setNotes("%something%");
*
* // create a ExampleExpression with more control
* ExampleExpression qbe = new ExampleExpression(example, true, LikeType.EQUAL_TO)
* .includeZeros();
*
* List&lt;Customer&gt; list =
*
* List<Customer> list =
* Ebean.find(Customer.class)
* .where()
* .add(qbe)
* .findList();
* </pre>
*
* @author Rob Bygrave
*
* }</pre>
*/
public interface ExampleExpression extends Expression {
@@ -90,4 +90,4 @@ public interface ExampleExpression extends Expression {
*/
ExampleExpression useEqualTo();
}
}
+16 -19
View File
@@ -23,20 +23,19 @@ import java.util.Map;
* Creates standard common expressions for using in a Query Where or Having
* clause.
* </p>
*
* <pre class="code">
* // Example: Using an Expr.or() method
* Query&lt;Order&gt; query = Ebean.createQuery(Order.class);
* query.where(
* Expr.or(Expr.eq(&quot;status&quot;, Order.NEW),
* Expr.gt(&quot;orderDate&quot;, lastWeek));
*
* List&lt;Order&gt; list = query.findList();
* <pre>{@code
*
* // Example: Using an Expr.or() method
* Query<Order> query = Ebean.createQuery(Order.class);
* query.where(
* Expr.or(Expr.eq("status", Order.NEW),
* Expr.gt("orderDate", lastWeek));
*
* List<Order> list = query.findList();
* ...
* </pre>
*
* }</pre>
*
* @see Query#where()
* @author Rob Bygrave
*/
public class Expr {
@@ -77,10 +76,10 @@ public class Expr {
* Between - value between two given properties.
*/
public static Expression between(String lowProperty, String highProperty, Object value) {
return Ebean.getExpressionFactory().betweenProperties(lowProperty, highProperty, value);
}
/**
* Greater Than - property greater than the given value.
*/
@@ -142,8 +141,7 @@ public class Expr {
/**
* Create the query by Example expression specifying more options.
*/
public static ExampleExpression exampleLike(Object example, boolean caseInsensitive,
LikeType likeType) {
public static ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType) {
return Ebean.getExpressionFactory().exampleLike(example, caseInsensitive, likeType);
}
@@ -257,9 +255,8 @@ public class Expr {
* Expression where all the property names in the map are equal to the
* corresponding value.
* </p>
*
* @param propertyMap
* a map keyed by property names.
*
* @param propertyMap a map keyed by property names.
*/
public static Expression allEq(Map<String, Object> propertyMap) {
return Ebean.getExpressionFactory().allEq(propertyMap);
@@ -24,20 +24,19 @@ import java.util.Map;
* <p>
* The ExpressionList is returned from {@link Query#where()}.
* </p>
*
* <pre class="code">
* // Example: fetch orders where status equals new or orderDate > lastWeek.
*
* Expression newOrLastWeek =
* Expr.or(Expr.eq(&quot;status&quot;, Order.Status.NEW),
* Expr.gt(&quot;orderDate&quot;, lastWeek));
*
* Query&lt;Order&gt; query = Ebean.createQuery(Order.class);
* <pre>{@code
* // Example: fetch orders where status equals new or orderDate > lastWeek.
*
* Expression newOrLastWeek =
* Expr.or(Expr.eq("status", Order.Status.NEW),
* Expr.gt("orderDate", lastWeek));
*
* Query<Order> query = Ebean.createQuery(Order.class);
* query.where().add(newOrLastWeek);
* List&lt;Order&gt; list = query.findList();
* List<Order> list = query.findList();
* ...
* </pre>
*
* }</pre>
*
* @see Query#where()
*/
public interface ExpressionFactory {
@@ -135,6 +134,11 @@ public interface ExpressionFactory {
*/
Expression ieq(String propertyName, String value);
/**
* Case Insensitive Equal To that allows for named parameter use.
*/
Expression ieqObject(String propertyName, Object value);
/**
* Between - property between the two given values.
*/
@@ -192,6 +196,11 @@ public interface ExpressionFactory {
*/
ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType);
/**
* Like with support for named parameters.
*/
Expression like(String propertyName, Object value, boolean caseInsensitive, LikeType likeType);
/**
* Like - property like value where the value contains the SQL wild card
* characters % (percentage) and _ (underscore).
@@ -272,7 +281,7 @@ public interface ExpressionFactory {
* Exists expression
*/
Expression exists(Query<?> subQuery);
/**
* Not exists expression
*/
@@ -309,9 +318,8 @@ public interface ExpressionFactory {
* Expression where all the property names in the map are equal to the
* corresponding value.
* </p>
*
* @param propertyMap
* a map keyed by property names.
*
* @param propertyMap a map keyed by property names.
*/
Expression allEq(Map<String, Object> propertyMap);
+117 -79
View File
@@ -13,6 +13,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* List of Expressions that make up a where or having clause.
@@ -31,7 +33,7 @@ import java.util.Set;
* more methods than you would initially expect (the ones duplicated from
* Query).
* </p>
*
*
* @see Query#where()
*/
public interface ExpressionList<T> {
@@ -83,14 +85,14 @@ public interface ExpressionList<T> {
/**
* Add an orderBy clause to the query.
*
*
* @see Query#orderBy(String)
*/
Query<T> orderBy(String orderBy);
/**
* Add an orderBy clause to the query.
*
*
* @see Query#orderBy(String)
*/
Query<T> setOrderBy(String orderBy);
@@ -104,7 +106,7 @@ public interface ExpressionList<T> {
* Perform an 'As of' query using history tables to return the object graph
* as of a time in the past.
* <p>
* To perform this query the DB must have underlying history tables.
* To perform this query the DB must have underlying history tables.
* </p>
*
* @param asOf the date time in the past at which you want to view the data
@@ -116,12 +118,6 @@ public interface ExpressionList<T> {
*/
Query<T> asDraft();
/**
* Deprecated in favour of setIncludeSoftDeletes().
*/
@Deprecated
Query<T> includeSoftDeletes();
/**
* Execute the query including soft deleted rows.
*/
@@ -147,34 +143,41 @@ public interface ExpressionList<T> {
*/
int update();
/**
* Execute the query iterating over the results.
*
* @see Query#findIterate()
*/
QueryIterator<T> findIterate();
/**
* Execute the query process the beans one at a time.
*
* @see Query#findEach(QueryEachConsumer)
* @see Query#findEach(Consumer)
*/
void findEach(QueryEachConsumer<T> consumer);
void findEach(Consumer<T> consumer);
/**
* Execute the query processing the beans one at a time with the ability to
* stop processing before reading all the beans.
*
* @see Query#findEachWhile(QueryEachWhileConsumer)
* @see Query#findEachWhile(Predicate)
*/
void findEachWhile(QueryEachWhileConsumer<T> consumer);
void findEachWhile(Predicate<T> consumer);
/**
* Execute the query returning a list.
*
*
* @see Query#findList()
*/
List<T> findList();
/**
* Execute the query returning the list of Id's.
*
*
* @see Query#findIds()
*/
List<Object> findIds();
<A> List<A> findIds();
/**
* Return the count of entities this query should return.
@@ -182,26 +185,53 @@ public interface ExpressionList<T> {
* This is the number of 'top level' or 'root level' entities.
* </p>
*/
int findRowCount();
int findCount();
/**
* Execute the query returning a set.
*
*
* @see Query#findSet()
*/
Set<T> findSet();
/**
* Execute the query returning a map.
*
*
* @see Query#findMap()
*/
Map<?, T> findMap();
<K> Map<K, T> findMap();
/**
* Return a typed map specifying the key property and type.
* Execute the query returning a list of values for a single property.
* <p>
* <h3>Example 1:</h3>
* <pre>{@code
*
* List<String> names =
* Ebean.find(Customer.class)
* .select("name")
* .orderBy().asc("name")
* .findSingleAttributeList();
*
* }</pre>
* <p>
* <h3>Example 2:</h3>
* <pre>{@code
*
* List<String> names =
* Ebean.find(Customer.class)
* .setDistinct(true)
* .select("name")
* .where().eq("status", Customer.Status.NEW)
* .orderBy().asc("name")
* .setMaxRows(100)
* .findSingleAttributeList();
*
* }</pre>
*
* @return the list of values for the selected property
*/
<K> Map<K, T> findMap(String keyProperty, Class<K> keyType);
<A> List<A> findSingleAttributeList();
/**
* Execute the query returning a single bean or null (if no matching
@@ -212,7 +242,6 @@ public interface ExpressionList<T> {
* </p>
*
* @throws NonUniqueResultException if more than one result was found
*
* @see Query#findUnique()
*/
@Nullable
@@ -225,10 +254,10 @@ public interface ExpressionList<T> {
* execution status (isDone etc) and get the value (with or without a
* timeout).
* </p>
*
*
* @return a Future object for the row count query
*/
FutureRowCount<T> findFutureRowCount();
FutureRowCount<T> findFutureCount();
/**
* Execute find Id's query in a background thread.
@@ -237,7 +266,7 @@ public interface ExpressionList<T> {
* execution status (isDone etc) and get the value (with or without a
* timeout).
* </p>
*
*
* @return a Future object for the list of Id's
*/
FutureIds<T> findFutureIds();
@@ -249,7 +278,7 @@ public interface ExpressionList<T> {
* execution status (isDone etc) and get the value (with or without a
* timeout).
* </p>
*
*
* @return a Future object for the list result of the query
*/
FutureList<T> findFutureList();
@@ -264,7 +293,7 @@ public interface ExpressionList<T> {
* If maxRows is not set on the query prior to calling findPagedList() then a
* PersistenceException is thrown.
* </p>
*
* <p>
* <pre>{@code
*
* PagedList<Order> pagedList = Ebean.find(Order.class)
@@ -281,7 +310,6 @@ public interface ExpressionList<T> {
* }</pre>
*
* @return The PagedList
*
* @see Query#findPagedList()
*/
PagedList<T> findPagedList();
@@ -289,8 +317,8 @@ public interface ExpressionList<T> {
/**
* Return versions of a @History entity bean.
* <p>
* Generally this query is expected to be a find by id or unique predicates query.
* It will execute the query against the history returning the versions of the bean.
* Generally this query is expected to be a find by id or unique predicates query.
* It will execute the query against the history returning the versions of the bean.
* </p>
*/
List<Version<T>> findVersions();
@@ -298,8 +326,8 @@ public interface ExpressionList<T> {
/**
* Return versions of a @History entity bean between the 2 timestamps.
* <p>
* Generally this query is expected to be a find by id or unique predicates query.
* It will execute the query against the history returning the versions of the bean.
* Generally this query is expected to be a find by id or unique predicates query.
* It will execute the query against the history returning the versions of the bean.
* </p>
*/
List<Version<T>> findVersionsBetween(Timestamp start, Timestamp end);
@@ -312,7 +340,7 @@ public interface ExpressionList<T> {
/**
* Specify specific properties to fetch on the main/root bean (aka partial
* object).
*
*
* @see Query#select(String)
*/
Query<T> select(String properties);
@@ -335,30 +363,43 @@ public interface ExpressionList<T> {
*/
Query<T> setDistinct(boolean distinct);
/**
* Set the index(es) to search for a document store which uses partitions.
* <p>
* For example, when executing a query against ElasticSearch with daily indexes we can
* explicitly specify the indexes to search against.
* </p>
*
* @param indexName The index or indexes to search against
* @return This query
* @see Query#setDocIndexName(String)
*/
Query<T> setDocIndexName(String indexName);
/**
* Set the first row to fetch.
*
*
* @see Query#setFirstRow(int)
*/
Query<T> setFirstRow(int firstRow);
/**
* Set the maximum number of rows to fetch.
*
*
* @see Query#setMaxRows(int)
*/
Query<T> setMaxRows(int maxRows);
/**
* Set the name of the property which values become the key of a map.
*
*
* @see Query#setMapKey(String)
*/
Query<T> setMapKey(String mapKey);
/**
* Set to true to use the query for executing this query.
*
*
* @see Query#setUseCache(boolean)
*/
Query<T> setUseCache(boolean useCache);
@@ -412,7 +453,6 @@ public interface ExpressionList<T> {
/**
* Path exists - for the given path in a JSON document.
*
* <pre>{@code
*
* where().jsonExists("content", "path.other")
@@ -420,13 +460,12 @@ public interface ExpressionList<T> {
* }</pre>
*
* @param propertyName the property that holds a JSON document
* @param path the nested path in the JSON document in dot notation
* @param path the nested path in the JSON document in dot notation
*/
ExpressionList<T> jsonExists(String propertyName, String path);
/**
* Path does not exist - for the given path in a JSON document.
*
* <pre>{@code
*
* where().jsonNotExists("content", "path.other")
@@ -434,13 +473,13 @@ public interface ExpressionList<T> {
* }</pre>
*
* @param propertyName the property that holds a JSON document
* @param path the nested path in the JSON document in dot notation
* @param path the nested path in the JSON document in dot notation
*/
ExpressionList<T> jsonNotExists(String propertyName, String path);
/**
* Equal to expression for the value at the given path in the JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonEqualTo("content", "path.other", 34)
@@ -448,14 +487,14 @@ public interface ExpressionList<T> {
* }</pre>
*
* @param propertyName the property that holds a JSON document
* @param path the nested path in the JSON document in dot notation
* @param value the value used to test against the document path's value
* @param path the nested path in the JSON document in dot notation
* @param value the value used to test against the document path's value
*/
ExpressionList<T> jsonEqualTo(String propertyName, String path, Object value);
/**
* Not Equal to - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonNotEqualTo("content", "path.other", 34)
@@ -463,14 +502,14 @@ public interface ExpressionList<T> {
* }</pre>
*
* @param propertyName the property that holds a JSON document
* @param path the nested path in the JSON document in dot notation
* @param value the value used to test against the document path's value
* @param path the nested path in the JSON document in dot notation
* @param value the value used to test against the document path's value
*/
ExpressionList<T> jsonNotEqualTo(String propertyName, String path, Object value);
/**
* Greater than - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonGreaterThan("content", "path.other", 34)
@@ -481,7 +520,7 @@ public interface ExpressionList<T> {
/**
* Greater than or equal to - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonGreaterOrEqual("content", "path.other", 34)
@@ -492,7 +531,7 @@ public interface ExpressionList<T> {
/**
* Less than - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonLessThan("content", "path.other", 34)
@@ -503,7 +542,7 @@ public interface ExpressionList<T> {
/**
* Less than or equal to - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonLessOrEqualTo("content", "path.other", 34)
@@ -514,7 +553,7 @@ public interface ExpressionList<T> {
/**
* Between - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonBetween("content", "orderDate", lowerDateTime, upperDateTime)
@@ -528,7 +567,7 @@ public interface ExpressionList<T> {
* <p>
* This returns the list so that add() can be chained.
* </p>
*
* <p>
* <pre>{@code
*
* Query<Customer> query = Ebean.find(Customer.class);
@@ -619,7 +658,7 @@ public interface ExpressionList<T> {
* To get control over the options you can create an ExampleExpression and set
* those options such as case insensitive etc.
* </p>
*
* <p>
* <pre>{@code
*
* // create an example bean and set the properties
@@ -627,26 +666,26 @@ public interface ExpressionList<T> {
* Customer example = new Customer();
* example.setName("Rob%");
* example.setNotes("%something%");
*
*
* List&lt;Customer&gt; list = Ebean.find(Customer.class).where()
* // pass the bean into the where() clause
* .exampleLike(example)
* // you can add other expressions to the same query
* .gt("id", 2).findList();
*
*
* }</pre>
*
* <p>
* Similarly you can create an ExampleExpression
*
* <p>
* <pre>{@code
*
* Customer example = new Customer();
* example.setName("Rob%");
* example.setNotes("%something%");
*
*
* // create a ExampleExpression with more control
* ExampleExpression qbe = new ExampleExpression(example, true, LikeType.EQUAL_TO).includeZeros();
*
*
* List<Customer> list = Ebean.find(Customer.class).where().add(qbe).findList();
*
* }</pre>
@@ -748,7 +787,7 @@ public interface ExpressionList<T> {
* Exists expression
*/
ExpressionList<T> exists(Query<?> subQuery);
/**
* Not exists expression
*/
@@ -775,9 +814,8 @@ public interface ExpressionList<T> {
* Expression where all the property names in the map are equal to the
* corresponding value.
* </p>
*
* @param propertyMap
* a map keyed by property names.
*
* @param propertyMap a map keyed by property names.
*/
ExpressionList<T> allEq(Map<String, Object> propertyMap);
@@ -821,7 +859,7 @@ public interface ExpressionList<T> {
* then they are not translated. logical property name names (not fully
* qualified) will still be translated to their physical name.
* </p>
*
* <p>
* <h4>Example:</h4>
* <pre>{@code
*
@@ -853,7 +891,7 @@ public interface ExpressionList<T> {
* then they are not translated. logical property name names (not fully
* qualified) will still be translated to their physical name.
* </p>
*
* <p>
* <pre>{@code
*
* raw("orderQty < shipQty")
@@ -866,7 +904,7 @@ public interface ExpressionList<T> {
* Add a match expression.
*
* @param propertyName The property name for the match
* @param search The search value
* @param search The search value
*/
ExpressionList<T> match(String propertyName, String search);
@@ -874,14 +912,14 @@ public interface ExpressionList<T> {
* Add a match expression with options.
*
* @param propertyName The property name for the match
* @param search The search value
* @param search The search value
*/
ExpressionList<T> match(String propertyName, String search, Match options);
/**
* Add a multi-match expression.
*/
ExpressionList<T> multiMatch(String search, String... properties);
ExpressionList<T> multiMatch(String search, String... properties);
/**
* Add a multi-match expression using options.
@@ -932,7 +970,7 @@ public interface ExpressionList<T> {
* typically you only explicitly need to use the and() junction
* when it is nested inside an or() or not() junction.
* </p>
*
* <p>
* <pre>{@code
*
* // Example: Nested and()
@@ -957,11 +995,11 @@ public interface ExpressionList<T> {
/**
* Return a list of expressions that will be joined by OR's.
* This is exactly the same as disjunction();
*
* <p>
* Use endOr() or endJunction() to end the OR junction.
* <p>
* Use endOr() or endJunction() to end the OR junction.
* </p>
*
* <p>
* <pre>{@code
*
* // Example: Use or() to join
@@ -988,10 +1026,10 @@ public interface ExpressionList<T> {
/**
* Return a list of expressions that will be wrapped by NOT.
* <p>
* Use endNot() or endJunction() to end expressions being added to the
* NOT expression list.
* Use endNot() or endJunction() to end expressions being added to the
* NOT expression list.
* </p>
*
* <p>
* <pre>@{code
*
* .where()
@@ -1001,7 +1039,7 @@ public interface ExpressionList<T> {
* .endNot()
*
* }</pre>
*
* <p>
* <pre>@{code
*
* // Example: nested not()
+36 -38
View File
@@ -21,48 +21,52 @@ import java.io.Serializable;
* is high (a lot of "Many" beans per "One" bean) then this can be more
* efficient loaded as 2 SQL queries.
* </p>
*
* <p>
* <pre>{@code
* // Normal fetch join results in a single SQL query
* List<Order> list = Ebean.find(Order.class).fetch("details").findList();
*
*
* // Find Orders join details using a single SQL query
* }</pre>
* <p>
* Example: Using a "query join" instead of a "fetch join" we instead use 2 SQL
* queries
* Example: Using a "query join" instead of a "fetch join" we instead use 2 SQL queries
* </p>
*
* <p>
* <pre>{@code
*
* // This will use 2 SQL queries to build this object graph
* List<Order> list =
* Ebean.find(Order.class)
* .fetch("details", new FetchConfig().query())
* .findList();
*
*
* // query 1) find order
* // query 2) find orderDetails where order.id in (?,?...) // first 100 order id's
*
* }</pre>
* <p>
* Example: Using 2 "query joins"
* </p>
*
* <p>
* <pre>{@code
*
* // This will use 3 SQL queries to build this object graph
* List<Order> list =
* Ebean.find(Order.class)
* .fetch("details", new FetchConfig().query())
* .fetch("customer", new FetchConfig().queryFirst(5))
* .findList();
*
*
* // query 1) find order
* // query 2) find orderDetails where order.id in (?,?...) // first 100 order id's
* // query 3) find customer where id in (?,?,?,?,?) // first 5 customers
*
* }</pre>
* <p>
* Example: Using "query joins" and partial objects
* </p>
*
* <p>
*
* <pre>{@code
* // This will use 3 SQL queries to build this object graph
* List<Order> list =
@@ -74,13 +78,13 @@ import java.io.Serializable;
* .fetch("customer.contacts")
* .fetch("customer.shippingAddress")
* .findList();
*
*
* // query 1) find order (status, shipDate)
* // query 2) find orderDetail (quantity, price) fetch product (sku, name) where
* // order.id in (?,? ...)
* // query 3) find customer (name) fetch contacts (*) fetch shippingAddress (*)
* // where id in (?,?,?,?,?)
*
*
* // Note: the fetch of "details.product" is automatically included into the
* // fetch of "details"
* //
@@ -92,20 +96,21 @@ import java.io.Serializable;
* immediately and the lazy defines the batch size to use for further lazy
* loading (if lazy loading is invoked).
* </p>
*
* <p>
* <pre>{@code
*
* List<Order> list =
* Ebean.find(Order.class)
* .fetch("customer", new FetchConfig().query(10).lazy(5))
* .findList();
*
*
* // query 1) find order
* // query 2) find customer where id in (?,?,?,?,?,?,?,?,?,?) // first 10 customers
* // .. then if lazy loading of customers is invoked
* // .. use a batch size of 5 to load the customers
*
*
* }</pre>
*
* <p>
* <p>
* Example of controlling the lazy loading query:
* </p>
@@ -113,27 +118,23 @@ import java.io.Serializable;
* This gives us the ability to optimise the lazy loading query for a given use
* case.
* </p>
*
* <p>
* <pre>{@code
*
* List<Order> list = Ebean.find(Order.class)
* .fetch("customer","name", new FetchConfig().lazy(5))
* .fetch("customer.contacts",&quotcontactName, phone, email&quot)
* .fetch("customer.contacts","contactName, phone, email")
* .fetch("customer.shippingAddress")
* .where().eq("status",Order.Status.NEW)
* .findList();
*
*
* // query 1) find order where status = Order.Status.NEW
* //
* // .. if lazy loading of customers is invoked
* // .. use a batch size of 5 to load the customers
*
* find customer (name)
* fetch customer.contacts (contactName, phone, email)
* fetch customer.shippingAddress (*)
* where id in (?,?,?,?,?)
*
* //
* // .. if lazy loading of customers is invoked
* // .. use a batch size of 5 to load the customers
*
* }</pre>
*
*
* @author mario
* @author rbygrave
*/
@@ -165,9 +166,8 @@ public class FetchConfig implements Serializable {
/**
* Specify that this path should be lazy loaded with a specified batch size.
*
* @param lazyBatchSize
* the batch size for lazy loading
*
* @param lazyBatchSize the batch size for lazy loading
*/
public FetchConfig lazy(int lazyBatchSize) {
this.lazyBatchSize = lazyBatchSize;
@@ -199,9 +199,8 @@ public class FetchConfig implements Serializable {
* This will load all beans on this path eagerly unless a {@link #lazy(int)}
* is also used.
* </p>
*
* @param queryBatchSize
* the batch size used to load beans on this path
*
* @param queryBatchSize the batch size used to load beans on this path
*/
public FetchConfig query(int queryBatchSize) {
this.queryBatchSize = queryBatchSize;
@@ -217,9 +216,8 @@ public class FetchConfig implements Serializable {
* If there are more parent beans than the batch size then they will not be
* loaded eagerly but instead use lazy loading.
* </p>
*
* @param queryBatchSize
* the number of parent beans this path is populated for
*
* @param queryBatchSize the number of parent beans this path is populated for
*/
public FetchConfig queryFirst(int queryBatchSize) {
this.queryBatchSize = queryBatchSize;
@@ -233,7 +231,7 @@ public class FetchConfig implements Serializable {
public int getLazyBatchSize() {
return lazyBatchSize;
}
/**
* Return the batch size for separate query load.
*/
+38 -39
View File
@@ -19,64 +19,63 @@ import java.util.Set;
* The result of the filter method will leave the original list unmodified and
* return a new List instance.
* </p>
*
* <pre class="code">
*
* <p>
* <pre>{@code
*
* // get a list of entities (query execution statistics in this case)
*
* List&lt;MetaQueryStatistic&gt; list =
*
* List<MetaQueryStatistic> list =
* Ebean.find(MetaQueryStatistic.class).findList();
*
*
* long nowMinus24Hrs = System.currentTimeMillis() - 24 * (1000 * 60 * 60);
*
*
* // sort and filter the list returning a filtered list...
*
* List&lt;MetaQueryStatistic&gt; filteredList =
*
* List<MetaQueryStatistic> filteredList =
* Ebean.filter(MetaQueryStatistic.class)
* .sort(&quot;avgTimeMicros desc&quot;)
* .gt(&quot;executionCount&quot;, 0)
* .gt(&quot;lastQueryTime&quot;, nowMinus24Hrs)
* .eq(&quot;autoTuned&quot;, true)
* .sort("avgTimeMicros desc")
* .gt("executionCount", 0)
* .gt("lastQueryTime", nowMinus24Hrs)
* .eq("autoTuned", true)
* .maxRows(10)
* .filter(list);
*
* </pre>
*
* }</pre>
* <p>
* The propertyNames can traverse the object graph (e.g. customer.name) by using
* dot notation. If any point during the object graph traversal to get a
* property value is null then null is returned.
* </p>
*
* <pre>
* // examples of property names that
* <p>
* <pre>{@code
*
* // examples of property names that
* // ... will traverse the object graph
* // ... where customer is a property of our bean
*
*
* customer.name
* customer.shippingAddress.city
* </pre>
*
* </p>
*
* <pre class="code">
*
*
* }</pre>
* <p>
* <pre>{@code
*
* // get a list of entities (query execution statistics)
*
* List&lt;Order&gt; orders =
*
* List<Order> orders =
* Ebean.find(Order.class).findList();
*
*
* // Apply a filter...
*
* List&lt;Order&gt; filteredOrders =
*
* List<Order> filteredOrders =
* Ebean.filter(Order.class)
* .startsWith(&quot;customer.name&quot;, &quot;Rob&quot;)
* .eq(&quot;customer.shippingAddress.city&quot;, &quot;Auckland&quot;)
* .startsWith("customer.name", "Rob")
* .eq("customer.shippingAddress.city", "Auckland")
* .filter(orders);
*
* </pre>
*
* @param <T>
* the entity bean type
*
* }</pre>
*
* @param <T> the entity bean type
*/
public interface Filter<T> {
@@ -189,9 +188,9 @@ public interface Filter<T> {
* <p>
* The sourceList will remain unmodified.
* </p>
*
*
* @return Returns a new list with the sorting and filters applied.
*/
List<T> filter(List<T> sourceList);
}
}
+10 -11
View File
@@ -11,11 +11,10 @@ import java.util.List;
* These 'finders' are a place to organise all the finder methods for that bean type
* and specific finder methods are expected to be added (find by unique properties etc).
* </p>
*
* <h3>Testing</h3>
* <p>
* For testing the mocki-ebean project has the ability to replace the finder implementation
*
* For testing the mocki-ebean project has the ability to replace the finder implementation
* <p>
* </p>
* <pre>{@code
*
@@ -61,7 +60,6 @@ public class Finder<I, T> {
/**
* Create with the type of the entity bean.
*
* <pre>{@code
*
* public class CustomerFinder extends Finder<Customer> {
@@ -96,10 +94,8 @@ public class Finder<I, T> {
/**
* Return the underlying 'default' EbeanServer.
*
* <p>
* This provides full access to the API such as explicit transaction demarcation etc.
*
*/
public EbeanServer db() {
return Ebean.getServer(serverName);
@@ -110,9 +106,8 @@ public class Finder<I, T> {
* <p>
* This is equivalent to {@link Ebean#getServer(String)}
*
* @param server
* The name of the EbeanServer. If this is null then the default EbeanServer is
* returned.
* @param server The name of the EbeanServer. If this is null then the default EbeanServer is
* returned.
*/
public EbeanServer db(String server) {
return Ebean.getServer(server);
@@ -120,7 +115,6 @@ public class Finder<I, T> {
/**
* Creates an entity reference for this ID.
*
* <p>
* Equivalent to {@link EbeanServer#getReference(Class, Object)}
*/
@@ -130,7 +124,6 @@ public class Finder<I, T> {
/**
* Retrieves an entity by ID.
*
* <p>
* Equivalent to {@link EbeanServer#find(Class, Object)}
*/
@@ -164,4 +157,10 @@ public class Finder<I, T> {
return db().find(type);
}
/**
* Creates a native sql query.
*/
public Query<T> nativeSql(String nativeSql) {
return db().findNative(type, nativeSql);
}
}
@@ -9,8 +9,6 @@ import java.util.concurrent.Future;
* It extends the java.util.concurrent.Future with the ability to get the Id's
* while the query is still executing in the background.
* </p>
*
* @author rbygrave
*/
public interface FutureIds<T> extends Future<List<Object>> {
@@ -19,16 +17,4 @@ public interface FutureIds<T> extends Future<List<Object>> {
*/
Query<T> getQuery();
/**
* Return the list of Id's which could be partially populated.
* <p>
* That is the query getting the id's could still be running and adding id's
* to this list.
* </p>
* <p>
* To get the list of Id's ensuring the query has finished use the
* {@link Future#get()} method instead of this one.
* </p>
*/
List<Object> getPartialIds();
}
+8 -11
View File
@@ -17,31 +17,30 @@ import java.util.concurrent.TimeoutException;
* <p>
* A simple example:
* </p>
*
* <pre>{@code
*
* // create a query to find all orders
* Query<Order> query = Ebean.find(Order.class);
*
*
* // execute the query in a background thread
* // immediately returning the futureList
* FutureList<Order> futureList = query.findFutureList();
*
* // do something else ...
*
*
* // do something else ...
*
* if (!futureList.isDone()){
* // we can cancel the query execution. This will cancel
* // the underlying query if that is supported by the JDBC
* // driver and database
* futureList.cancel(true);
* }
*
*
*
* if (!futureList.isCancelled()){
* // wait for the query to finish and return the list
* List<Order> list = futureList.get();
* ...
* }
*
*
* }</pre>
*/
public interface FutureList<T> extends Future<List<T>> {
@@ -56,7 +55,6 @@ public interface FutureList<T> extends Future<List<T>> {
* unchecked PersistenceException.
*
* @return The query list result
*
* @throws PersistenceException when a InterruptedException or ExecutionException occurs.
*/
List<T> getUnchecked();
@@ -66,8 +64,7 @@ public interface FutureList<T> extends Future<List<T>> {
* and ExecutionException in the unchecked PersistenceException.
*
* @return The query list result
*
* @throws TimeoutException if the wait timed out
* @throws TimeoutException if the wait timed out
* @throws PersistenceException if a InterruptedException or ExecutionException occurs.
*/
List<T> getUnchecked(long timeout, TimeUnit unit) throws TimeoutException;
@@ -8,7 +8,8 @@ import java.util.concurrent.Future;
* <p>
* It extends the java.util.concurrent.Future.
* </p>
*
*
* @param <T> the BeanType
* @author rbygrave
*/
public interface FutureRowCount<T> extends Future<Integer> {
+28 -16
View File
@@ -9,7 +9,6 @@ package com.avaje.ebean;
* <p>
* Note: where() always takes you to the top level WHERE expression list.
* </p>
*
* <pre>{@code
* Query q =
* Ebean.find(Person.class)
@@ -23,13 +22,13 @@ package com.avaje.ebean;
*
* // read as...
* // where ( ((name like Rob%) or (status = NEW)) AND (id &gt; 10) )
* }</pre>
*
* }</pre>
* <p>
* Note: endJunction() takes you to the parent expression list
* </p>
*
* <pre>{@code
*
* Query q =
* Ebean.find(Person.class)
* .where()
@@ -46,11 +45,9 @@ package com.avaje.ebean;
* // read as...
* // where ( ((name like Rob%) or (status = NEW)) AND (id > 10) )
* }</pre>
*
* <p>
* Example of a nested disjunction.
* </p>
*
* <pre>{@code
* Query<Customer> q =
* Ebean.find(Customer.class)
@@ -59,11 +56,11 @@ package com.avaje.ebean;
* .and()
* .startsWith("name", "r")
* .eq("anniversary", onAfter)
* .endJunction()
* .endAnd()
* .and()
* .eq("status", Customer.Status.ACTIVE)
* .gt("id", 0)
* .endJunction()
* .endAnd()
* .order().asc("name");
*
* q.findList();
@@ -84,39 +81,46 @@ public interface Junction<T> extends Expression, ExpressionList<T> {
/**
* AND group.
*/
AND(" and ", ""),
AND(" and ", "", false),
/**
* OR group.
*/
OR(" or ", ""),
OR(" or ", "", false),
/**
* NOT group.
*/
NOT(" and ", "not "),
NOT(" and ", "not ", false),
/**
* FILTER group (for internal use only).
*/
FILTER("filter", "", true),
/**
* Text search AND group.
*/
MUST("must", ""),
MUST("must", "", true),
/**
* Text search NOT group.
*/
MUST_NOT("must_not", ""),
MUST_NOT("must_not", "", true),
/**
* Text search OR group.
*/
SHOULD("should", "");
SHOULD("should", "", true);
String prefix;
String literal;
private String prefix;
private String literal;
private boolean text;
Type(String literal, String prefix) {
Type(String literal, String prefix, boolean text) {
this.literal = literal;
this.prefix = prefix;
this.text = text;
}
/**
@@ -132,6 +136,14 @@ public interface Junction<T> extends Expression, ExpressionList<T> {
public String prefix() {
return prefix;
}
/**
* Return true if this is a text type.
*/
public boolean isText() {
return text;
}
}
}
+24 -640
View File
@@ -1,43 +1,32 @@
package com.avaje.ebean;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.util.ClassUtil;
import org.jetbrains.annotations.Nullable;
import javax.persistence.MappedSuperclass;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/**
* A MappedSuperclass base class that provides convenience methods for inserting, updating and
* deleting beans.
*
* <p>
* By having your entity beans extend this it provides a 'Active Record' style programming model for
* Ebean users.
*
* <p>
* Note that there is a avaje-ebeanorm-mocker project that enables you to use Mockito or similar
* Note that there is a ebean-mocker project that enables you to use Mockito or similar
* tools to still mock out the underlying 'default EbeanServer' for testing purposes.
*
* <p>
* You may choose not use this Model mapped superclass if you don't like the 'Active Record' style
* or if you believe it 'pollutes' your entity beans.
*
* <p>
* You can use Dependency Injection like Guice or Spring to construct and wire a EbeanServer instance
* and have that same instance used with this Model and Finder. The way that works is that when the
* DI container creates the EbeanServer instance it can be registered with the Ebean singleton. In this
* way the EbeanServer instance can be injected as per normal Guice / Spring dependency injection and
* that same instance also used to support the Model and Finder active record style.
*
* <p>
* If you choose to use the Model mapped superclass you will probably also chose to additionally add
* a {@link Find} as a public static field to complete the active record pattern and provide a
* a {@link Finder} as a public static field to complete the active record pattern and provide a
* relatively nice clean way to write queries.
*
* <p>
* <h3>Typical common @MappedSuperclass</h3>
* <pre>{@code
*
@@ -51,34 +40,28 @@ import java.util.UUID;
*
* @Version Long version;
*
* @CreatedTimestamp Timestamp whenCreated;
* @WhenCreated Timestamp whenCreated;
*
* @UpdatedTimestamp Timestamp whenUpdated;
* @WhenUpdated Timestamp whenUpdated;
*
* ...
*
* }</pre>
*
* <p>
* <h3>Extend the Model</h3>
* <pre>{@code
*
* // Extend the mappedSuperclass
*
* @Entity @Table(name="oto_account")
* @Entity @Table(name="o_account")
* public class Customer extends BaseModel {
*
* // Add a static Find
* // ... with Long being the type of our @Id property.
* // ... Note the {} at the end as Find is an abstract class.
*
* public static final Find<Long,Account> find = new Find<Long,Account>(){};
*
* String name;
* ...
* }
*
* }</pre>
*
* <p>
* <h3>Modal: save()</h3>
* <pre>{@code
*
@@ -90,64 +73,43 @@ import java.util.UUID;
* customer.save();
*
* }</pre>
*
* <h3>Find byId</h3>
* <pre>{@code
*
* // find byId
* Customer customer = Customer.find.byId(42);
*
* }</pre>
*
* <h3>Find where</h3>
* <pre>{@code
*
* // find where ...
* List<Customer> customers =
* Customer.find
* .where().gt("startDate", lastMonth)
* .findList();
*
* }</pre>
*/
@MappedSuperclass
public abstract class Model {
/**
* Return the underlying 'default' EbeanServer.
*
* <p>
* This provides full access to the API such as explicit transaction demarcation etc.
*
* <p>
* Example:
* <pre>{@code
*
* Transaction transaction = Customer.db().beginTransaction();
* try {
*
*
* // turn off cascade persist for this transaction
* transaction.setPersistCascade(false);
*
*
* // extra control over jdbc batching for this transaction
* transaction.setBatchGetGeneratedKeys(false);
* transaction.setBatchMode(true);
* transaction.setBatchSize(20);
*
*
* Customer customer = new Customer();
* customer.setName(&quot;Roberto&quot;);
* customer.save();
*
*
* Customer otherCustomer = new Customer();
* otherCustomer.setName("Franko");
* otherCustomer.save();
*
*
* transaction.commit();
*
*
* } finally {
* transaction.end();
* }
*
*
* }</pre>
*/
public static EbeanServer db() {
@@ -156,13 +118,11 @@ public abstract class Model {
/**
* Return a named EbeanServer that is typically different to the default server.
*
* <p>
* If you are using multiple databases then each database has a name and maps to a single
* EbeanServer. You can use this method to get an EbeanServer for another database.
*
* @param server
* The name of the EbeanServer. If this is null then the default EbeanServer is returned.
*
* @param server The name of the EbeanServer. If this is null then the default EbeanServer is returned.
*/
public static EbeanServer db(String server) {
return Ebean.getServer(server);
@@ -176,16 +136,16 @@ public abstract class Model {
* <p>
* An unmodified bean that is saved or updated is normally skipped and this marks the bean as
* dirty so that it is not skipped.
*
* <p>
* <pre>{@code
*
*
* Customer customer = Customer.find.byId(id);
*
*
* // mark the bean as dirty so that a save() or update() will
* // increment the version property
* customer.markAsDirty();
* customer.save();
*
*
* }</pre>
*
* @see EbeanServer#markAsDirty(Object)
@@ -197,7 +157,7 @@ public abstract class Model {
/**
* Mark the property as unset or 'not loaded'.
* <p>
* This would be used to specify a property that we did not wish to include in a stateless update.
* This would be used to specify a property that we did not wish to include in a stateless update.
* </p>
* <pre>{@code
*
@@ -215,12 +175,11 @@ public abstract class Model {
* @param propertyName the name of the property on the bean to be marked as 'unset'
*/
public void markPropertyUnset(String propertyName) {
((EntityBean)this)._ebean_getIntercept().setPropertyLoaded(propertyName, false);
((EntityBean) this)._ebean_getIntercept().setPropertyLoaded(propertyName, false);
}
/**
* Insert or update this entity depending on its state.
*
* <p>
* Ebean will detect if this is a new bean or a previously fetched bean and perform either an
* insert or an update based on that.
@@ -313,579 +272,4 @@ public abstract class Model {
db().refresh(this);
}
/**
* A concrete implementation of Find.
* <p>
* It should be preferred to use {@link Find} instead of Finder as that can use reflection to determine the class
* literal type of the entity bean.
* </p>
* @param <I> type of the Id property
* @param <T> type of the entity bean
*/
public static class Finder<I, T> extends Find<I, T> {
/**
* Create with the type of the entity bean.
*
* <pre>{@code
*
* @Entity
* public class Customer extends BaseModel {
*
* public static final Finder<Long,Customer> find = new Finder<Long,Customer>(Customer.class);
* ...
*
* }</pre>
*
* <p/>
* The preferred approach is to instead use <code>Find</code> as below. This approach is more DRY in that it does
* not require the class literal Customer.class to be passed into the constructor.
*
* <pre>{@code
*
* @Entity
* public class Customer extends BaseModel {
*
* public static final Find<Long,Customer> find = new Find<Long,Customer>(){};
* ...
*
* }</pre>
*/
public Finder(Class<T> type) {
super(null, type);
}
/**
* Create with the type of the entity bean and specific server name.
*/
public Finder(String serverName, Class<T> type) {
super(serverName, type);
}
}
/**
* Helper object for performing queries.
*
* <p>
* Typically a Find instance is defined as a public static field on an entity bean class to provide a
* nice way to write queries.
*
* <h3>Example use:</h3>
*
* <pre>{@code
*
* @Entity
* public class Customer extends BaseModel {
*
* public static final Find<Long,Customer> find = new Find<Long,Customer>(){};
*
* ...
*
* }</pre>
* <p/>
* This enables you to write code like:
* <pre>{@code
*
* Customer customer = Customer.find.byId(42L);
*
* List<Customer> customers =
* Customer.find
* .select("name, dateOfBirth")
* .findList();
*
* }</pre>
*
* <h3>Kotlin</h3>
* In Kotlin you would typically create Find as a companion object.
* <pre>{@code
*
* // kotlin
* companion object : Model.Find<Long, Product>() {}
*
* }</pre>
* @param <I>
* The Id type. This is most often a {@link Long} but is also often a {@link UUID} or
* {@link String}.
*
* @param <T>
* The entity bean type
*/
public static abstract class Find<I, T> {
/**
* The entity bean type.
*/
private final Class<T> type;
/**
* The name of the EbeanServer, null for the default server.
*/
private final String serverName;
/**
* Creates a finder for entity of type <code>T</code> with ID of type <code>I</code>.
* <p/>
* Typically you create Find as a public static field on each entity bean as the example below.
*
* <p/>
* Note that Find is an abstract class and hence <code>{}</code> is required. This is done so
* that the type (class literal) of the entity bean can be derived from the generics parameter.
*
* <pre>{@code
*
* @Entity
* public class Customer extends BaseModel {
*
* // Note the trailing {} as Find is an abstract class.
* // We do this so that we can derive the type literal Customer.class
* // via reflection
* public static final Find<Long,Customer> find = new Find<Long,Customer>(){};
* ...
*
* }</pre>
* <p/>
* This enables you to write code like:
* <pre>{@code
*
* Customer customer = Customer.find.byId(42L);
*
* List<Customer> customers =
* Customer.find
* .select("name, email, dateOfBirth")
* .findList();
*
* }</pre>
*
* <h3>Kotlin</h3>
* In Kotlin you would typically create it as a companion object.
*
* <pre>{@code
*
* // kotlin
* companion object : Model.Find<Long, Product>() {}
*
* }</pre>
*/
@SuppressWarnings("unchecked")
public Find() {
this.serverName = null;
this.type = (Class<T>)ClassUtil.getSecondArgumentType(getClass());
}
/**
* Construct passing the class literal type of the entity type.
*/
protected Find(String serverName, Class<T> type) {
this.serverName = serverName;
this.type = type;
}
/**
* Return the underlying 'default' EbeanServer.
*
* <p>
* This provides full access to the API such as explicit transaction demarcation etc.
*
*/
public EbeanServer db() {
return Ebean.getServer(serverName);
}
/**
* Return typically a different EbeanServer to the default.
* <p>
* This is equivilent to {@link Ebean#getServer(String)}
*
* @param server
* The name of the EbeanServer. If this is null then the default EbeanServer is
* returned.
*/
public EbeanServer db(String server) {
return Ebean.getServer(server);
}
/**
* Creates a Finder for the named EbeanServer.
*
* <p>
* Create and return a new Finder for a different server.
*/
public Finder<I, T> on(String server) {
return new Finder<I, T>(server, type);
}
/**
* Delete a bean by Id.
* <p>
* Equivalent to {@link EbeanServer#delete(Class, Object)}
*/
public void deleteById(I id) {
db().delete(type, id);
}
/**
* Retrieves all entities of the given type.
*
* <p>
* This is the same as (synonym for) {@link #findList()}
*/
public List<T> all() {
return findList();
}
/**
* Retrieves an entity by ID.
*
* <p>
* Equivalent to {@link EbeanServer#find(Class, Object)}
*/
@Nullable
public T byId(I id) {
return db().find(type, id);
}
/**
* Creates an entity reference for this ID.
*
* <p>
* Equivalent to {@link EbeanServer#getReference(Class, Object)}
*/
public T ref(I id) {
return db().getReference(type, id);
}
/**
* Creates a filter for sorting and filtering lists of entities locally without going back to
* the database.
* <p>
* Equivalent to {@link EbeanServer#filter(Class)}
*/
public Filter<T> filter() {
return db().filter(type);
}
/**
* Creates a query.
* <p>
* Equivalent to {@link EbeanServer#find(Class)}
*/
public Query<T> query() {
return db().find(type);
}
/**
* Creates a query applying the path properties to set the select and fetch clauses.
* <p>
* Equivalent to {@link Query#apply(FetchPath)}
*/
public Query<T> apply(FetchPath fetchPath) {
return db().find(type).apply(fetchPath);
}
/**
* Returns the next identity value.
*
* @see EbeanServer#nextId(Class)
*/
@SuppressWarnings("unchecked")
public I nextId() {
return (I) db().nextId(type);
}
/**
* Executes a query and returns the results as a list of IDs.
* <p>
* Equivalent to {@link Query#findIds()}
*/
public List<Object> findIds() {
return query().findIds();
}
/**
* Execute the query consuming each bean one at a time.
* <p>
* This is generally used to process large queries where unlike findList
* you do not want to hold all the results in memory at once but instead
* process them one at a time (requiring far less memory).
* </p>
* Equivalent to {@link Query#findEach(QueryEachConsumer)}
*/
public void findEach(QueryEachConsumer<T> consumer) {
query().findEach(consumer);
}
/**
* Execute the query consuming each bean one at a time.
* <p>
* Equivalent to {@link Query#findEachWhile(QueryEachWhileConsumer)}
* <p>
* This is similar to #findEach except that you return boolean
* true to continue processing beans and return false to stop
* processing early.
* </p>
* <p>
* This is generally used to process large queries where unlike findList
* you do not want to hold all the results in memory at once but instead
* process them one at a time (requiring far less memory).
* </p>
* Equivalent to {@link Query#findEachWhile(QueryEachWhileConsumer)}
*/
public void findEachWhile(QueryEachWhileConsumer<T> consumer) {
query().findEachWhile(consumer);
}
/**
* Retrieves all entities of the given type.
* <p>
* The same as {@link #all()}
* <p>
* Equivalent to {@link Query#findList()}
*/
public List<T> findList() {
return query().findList();
}
/**
* Returns all the entities of the given type as a set.
* <p>
* Equivalent to {@link Query#findSet()}
*/
public Set<T> findSet() {
return query().findSet();
}
/**
* Retrieves all entities of the given type as a map of objects.
* <p>
* Equivalent to {@link Query#findMap()}
*/
public Map<?, T> findMap() {
return query().findMap();
}
/**
* Executes the query and returns the results as a map of the objects specifying the map key
* property.
* <p>
* Equivalent to {@link Query#findMap(String, Class)}
*/
public <K> Map<K, T> findMap(String keyProperty, Class<K> keyType) {
return query().findMap(keyProperty, keyType);
}
/**
* Executes a find row count query in a background thread.
* <p>
* Equivalent to {@link Query#findFutureRowCount()}
*/
public FutureRowCount<T> findFutureRowCount() {
return query().findFutureRowCount();
}
/**
* Returns the total number of entities for this type. *
* <p>
* Equivalent to {@link Query#findRowCount()}
*/
public int findRowCount() {
return query().findRowCount();
}
/**
* Returns the <code>ExpressionFactory</code> used by this query.
*/
public ExpressionFactory getExpressionFactory() {
return query().getExpressionFactory();
}
/**
* Explicitly sets a comma delimited list of the properties to fetch on the 'main' entity bean,
* to load a partial object.
* <p>
* Equivalent to {@link Query#select(String)}
*/
public Query<T> select(String fetchProperties) {
return query().select(fetchProperties);
}
/**
* Specifies a path to load including all its properties.
* <p>
* Equivalent to {@link Query#fetch(String)}
*/
public Query<T> fetch(String path) {
return query().fetch(path);
}
/**
* Additionally specifies a <code>FetchConfig</code> to specify a 'query join' and/or define the
* lazy loading query.
* <p>
* Equivalent to {@link Query#fetch(String, FetchConfig)}
*/
public Query<T> fetch(String path, FetchConfig joinConfig) {
return query().fetch(path, joinConfig);
}
/**
* Specifies a path to fetch with a specific list properties to include, to load a partial
* object.
* <p>
* Equivalent to {@link Query#fetch(String, String)}
*/
public Query<T> fetch(String path, String fetchProperties) {
return query().fetch(path, fetchProperties);
}
/**
* Additionally specifies a <code>FetchConfig</code> to use a separate query or lazy loading to
* load this path.
* <p>
* Equivalent to {@link Query#fetch(String, String, FetchConfig)}
*/
public Query<T> fetch(String assocProperty, String fetchProperties, FetchConfig fetchConfig) {
return query().fetch(assocProperty, fetchProperties, fetchConfig);
}
/**
* Adds expressions to the <code>where</code> clause with the ability to chain on the
* <code>ExpressionList</code>.
* <p>
* Equivalent to {@link Query#where()}
*/
public ExpressionList<T> where() {
return query().where();
}
/**
* Returns the <code>order by</code> clause so that you can append an ascending or descending
* property to the <code>order by</code> clause.
* <p>
* This is exactly the same as {@link #orderBy}.
* <p>
* Equivalent to {@link Query#order()}
*/
public OrderBy<T> order() {
return query().order();
}
/**
* Sets the <code>order by</code> clause, replacing the existing <code>order by</code> clause if
* there is one.
* <p>
* This is exactly the same as {@link #orderBy(String)}.
*/
public Query<T> order(String orderByClause) {
return query().order(orderByClause);
}
/**
* Returns the <code>order by</code> clause so that you can append an ascending or descending
* property to the <code>order by</code> clause.
* <p>
* This is exactly the same as {@link #order}.
* <p>
* Equivalent to {@link Query#orderBy()}
*/
public OrderBy<T> orderBy() {
return query().orderBy();
}
/**
* Set the <code>order by</code> clause replacing the existing <code>order by</code> clause if
* there is one.
* <p>
* This is exactly the same as {@link #order(String)}.
*/
public Query<T> orderBy(String orderByClause) {
return query().orderBy(orderByClause);
}
/**
* Sets the first row to return for this query.
* <p>
* Equivalent to {@link Query#setFirstRow(int)}
*/
public Query<T> setFirstRow(int firstRow) {
return query().setFirstRow(firstRow);
}
/**
* Sets the maximum number of rows to return in the query.
* <p>
* Equivalent to {@link Query#setMaxRows(int)}
*/
public Query<T> setMaxRows(int maxRows) {
return query().setMaxRows(maxRows);
}
/**
* Sets the ID value to query.
*
* <p>
* Use this to perform a find byId query but with additional control over the query such as
* using select and fetch to control what parts of the object graph are returned.
* <p>
* Equivalent to {@link Query#setId(Object)}
*/
public Query<T> setId(Object id) {
return query().setId(id);
}
/**
* Create and return a new query based on the <code>RawSql</code>.
* <p>
* Equivalent to {@link Query#setRawSql(RawSql)}
*/
public Query<T> setRawSql(RawSql rawSql) {
return query().setRawSql(rawSql);
}
/**
* Create a query with explicit 'AutoTune' use.
*/
public Query<T> setAutoTune(boolean autoTune) {
return query().setAutoTune(autoTune);
}
/**
* Create a query with the select with "for update" specified.
*
* <p>
* This will typically create row level database locks on the selected rows.
*/
public Query<T> setForUpdate(boolean forUpdate) {
return query().setForUpdate(forUpdate);
}
/**
* Create a query specifying whether the returned beans will be read-only.
*/
public Query<T> setReadOnly(boolean readOnly) {
return query().setReadOnly(readOnly);
}
/**
* Create a query specifying if the beans should be loaded into the L2 cache.
*/
public Query<T> setLoadBeanCache(boolean loadBeanCache) {
return query().setLoadBeanCache(loadBeanCache);
}
/**
* Create a query specifying if the L2 bean cache should be used.
*/
public Query<T> setUseCache(boolean useBeanCache) {
return query().setUseCache(useBeanCache);
}
/**
* Create a query specifying if the L2 query cache should be used.
*/
public Query<T> setUseQueryCache(boolean useQueryCache) {
return query().setUseQueryCache(useQueryCache);
}
}
}
}
+35 -27
View File
@@ -28,9 +28,9 @@ public final class OrderBy<T> implements Serializable {
* Create an empty OrderBy with no associated query.
*/
public OrderBy() {
this.list = new ArrayList<Property>(3);
this.list = new ArrayList<>(3);
}
private OrderBy(List<Property> list) {
this.list = list;
}
@@ -52,7 +52,7 @@ public final class OrderBy<T> implements Serializable {
*/
public OrderBy(Query<T> query, String orderByClause) {
this.query = query;
this.list = new ArrayList<Property>(3);
this.list = new ArrayList<>(3);
parse(orderByClause);
}
@@ -60,8 +60,8 @@ public final class OrderBy<T> implements Serializable {
* Reverse the ascending/descending order on all the properties.
*/
public void reverse() {
for (int i = 0; i < list.size(); i++) {
list.get(i).reverse();
for (Property aList : list) {
aList.reverse();
}
}
@@ -88,8 +88,8 @@ public final class OrderBy<T> implements Serializable {
*/
public boolean containsProperty(String propertyName) {
for (int i = 0; i < list.size(); i++) {
if (propertyName.equals(list.get(i).getProperty())) {
for (Property aList : list) {
if (propertyName.equals(aList.getProperty())) {
return true;
}
}
@@ -100,13 +100,13 @@ public final class OrderBy<T> implements Serializable {
* Return a copy of this OrderBy with the path trimmed.
*/
public OrderBy<T> copyWithTrim(String path) {
List<Property> newList = new ArrayList<Property>(list.size());
for (int i = 0; i < list.size(); i++) {
newList.add(list.get(i).copyWithTrim(path));
List<Property> newList = new ArrayList<>(list.size());
for (Property aList : list) {
newList.add(aList.copyWithTrim(path));
}
return new OrderBy<T>(newList);
return new OrderBy<>(newList);
}
/**
* Return the properties for this OrderBy.
*/
@@ -141,13 +141,20 @@ public final class OrderBy<T> implements Serializable {
*/
public OrderBy<T> copy() {
OrderBy<T> copy = new OrderBy<T>();
for (int i = 0; i < list.size(); i++) {
copy.add(list.get(i).copy());
OrderBy<T> copy = new OrderBy<>();
for (Property aList : list) {
copy.add(aList.copy());
}
return copy;
}
/**
* Add to the order by by parsing a raw expression.
*/
public void add(String rawExpression) {
parse(rawExpression);
}
/**
* Add a property to the order by.
*/
@@ -185,7 +192,7 @@ public final class OrderBy<T> implements Serializable {
if (!(obj instanceof OrderBy<?>)) {
return false;
}
OrderBy<?> e = (OrderBy<?>) obj;
return e.list.equals(list);
}
@@ -206,8 +213,9 @@ public final class OrderBy<T> implements Serializable {
* order by clause and replace.
* </p>
*/
public void clear() {
public OrderBy<T> clear() {
list.clear();
return this;
}
/**
@@ -247,9 +255,9 @@ public final class OrderBy<T> implements Serializable {
@Override
public int hashCode() {
int hc = property.hashCode();
hc = hc * 31 + (ascending ? 0 : 1);
hc = hc * 31 + (nulls == null ? 0 : nulls.hashCode());
hc = hc * 31 + (highLow == null ? 0 : highLow.hashCode());
hc = hc * 92821 + (ascending ? 0 : 1);
hc = hc * 92821 + (nulls == null ? 0 : nulls.hashCode());
hc = hc * 92821 + (highLow == null ? 0 : highLow.hashCode());
return hc;
}
@@ -286,7 +294,7 @@ public final class OrderBy<T> implements Serializable {
sb.append(" ").append("desc");
}
sb.append(" ").append(nulls).append(" ").append(highLow);
return sb.toString();
return sb.toString();
}
}
@@ -348,8 +356,8 @@ public final class OrderBy<T> implements Serializable {
}
String[] chunks = orderByClause.split(",");
for (int i = 0; i < chunks.length; i++) {
String[] pairs = chunks[i].split(" ");
for (String chunk : chunks) {
String[] pairs = chunk.split(" ");
Property p = parseProperty(pairs);
if (p != null) {
list.add(p);
@@ -362,10 +370,10 @@ public final class OrderBy<T> implements Serializable {
return null;
}
ArrayList<String> wordList = new ArrayList<String>(pairs.length);
for (int i = 0; i < pairs.length; i++) {
if (!isEmptyString(pairs[i])) {
wordList.add(pairs[i]);
ArrayList<String> wordList = new ArrayList<>(pairs.length);
for (String pair : pairs) {
if (!isEmptyString(pair)) {
wordList.add(pair);
}
}
if (wordList.isEmpty()) {
+17 -41
View File
@@ -8,7 +8,7 @@ import java.util.concurrent.Future;
* <p>
* The benefit of using PagedList over just using the normal Query with
* {@link Query#setFirstRow(int)} and {@link Query#setMaxRows(int)} is that it additionally wraps
* functionality that can call {@link Query#findFutureRowCount()} to determine total row count,
* functionality that can call {@link Query#findFutureCount()} to determine total row count,
* total page count etc.
* </p>
* <p>
@@ -16,8 +16,7 @@ import java.util.concurrent.Future;
* the query. This translates into SQL that uses limit offset, rownum or row_number function to
* limit the result set.
* </p>
*
*
* <p>
* <h4>Example: typical use including total row count</h4>
* <pre>{@code
*
@@ -43,32 +42,7 @@ import java.util.concurrent.Future;
* int totalRowCount = pagedList.getTotalRowCount();
*
* }</pre>
*
* <h4>Example: typical use including total row count</h4>
* <pre>{@code
*
* // We want to find the first 100 new orders
* // ... 0 means first page
* // ... page size is 100
*
* PagedList<Order> pagedList
* = ebeanServer.find(Order.class)
* .where().eq("status", Order.Status.NEW)
* .order().asc("id")
* .findPagedList(0, 100);
*
* // Optional: initiate the loading of the total
* // row count in a background thread
* pagedList.loadRowCount();
*
* // fetch and return the list in the foreground thread
* List<Order> orders = pagedList.getList();
*
* // get the total row count (from the future)
* int totalRowCount = pagedList.getTotalRowCount();
*
* }</pre>
*
* <p>
* <h4>Example: No total row count required</h4>
* <pre>{@code
*
@@ -81,9 +55,7 @@ import java.util.concurrent.Future;
*
* }</pre>
*
* @param <T>
* the entity bean type
*
* @param <T> the entity bean type
* @see Query#findPagedList()
*/
public interface PagedList<T> {
@@ -103,14 +75,13 @@ public interface PagedList<T> {
* int totalRowCount = pagedList.getTotalRowCount();
*
* }</pre>
*
* <p>
* Also note that using loadRowCount() and getTotalRowCount() rather than getFutureRowCount()
* means that exceptions ExecutionException, InterruptedException, TimeoutException are instead
* wrapped in the unchecked PersistenceException (which might be preferrable).
* </p>
*/
void loadRowCount();
void loadCount();
/**
* Return the Future row count. You might get this if you wish to cancel the total row count query
@@ -138,7 +109,7 @@ public interface PagedList<T> {
*
* }</pre>
*/
Future<Integer> getFutureRowCount();
Future<Integer> getFutureCount();
/**
* Return the list of entities for this page.
@@ -170,7 +141,7 @@ public interface PagedList<T> {
*
* }</pre>
*/
int getTotalRowCount();
int getTotalCount();
/**
* Return the total number of pages based on the page size and total row count.
@@ -186,6 +157,14 @@ public interface PagedList<T> {
*/
int getPageSize();
/**
* Return the index position of this page (Zero based).
* <p>
* This is a calculated value based on firstRow/maxRows.
* </p>
*/
int getPageIndex();
/**
* Return true if there is a next page.
* <p>
@@ -208,11 +187,8 @@ public interface PagedList<T> {
* the total row count query if it has not already been invoked.
* </p>
*
* @param to
* String to put between the first and last row
* @param of
* String to put between the last row and the total row count
*
* @param to String to put between the first and last row
* @param of String to put between the last row and the total row count
* @return String of the format XtoYofZ.
*/
String getDisplayXtoYofZ(String to, String of);
@@ -7,6 +7,8 @@ import javax.persistence.PersistenceException;
*/
public class PersistenceIOException extends PersistenceException {
private static final long serialVersionUID = -7630050437148176148L;
public PersistenceIOException(String msg, Exception cause) {
super(msg, cause);
}
@@ -71,6 +71,9 @@ class PrimaryServer {
}
}
}
if (defaultServerName == null) {
defaultServerName = "db";
}
return defaultServerName;
}
File diff suppressed because it is too large Load Diff
@@ -1,41 +0,0 @@
package com.avaje.ebean;
/**
* Used to process a query result one bean at a time via a callback to this
* visitor.
* <p>
* If you wish to stop further processing return false from the accept method.
* </p>
* <p>
* Unlike findList() and findSet() using a QueryResultVisitor does not require
* all the beans in the query result to be held in memory at once. This makes
* QueryResultVisitor useful for processing large queries.
* </p>
*
* <pre>{@code
*
* Query<Customer> query = server.find(Customer.class)
* .where().eq("status", Status.NEW)
* .order().asc("id");
*
* query.findEach((Customer customer) -> {
*
* // do something with customer
* System.out.println("-- visit " + customer);
* });
*
* }</pre>
*
* @param <T>
* the type of entity bean being queried.
*/
public interface QueryEachConsumer<T> {
/**
* Process the bean.
*
* @param bean
* the entity bean to process
*/
void accept(T bean);
}
@@ -1,45 +0,0 @@
package com.avaje.ebean;
/**
* Used to process a query result one bean at a time via a callback to this
* visitor.
* <p>
* If you wish to stop further processing return false from the accept method.
* </p>
* <p>
* Unlike findList() and findSet() using a QueryResultVisitor does not require
* all the beans in the query result to be held in memory at once. This makes
* QueryResultVisitor useful for processing large queries.
* </p>
* <p/>
* <pre class="code">
*
* Query&lt;Customer&gt; query = server.find(Customer.class)
* .fetch(&quot;contacts&quot;, new FetchConfig().query(2))
* .where().gt(&quot;id&quot;, 0)
* .orderBy(&quot;id&quot;)
* .setMaxRows(2);
*
* query.findEachWhile((Customer customer) -> {
*
* // do something with customer
* System.out.println(&quot;-- visit &quot; + customer);
*
* // return true to continue processing or false to stop
* return (customer.getId() < 40);
* });
* </pre>
*
* @param <T> the type of entity bean being queried.
*/
public interface QueryEachWhileConsumer<T> {
/**
* Process the bean and return true if you want to continue processing more
* beans. Return false if you want to stop processing further.
*
* @param bean the entity bean to process
* @return true to continue processing more beans or false to stop.
*/
boolean accept(T bean);
}
@@ -0,0 +1,80 @@
package com.avaje.ebean;
import java.util.Iterator;
/**
* Used to provide iteration over query results.
* <p>
* This can be used when you want to process a very large number of results and
* means that you don't have to hold all the results in memory at once (unlike
* findList(), findSet() etc where all the beans are held in the List or Set
* etc).
* </p>
* <p>
* Note that findIterate (and findEach and findEachWhile) uses a "per graph"
* persistence context scope and adjusts jdbc fetch buffer size for large
* queries. As such it is better to use findList for small queries.
* </p>
* <p>
* Remember that with {@link QueryIterator} you must call {@link QueryIterator#close()}
* when you have finished iterating the results. Use "try with resources" or ensure it
* is closed in a finally block.
* </p>
* <h3>Try finally style</h3>
* <pre>{@code
*
* Query<Customer> query = server.find(Customer.class)
* .where().gt("id", 0)
* .orderBy("id")
* .setMaxRows(2);
*
* QueryIterator<Customer> it = query.findIterate();
* try {
* while (it.hasNext()) {
* Customer customer = it.next();
* // do something with customer ...
* }
* } finally {
* // close the underlying resources
* it.close();
* }
*
* }</pre>
* <p>
* <h3>Try with resources style</h3>
* <pre>{@code
*
* // try with resources
* try (QueryIterator<Customer> it = query.findIterate()) {
* while (it.hasNext()) {
* Customer customer = it.next();
* // do something with customer ...
* }
* }
*
* }</pre>
*
* @param <T> the type of entity bean in the iteration
*/
public interface QueryIterator<T> extends Iterator<T>, java.io.Closeable {
/**
* Returns <tt>true</tt> if the iteration has more elements.
*/
boolean hasNext();
/**
* Returns the next element in the iteration.
*/
T next();
/**
* Remove is not allowed.
*/
void remove();
/**
* Close the underlying resources held by this iterator.
*/
void close();
}
+52 -55
View File
@@ -1,10 +1,15 @@
package com.avaje.ebean;
import com.avaje.ebean.util.CamelCaseHelper;
import java.io.Serializable;
import java.sql.ResultSet;
import java.util.*;
import com.avaje.ebean.util.CamelCaseHelper;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Used to build object graphs based on a raw SQL statement (rather than
@@ -51,39 +56,38 @@ import com.avaje.ebean.util.CamelCaseHelper;
* to hold the values for the aggregate functions (sum etc) and a &#064;OneToOne
* to Order.
* </p>
*
* <p>
* <h3>Example OrderAggregate</h3>
*
* <pre>{@code
* ...
* // @Sql indicates to that this bean
* // is based on RawSql rather than a table
*
*
* @Entity
* @Sql
* public class OrderAggregate {
*
*
* @OneToOne
* Order order;
*
*
* Double totalAmount;
*
*
* Double totalItems;
*
*
* // getters and setters
* ...
*
* }</pre>
*
* <p>
* <h3>Example 1:</h3>
*
* <p>
* <pre>{@code
*
* String sql = " select order_id, o.status, c.id, c.name, sum(d.order_qty*d.unit_price) as totalAmount"
* + " from o_order o"
* + " join o_customer c on c.id = o.kcustomer_id "
* + " join o_order_detail d on d.order_id = o.id " + " group by order_id, o.status ";
*
*
* RawSql rawSql = RawSqlBuilder.parse(sql)
* // map the sql result columns to bean properties
* .columnMapping("order_id", "order.id")
@@ -93,35 +97,34 @@ import com.avaje.ebean.util.CamelCaseHelper;
* // we don't need to map this one due to the sql column alias
* // .columnMapping("sum(d.order_qty*d.unit_price)", "totalAmount")
* .create();
*
*
* List<OrderAggregate> list = Ebean.find(OrderAggregate.class)
* .setRawSql(rawSql)
* .where().gt("order.id", 0)
* .having().gt("totalAmount", 20)
* .findList();
*
*
*
* }</pre>
*
* <p>
* <h3>Example 2:</h3>
*
* <p>
* The following example uses a FetchConfig().query() so that after the initial
* RawSql query is executed Ebean executes a secondary query to fetch the
* associated order status, orderDate along with the customer name.
* </p>
*
* <p>
* <pre>{@code
*
* String sql = " select order_id, 'ignoreMe', sum(d.order_qty*d.unit_price) as totalAmount "
* + " from o_order_detail d"
* + " group by order_id ";
*
*
* RawSql rawSql = RawSqlBuilder.parse(sql)
* .columnMapping("order_id", "order.id")
* .columnMappingIgnore("'ignoreMe'")
* .create();
*
*
* List<OrderAggregate> orders = Ebean.find(OrderAggregate.class)
* .setRawSql(rawSql)
* .fetch("order", "status,orderDate", new FetchConfig().query())
@@ -131,13 +134,12 @@ import com.avaje.ebean.util.CamelCaseHelper;
* .order().desc("totalAmount")
* .setMaxRows(10)
* .findList();
*
*
* }</pre>
*
*
* <p>
* <h3>Example 3: tableAliasMapping</h3>
* <p>
* Instead of mapping each column you can map each table alias to a path using tableAliasMapping().
* Instead of mapping each column you can map each table alias to a path using tableAliasMapping().
* </p>
* <pre>{@code
*
@@ -162,19 +164,17 @@ import com.avaje.ebean.util.CamelCaseHelper;
* .findList();
*
* }</pre>
*
*
* <p>
* <p>
* Note that lazy loading also works with object graphs built with RawSql.
* </p>
*
*/
public final class RawSql implements Serializable {
private static final long serialVersionUID = 1L;
private final ResultSet resultSet;
private final Sql sql;
private final ColumnMapping columnMapping;
@@ -192,7 +192,7 @@ public final class RawSql implements Serializable {
this.sql = null;
this.columnMapping = new ColumnMapping(propertyNames);
}
protected RawSql(ResultSet resultSet, Sql sql, ColumnMapping columnMapping) {
this.resultSet = resultSet;
this.sql = sql;
@@ -214,7 +214,7 @@ public final class RawSql implements Serializable {
String unParsedSql = (sql == null) ? "" : sql.unparsedSql;
return new Key(parsed, unParsedSql, columnMapping);
}
/**
* Return the resultSet if this is a ResultSet based RawSql.
*/
@@ -278,7 +278,7 @@ public final class RawSql implements Serializable {
* Construct for parsed SQL.
*/
protected Sql(String unparsedSql, String preFrom, String preWhere, boolean andWhereExpr,
String preHaving, boolean andHavingExpr, String orderByPrefix, String orderBy, boolean distinct) {
String preHaving, boolean andHavingExpr, String orderByPrefix, String orderBy, boolean distinct) {
this.unparsedSql = unparsedSql;
this.parsed = true;
@@ -296,8 +296,7 @@ public final class RawSql implements Serializable {
if (!parsed) {
return "unparsed[" + unparsedSql + "]";
}
return "select[" + preFrom + "] preWhere[" + preWhere + "] preHaving[" + preHaving
+ "] orderBy[" + orderBy + "]";
return "select[" + preFrom + "] preWhere[" + preWhere + "] preHaving[" + preHaving + "] orderBy[" + orderBy + "]";
}
public boolean isDistinct() {
@@ -386,7 +385,7 @@ public final class RawSql implements Serializable {
private final LinkedHashMap<String, Column> dbColumnMap;
private final Map<String, String> propertyMap;
private final Map<String, Column> propertyColumnMap;
private final boolean parsed;
@@ -401,9 +400,8 @@ public final class RawSql implements Serializable {
this.parsed = true;
this.propertyMap = null;
this.propertyColumnMap = null;
this.dbColumnMap = new LinkedHashMap<String, Column>();
for (int i = 0; i < columns.size(); i++) {
Column c = columns.get(i);
this.dbColumnMap = new LinkedHashMap<>();
for (Column c : columns) {
dbColumnMap.put(c.getDbColumnKey(), c);
}
}
@@ -416,9 +414,9 @@ public final class RawSql implements Serializable {
this.parsed = false;
this.propertyMap = null;
this.propertyColumnMap = null;
this.dbColumnMap = new LinkedHashMap<String, Column>();
this.dbColumnMap = new LinkedHashMap<>();
}
/**
* Construct for ResultSet use.
*/
@@ -426,7 +424,7 @@ public final class RawSql implements Serializable {
this.immutable = false;
this.parsed = false;
this.propertyMap = null;
this.dbColumnMap = new LinkedHashMap<String, Column>();
this.dbColumnMap = new LinkedHashMap<>();
int pos = 0;
for (String prop : propertyNames) {
@@ -443,8 +441,8 @@ public final class RawSql implements Serializable {
this.parsed = parsed;
this.dbColumnMap = dbColumnMap;
HashMap<String, Column> pcMap = new HashMap<String, Column>();
HashMap<String, String> pMap = new HashMap<String, String>();
HashMap<String, Column> pcMap = new HashMap<>();
HashMap<String, String> pMap = new HashMap<>();
for (Column c : dbColumnMap.values()) {
pMap.put(c.getPropertyName(), c.getDbColumn());
@@ -476,9 +474,8 @@ public final class RawSql implements Serializable {
/**
* Creates an immutable copy of this ColumnMapping.
*
* @throws IllegalStateException
* when a propertyName has not been defined for a column.
*
* @throws IllegalStateException when a propertyName has not been defined for a column.
*/
protected ColumnMapping createImmutableCopy() {
@@ -567,7 +564,7 @@ public final class RawSql implements Serializable {
*/
public void tableAliasMapping(String tableAlias, String path) {
String startMatch = tableAlias+".";
String startMatch = tableAlias + ".";
for (Map.Entry<String, Column> entry : dbColumnMap.entrySet()) {
if (entry.getKey().startsWith(startMatch)) {
entry.getValue().tableAliasMapping(path);
@@ -606,9 +603,9 @@ public final class RawSql implements Serializable {
}
}
private static String derivePropertyName(String dbAlias, String dbColumn) {
protected static String derivePropertyName(String dbAlias, String dbColumn) {
if (dbAlias != null) {
return dbAlias;
return CamelCaseHelper.toCamelFromUnderscore(dbAlias);
}
int dotPos = dbColumn.indexOf('.');
if (dotPos > -1) {
@@ -639,9 +636,9 @@ public final class RawSql implements Serializable {
@Override
public int hashCode() {
int result = indexPos;
result = 31 * result + dbColumn.hashCode();
result = 31 * result + (dbAlias != null ? dbAlias.hashCode() : 0);
result = 31 * result + (propertyName != null ? propertyName.hashCode() : 0);
result = 92821 * result + dbColumn.hashCode();
result = 92821 * result + (dbAlias != null ? dbAlias.hashCode() : 0);
result = 92821 * result + (propertyName != null ? propertyName.hashCode() : 0);
return result;
}
@@ -720,15 +717,15 @@ public final class RawSql implements Serializable {
Key that = (Key) o;
return parsed == that.parsed
&& columnMapping.equals(that.columnMapping)
&& unParsedSql.equals(that.unParsedSql);
&& columnMapping.equals(that.columnMapping)
&& unParsedSql.equals(that.unParsedSql);
}
@Override
public int hashCode() {
int result = (parsed ? 1 : 0);
result = 31 * result + columnMapping.hashCode();
result = 31 * result + unParsedSql.hashCode();
result = 92821 * result + columnMapping.hashCode();
result = 92821 * result + unParsedSql.hashCode();
return result;
}
}
@@ -1,17 +1,17 @@
package com.avaje.ebean;
import java.sql.ResultSet;
import com.avaje.ebean.RawSql.ColumnMapping;
import com.avaje.ebean.RawSql.Sql;
import java.sql.ResultSet;
/**
* Builds RawSql instances from a SQL string and column mappings.
* <p>
* Note that RawSql can also be defined in ebean-orm.xml files and be used as a
* named query.
* </p>
*
*
* @see RawSql
*/
public class RawSqlBuilder {
@@ -22,7 +22,7 @@ public class RawSqlBuilder {
public static final String IGNORE_COLUMN = "$$_IGNORE_COLUMN_$$";
private final ResultSet resultSet;
private final Sql sql;
private final ColumnMapping columnMapping;
@@ -37,7 +37,7 @@ public class RawSqlBuilder {
public static RawSql resultSet(ResultSet resultSet, String... propertyNames) {
return new RawSql(resultSet, propertyNames);
}
/**
* Return an unparsed RawSqlBuilder. Unlike a parsed one this query can not be
* modified - so no additional WHERE or HAVING expressions can be added to
@@ -70,7 +70,7 @@ public class RawSqlBuilder {
ColumnMapping mapping = DRawSqlColumnsParser.parse(select);
return new RawSqlBuilder(sql2, mapping);
}
private RawSqlBuilder(Sql sql, ColumnMapping columnMapping) {
this.sql = sql;
this.columnMapping = columnMapping;
@@ -83,11 +83,9 @@ public class RawSqlBuilder {
* For Unparsed SQL the columnMapping MUST be defined in the same order that
* the columns appear in the SQL statement.
* </p>
*
* @param dbColumn
* the DB column that we are mapping to a bean property
* @param propertyName
* the bean property that we are mapping the DB column to.
*
* @param dbColumn the DB column that we are mapping to a bean property
* @param propertyName the bean property that we are mapping the DB column to.
*/
public RawSqlBuilder columnMapping(String dbColumn, String propertyName) {
columnMapping.columnMapping(dbColumn, propertyName);
@@ -130,6 +128,4 @@ public class RawSqlBuilder {
return sql;
}
}
@@ -1,167 +0,0 @@
package com.avaje.ebean;
class SimpleTextParser {
private final String oql;
private final char[] chars;
private final int eof;
private int pos;
private String word;
private String lowerWord;
SimpleTextParser(String oql) {
this.oql = oql;
this.chars = oql.toCharArray();
this.eof = oql.length();
}
public int getPos() {
return pos;
}
public String getWord() {
return word;
}
public String peekNextWord() {
int origPos = pos;
String nw = nextWordInternal();
pos = origPos;
return nw;
}
/**
* Match the current and the next word.
*/
public boolean isMatch(String lowerMatch, String nextWordMatch) {
if (isMatch(lowerMatch)) {
String nw = peekNextWord();
if (nw != null) {
nw = nw.toLowerCase();
return nw.equals(nextWordMatch);
}
}
return false;
}
public boolean isFinished() {
return word == null;
}
public int findWordLower(String lowerMatch, int afterPos) {
this.pos = afterPos;
return findWordLower(lowerMatch);
}
public int findWordLower(String lowerMatch) {
do {
if (nextWord() == null) {
return -1;
}
if (lowerMatch.equals(lowerWord)) {
return pos - lowerWord.length();
}
} while (true);
}
/**
* Match the current word.
*/
public boolean isMatch(String lowerMatch) {
return lowerMatch.equals(lowerWord);
}
public String nextWord() {
word = nextWordInternal();
if (word != null) {
lowerWord = word.toLowerCase();
}
return word;
}
private String nextWordInternal() {
trimLeadingWhitespace();
if (pos >= eof) {
return null;
}
int start = pos;
if (chars[pos] == '(') {
moveToClose();
} else {
moveToEndOfWord();
}
return oql.substring(start, pos);
}
private void moveToClose() {
pos++;
int openParenthesisCount = 0;
for (; pos < eof; pos++) {
char c = chars[pos];
if (c == '(') {
// count nested parenthesis
openParenthesisCount++;
} else if (c == ')') {
if (openParenthesisCount > 0) {
// still in nested parenthesis
--openParenthesisCount;
} else {
// we have found the end
pos++;
return;
}
}
}
}
private void moveToEndOfWord() {
char c = chars[pos];
boolean isOperator = isOperator(c);
for (; pos < eof; pos++) {
c = chars[pos];
if (isWordTerminator(c, isOperator)) {
return;
}
}
}
private boolean isWordTerminator(char c, boolean isOperator) {
if (Character.isWhitespace(c)) {
return true;
}
if (isOperator(c)) {
return !isOperator;
}
return c == '(' || isOperator;
}
private boolean isOperator(char c) {
switch (c) {
case '<':
return true;
case '>':
return true;
case '=':
return true;
case '!':
return true;
default:
return false;
}
}
private void trimLeadingWhitespace() {
for (; pos < eof; pos++) {
char c = chars[pos];
if (!Character.isWhitespace(c)) {
break;
}
}
}
}
+10 -12
View File
@@ -2,8 +2,8 @@ package com.avaje.ebean;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* Query object for performing native SQL queries that return SqlRow's.
@@ -20,23 +20,22 @@ import java.util.Set;
* The returned SqlRow objects are similar to a LinkedHashMap with some type
* conversion support added.
* </p>
*
* <p>
* <pre>{@code
*
* // its typically a good idea to use a named query
* // and put the sql in the orm.xml instead of in your code
*
*
* String sql = "select id, name from customer where name like :name and status_code = :status";
*
*
* SqlQuery sqlQuery = Ebean.createSqlQuery(sql);
* sqlQuery.setParameter("name", "Acme%");
* sqlQuery.setParameter("status", "ACTIVE");
*
*
* // execute the query returning a List of MapBean objects
* List<SqlRow> list = sqlQuery.findList();
*
* }</pre>
*
*/
public interface SqlQuery extends Serializable {
@@ -51,7 +50,7 @@ public interface SqlQuery extends Serializable {
* This streaming type query is useful for large query execution as only 1 row needs to be held in memory.
* </p>
*/
void findEach(QueryEachConsumer<SqlRow> consumer);
void findEach(Consumer<SqlRow> consumer);
/**
* Execute the SqlQuery iterating a row at a time with the ability to stop consuming part way through.
@@ -62,7 +61,7 @@ public interface SqlQuery extends Serializable {
* This streaming type query is useful for large query execution as only 1 row needs to be held in memory.
* </p>
*/
void findEachWhile(QueryEachWhileConsumer<SqlRow> consumer);
void findEachWhile(Predicate<SqlRow> consumer);
/**
* Execute the query returning a single row or null.
@@ -100,9 +99,8 @@ public interface SqlQuery extends Serializable {
* preparedStatement. If the timeout occurs an exception will be thrown - this
* will be a SQLException wrapped up in a PersistenceException.
* </p>
*
* @param secs
* the query timeout limit in seconds. Zero means there is no limit.
*
* @param secs the query timeout limit in seconds. Zero means there is no limit.
*/
SqlQuery setTimeout(int secs);
+16 -15
View File
@@ -16,19 +16,21 @@ package com.avaje.ebean;
* notify Ebean of external changes and enable Ebean to maintain it's "L2"
* server cache.
* </p>
*
* <pre class="code">
* // example that uses 'named' parameters
* String s = &quot;UPDATE f_topic set post_count = :count where id = :id&quot;
* <p>
* <pre>{@code
*
* // example that uses 'named' parameters
* String s = "UPDATE f_topic set post_count = :count where id = :id";
* SqlUpdate update = Ebean.createSqlUpdate(s);
* update.setParameter(&quot;id&quot;, 1);
* update.setParameter(&quot;count&quot;, 50);
*
* update.setParameter("id", 1);
* update.setParameter("count", 50);
*
* int modifiedCount = Ebean.execute(update);
*
* String msg = &quot;There where &quot; + modifiedCount + &quot;rows updated&quot;
* </pre>
*
*
* String msg = "There were " + modifiedCount + " rows updated";
*
* }</pre>
*
* @see Update
* @see SqlQuery
* @see CallableSql
@@ -47,7 +49,7 @@ public interface SqlUpdate {
* {@link Transaction#setBatchMode(boolean)} and
* {@link Transaction#setBatchSize(int)}.
* </p>
*
*
* @see com.avaje.ebean.Ebean#execute(SqlUpdate)
*/
int execute();
@@ -117,8 +119,7 @@ public interface SqlUpdate {
SqlUpdate setParameter(int position, Object value);
/**
* Set a null parameter via its index position. Exactly the same as
* {@link #setNull(int, int)}.
* Set a null parameter via its index position.
*/
SqlUpdate setNull(int position, int jdbcType);
@@ -143,4 +144,4 @@ public interface SqlUpdate {
*/
SqlUpdate setNullParameter(String name, int jdbcType);
}
}
+67 -22
View File
@@ -54,13 +54,52 @@ public interface Transaction extends Closeable {
*/
void setReadOnly(boolean readOnly);
/**
* Commits the transaction at this point with the expectation that another
* commit (or rollback or end) will occur later to complete the transaction.
* <p>
* This is similar to commit() but leaves the transaction "Active".
* </p>
* <h3>Functions/h3>
* <ul>
* <li>Flush the JDBC batch buffer</li>
* <li>Call commit on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Perform post-commit processing updating L2 cache, ElasticSearch etc</li>
* </ul>
*/
void commitAndContinue() throws RollbackException;
/**
* Commit the transaction.
* <p>
* This performs commit and completes the transaction closing underlying resources and
* marking the transaction as "In active".
* </p>
* <h3>Functions/h3>
* <ul>
* <li>Flush the JDBC batch buffer</li>
* <li>Call commit on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Perform post-commit processing updating L2 cache, ElasticSearch etc</li>
* <li>Close any underlying resources, closing the underlying JDBC connection</li>
* <li>Mark the transaction as "Inactive"</li>
* </ul>
*/
void commit() throws RollbackException;
/**
* Rollback the transaction.
* <p>
* This performs rollback, closes underlying resources and marks the transaction as "In active".
* </p>
* <h3>Functions/h3>
* <ul>
* <li>Call rollback on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Close any underlying resources, closing the underlying JDBC connection</li>
* <li>Mark the transaction as "Inactive"</li>
* </ul>
*/
void rollback() throws PersistenceException;
@@ -74,6 +113,16 @@ public interface Transaction extends Closeable {
*/
void rollback(Throwable e) throws PersistenceException;
/**
* Mark the transaction for rollback only.
*/
void setRollbackOnly();
/**
* Return true if the transaction is marked as rollback only.
*/
boolean isRollbackOnly();
/**
* If the transaction is active then perform rollback. Otherwise do nothing.
*/
@@ -87,10 +136,10 @@ public interface Transaction extends Closeable {
/**
* Set the behavior for document store updates on this transaction.
* <p>
* For example, set the mode to DocStoreEvent.IGNORE for this transaction and
* then any changes via this transaction are not sent to the doc store. This
* would be used when doing large bulk inserts into the database and we want
* to control how that is sent to the document store.
* For example, set the mode to DocStoreEvent.IGNORE for this transaction and
* then any changes via this transaction are not sent to the doc store. This
* would be used when doing large bulk inserts into the database and we want
* to control how that is sent to the document store.
* </p>
*/
void setDocStoreMode(DocStoreMode mode);
@@ -98,11 +147,11 @@ public interface Transaction extends Closeable {
/**
* Set the batch size to use for sending messages to the document store.
* <p>
* You might set this if you know the changes in this transaction result in especially large or
* especially small payloads and want to adjust the batch size to match.
* You might set this if you know the changes in this transaction result in especially large or
* especially small payloads and want to adjust the batch size to match.
* </p>
* <p>
* Setting this overrides the default of {@link DocStoreConfig#getBulkBatchSize()}
* Setting this overrides the default of {@link DocStoreConfig#getBulkBatchSize()}
* </p>
*/
void setDocStoreBatchSize(int batchSize);
@@ -148,7 +197,7 @@ public interface Transaction extends Closeable {
* Refer to {@link ServerConfig#setSkipCacheAfterWrite(boolean)} for configuring the default behavior
* for using the L2 bean cache in transactions spanning multiple query/persist requests.
* </p>
*
* <p>
* <pre>{@code
*
* // assume Customer has L2 bean caching enabled ...
@@ -230,23 +279,23 @@ public interface Transaction extends Closeable {
* <p>
* Example: batch processing executing every 3 rows
* </p>
*
* <p>
* <pre>{@code
*
* String data = "This is a simple test of the batch processing"
* + " mode and the transaction execute batch method";
*
*
* String[] da = data.split(" ");
*
*
* String sql = "{call sp_t3(?,?)}";
*
*
* CallableSql cs = new CallableSql(sql);
* cs.registerOut(2, Types.INTEGER);
*
*
* // (optional) inform eBean this stored procedure
* // inserts into a table called sp_test
* cs.addModification("sp_test", true, false, false);
*
*
* Transaction txn = ebeanServer.beginTransaction();
* txn.setBatchMode(true);
* txn.setBatchSize(3);
@@ -255,16 +304,15 @@ public interface Transaction extends Closeable {
* cs.setParameter(1, da[i]);
* ebeanServer.execute(cs);
* }
*
*
* // NB: commit implicitly flushes
* txn.commit();
*
*
* } finally {
* txn.end();
* }
*
* }</pre>
*
*/
void setBatchMode(boolean useBatch);
@@ -276,7 +324,6 @@ public interface Transaction extends Closeable {
* </p>
*
* @param persistBatchMode the batch mode to use for this transaction
*
* @see com.avaje.ebean.config.ServerConfig#setPersistBatch(com.avaje.ebean.config.PersistBatch)
*/
void setBatch(PersistBatch persistBatchMode);
@@ -298,7 +345,6 @@ public interface Transaction extends Closeable {
* </p>
*
* @param batchOnCascadeMode the batch mode to use per save(), insert(), update() or delete()
*
* @see com.avaje.ebean.config.ServerConfig#setPersistBatchOnCascade(com.avaje.ebean.config.PersistBatch)
*/
void setBatchOnCascade(PersistBatch batchOnCascadeMode);
@@ -417,9 +463,8 @@ public interface Transaction extends Closeable {
/**
* Add an arbitrary user object to the transaction. The objects added have no
* impact on any internals of ebena and are solely meant as a convenient
* method push user information to e.g. the
* {@link com.avaje.ebean.event.TransactionEventListener}.
* impact on any internals of ebean and are solely meant as a convenient
* method push user information (although somewhat replaced by TransactionCallback).
*/
void putUserObject(String name, Object value);
+12 -10
View File
@@ -12,24 +12,26 @@ package com.avaje.ebean;
* <p>
* See also {@link TxRunnable}.
* </p>
*
* <pre class="code">
* Ebean.execute(new TxCallable&lt;String&gt;() {
* <p>
* <pre>{@code
*
* Ebean.execute(new TxCallable<String>() {
* public String call() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
*
* u1.setName(&quot;u1 mod&quot;);
* u2.setName(&quot;u2 mod&quot;);
*
*
* u1.setName("u1 mod");
* u2.setName("u2 mod");
*
* Ebean.save(u1);
* Ebean.save(u2);
*
*
* return u1.getEmail();
* }
* });
* </pre>
*
*
* }</pre>
*
* @see TxRunnable
*/
public interface TxCallable<T> {
@@ -1,100 +0,0 @@
package com.avaje.ebean;
import java.sql.Connection;
/**
* The Transaction Isolation levels.
* <p>
* These match those of java.sql.Connection with the addition of DEFAULT which
* implies the configured default of the DataSource.
* </p>
* <p>
* This can be used with TxScope to define transactional scopes to execute
* method within.
* </p>
*
* @see TxScope
*/
public enum TxIsolation {
/**
* Read Committed Isolation level. This is typically the default for most
* configurations.
*/
READ_COMMITED(Connection.TRANSACTION_READ_COMMITTED),
/**
* Read uncommitted Isolation level.
*/
READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED),
/**
* Repeatable Read Isolation level.
*/
REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ),
/**
* Serializable Isolation level.
*/
SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE),
/**
* No Isolation level.
*/
NONE(Connection.TRANSACTION_NONE),
/**
* The default isolation level. This typically means the default that the
* DataSource is using or configured to use.
*/
DEFAULT(-1);
final int level;
TxIsolation(int level) {
this.level = level;
}
/**
* Return the level as per java.sql.Connection.
* <p>
* Note that -1 denotes the default isolation level.
* </p>
*/
public int getLevel() {
return level;
}
/**
* Return the TxIsolation given the java.sql.Connection isolation level.
* <p>
* Note that -1 denotes the default isolation level.
* </p>
*/
public static TxIsolation fromLevel(int connectionIsolationLevel) {
switch (connectionIsolationLevel) {
case Connection.TRANSACTION_READ_UNCOMMITTED:
return TxIsolation.READ_UNCOMMITTED;
case Connection.TRANSACTION_READ_COMMITTED:
return TxIsolation.READ_COMMITED;
case Connection.TRANSACTION_REPEATABLE_READ:
return TxIsolation.REPEATABLE_READ;
case Connection.TRANSACTION_SERIALIZABLE:
return TxIsolation.SERIALIZABLE;
case Connection.TRANSACTION_NONE:
return TxIsolation.NONE;
case -1:
return TxIsolation.DEFAULT;
default:
throw new RuntimeException("Unknown isolation level " + connectionIsolationLevel);
}
}
}
+11 -10
View File
@@ -8,26 +8,27 @@ package com.avaje.ebean;
* <p>
* See also {@link TxCallable}.
* </p>
*
* <pre class="code">
*
* <p>
* <pre>{@code
*
* // this run method runs in a transaction scope
* // which by default is TxScope.REQUIRED
*
*
* Ebean.execute(new TxRunnable() {
* public void run() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
*
* u1.setName(&quot;u1 mod&quot;);
* u2.setName(&quot;u2 mod&quot;);
*
*
* u1.setName("u1 mod");
* u2.setName("u2 mod");
*
* Ebean.save(u1);
* Ebean.save(u2);
* }
* });
* </pre>
*
*
* }</pre>
*
* @see TxCallable
*/
public interface TxRunnable {
+48 -32
View File
@@ -16,7 +16,7 @@ import java.util.ArrayList;
* This object is used internally with the enhancement of a method with
* Transactional annotation.
* </p>
*
*
* @see TxCallable
* @see TxRunnable
* @see Ebean#execute(TxScope, TxCallable)
@@ -44,27 +44,6 @@ public final class TxScope {
ArrayList<Class<? extends Throwable>> noRollbackFor;
/**
* Return true if PersistBatch has been set.
*/
public boolean isBatchSet() {
return batch != null && batch != PersistBatch.INHERIT;
}
/**
* Return true if batch on cascade has been set.
*/
public boolean isBatchOnCascadeSet() {
return batchOnCascade != null && batchOnCascade != PersistBatch.INHERIT;
}
/**
* Return true if batch size has been set.
*/
public boolean isBatchSizeSet() {
return batchSize > 0;
}
/**
* Helper method to create a TxScope with REQUIRES.
*/
@@ -126,8 +105,45 @@ public final class TxScope {
*/
public String toString() {
return "TxScope[" + type + "] readOnly[" + readOnly + "] isolation[" + isolation
+ "] serverName[" + serverName
+ "] rollbackFor[" + rollbackFor + "] noRollbackFor[" + noRollbackFor + "]";
+ "] serverName[" + serverName + "] rollbackFor[" + rollbackFor + "] noRollbackFor[" + noRollbackFor + "]";
}
/**
* Return true if PersistBatch has been set.
*/
public boolean isBatchSet() {
return batch != null && batch != PersistBatch.INHERIT;
}
/**
* Return true if batch on cascade has been set.
*/
public boolean isBatchOnCascadeSet() {
return batchOnCascade != null && batchOnCascade != PersistBatch.INHERIT;
}
/**
* Return true if batch size has been set.
*/
public boolean isBatchSizeSet() {
return batchSize > 0;
}
/**
* Check for batchSize being set without batch mode and use this to imply PersistBatch.ALL.
*/
public void checkBatchMode() {
if (batchSize > 0 && notSet(batch) && notSet(batchOnCascade)) {
// Use setting the batchSize as implying PersistBatch.ALL for @Transactional
batch = PersistBatch.ALL;
}
}
/**
* Return true if the mode is considered not set.
*/
private boolean notSet(PersistBatch batchMode) {
return batchMode == null || batchMode == PersistBatch.INHERIT;
}
/**
@@ -265,7 +281,7 @@ public final class TxScope {
*/
public TxScope setRollbackFor(Class<? extends Throwable> rollbackThrowable) {
if (rollbackFor == null) {
rollbackFor = new ArrayList<Class<? extends Throwable>>(2);
rollbackFor = new ArrayList<>(2);
}
rollbackFor.add(rollbackThrowable);
return this;
@@ -277,10 +293,10 @@ public final class TxScope {
@SuppressWarnings("unchecked")
public TxScope setRollbackFor(Class<?>[] rollbackThrowables) {
if (rollbackFor == null) {
rollbackFor = new ArrayList<Class<? extends Throwable>>(rollbackThrowables.length);
rollbackFor = new ArrayList<>(rollbackThrowables.length);
}
for (int i = 0; i < rollbackThrowables.length; i++) {
rollbackFor.add((Class<? extends Throwable>) rollbackThrowables[i]);
for (Class<?> rollbackThrowable : rollbackThrowables) {
rollbackFor.add((Class<? extends Throwable>) rollbackThrowable);
}
return this;
}
@@ -299,7 +315,7 @@ public final class TxScope {
*/
public TxScope setNoRollbackFor(Class<? extends Throwable> noRollback) {
if (noRollbackFor == null) {
noRollbackFor = new ArrayList<Class<? extends Throwable>>(2);
noRollbackFor = new ArrayList<>(2);
}
this.noRollbackFor.add(noRollback);
return this;
@@ -311,10 +327,10 @@ public final class TxScope {
@SuppressWarnings("unchecked")
public TxScope setNoRollbackFor(Class<?>[] noRollbacks) {
if (noRollbackFor == null) {
noRollbackFor = new ArrayList<Class<? extends Throwable>>(noRollbacks.length);
noRollbackFor = new ArrayList<>(noRollbacks.length);
}
for (int i = 0; i < noRollbacks.length; i++) {
noRollbackFor.add((Class<? extends Throwable>) noRollbacks[i]);
for (Class<?> noRollback : noRollbacks) {
noRollbackFor.add((Class<? extends Throwable>) noRollback);
}
return this;
}
-50
View File
@@ -1,50 +0,0 @@
package com.avaje.ebean;
/**
* Used to define the transactional scope for executing a method. Matches the
* types defined in the EJB TransactionAttributeType.
* <p>
* Used with the Transactional annotation and the {@link TxScope} with
* {@link Ebean#execute(TxScope, TxCallable)} and
* {@link Ebean#execute(TxScope, TxRunnable)}.
* </p>
*
* @see TxScope
*/
public enum TxType {
/**
* Uses an existing transaction and if none exists will starts a new
* Transaction. This is the default.
*/
REQUIRED,
/**
* A transaction MUST already have been started. Throws
* TransactionRequiredException.
*/
MANDATORY,
/**
* Uses the existing transaction if one exists, otherwise the method does not
* run with a transaction. Used this with caution.
*/
SUPPORTS,
/**
* Always start a new transaction. Suspend an existing once if required.
*/
REQUIRES_NEW,
/**
* Suspends an existing transaction if required. Method runs without a
* transaction.
*/
NOT_SUPPORTED,
/**
* If there is an existing transaction throws an Exception. Method runs
* without a transaction.
*/
NEVER
}
+43 -52
View File
@@ -11,43 +11,43 @@ package com.avaje.ebean;
* <p>
* The following is an example of named updates on an entity bean.
* </p>
*
* <pre type="class">
* <pre>{@code
* ...
* &#064;NamedUpdates(value = {
* &#064;NamedUpdate(
* name = &quot;setTitle&quot;,
* notifyCache = false,
* update = &quot;update topic set title = :title, postCount = :count where id = :id&quot;),
* &#064;NamedUpdate(
* name = &quot;setPostCount&quot;,
* notifyCache = false,
* update = &quot;update f_topic set post_count = :postCount where id = :id&quot;),
* &#064;NamedUpdate(
* name = &quot;incrementPostCount&quot;,
* notifyCache = false,
* update = &quot;update Topic set postCount = postCount + 1 where id = :id&quot;)
* //update = &quot;update f_topic set post_count = post_count + 1 where id = :id&quot;)
* @NamedUpdates(value = {
* @NamedUpdate(
* name = "setTitle",
* notifyCache = false,
* update = "update topic set title = :title, postCount = :count where id = :id"),
* @NamedUpdate(
* name = "setPostCount",
* notifyCache = false,
* update = "update f_topic set post_count = :postCount where id = :id"),
* @NamedUpdate(
* name = "incrementPostCount",
* notifyCache = false,
* update = "update Topic set postCount = postCount + 1 where id = :id")
* //update = "update f_topic set post_count = post_count + 1 where id = :id")
* })
* &#064;Entity
* &#064;Table(name = &quot;f_topic&quot;)
* @Entity
* @Table(name = "f_topic")
* public class Topic {
* ...
* </pre>
*
* }</pre>
*
* <p>
* The following show code that would use a named update on the Topic entity
* bean.
* </p>
*
* <pre class="code">
* Update&lt;Topic&gt; update = Ebean.createUpdate(Topic.class, &quot;incrementPostCount&quot;);
* update.setParameter(&quot;id&quot;, 1);
* <p>
* <pre>{@code
*
* Update<Topic> update = Ebean.createUpdate(Topic.class, "incrementPostCount");
* update.setParameter("id", 1);
* int rows = update.execute();
* </pre>
*
* @param <T>
* the type of entity beans inserted updated or deleted
*
* }</pre>
*
* @param <T> the type of entity beans inserted updated or deleted
*/
public interface Update<T> {
@@ -73,9 +73,8 @@ public interface Update<T> {
* preparedStatement. If the timeout occurs an exception will be thrown - this
* will be a SQLException wrapped up in a PersistenceException.
* </p>
*
* @param secs
* the timeout in seconds. Zero implies unlimited.
*
* @param secs the timeout in seconds. Zero implies unlimited.
*/
Update<T> setTimeout(int secs);
@@ -92,21 +91,17 @@ public interface Update<T> {
* <p>
* Set a value for each ? you have in the sql.
* </p>
*
* @param position
* the index position of the parameter starting with 1.
* @param value
* the parameter value to bind.
*
* @param position the index position of the parameter starting with 1.
* @param value the parameter value to bind.
*/
Update<T> set(int position, Object value);
/**
* Set and ordered bind parameter (same as bind).
*
* @param position
* the index position of the parameter starting with 1.
* @param value
* the parameter value to bind.
*
* @param position the index position of the parameter starting with 1.
* @param value the parameter value to bind.
*/
Update<T> setParameter(int position, Object value);
@@ -129,11 +124,9 @@ public interface Update<T> {
* <p>
* A more succinct version of setParameter() to be consistent with Query.
* </p>
*
* @param name
* the parameter name.
* @param value
* the parameter value.
*
* @param name the parameter name.
* @param value the parameter value.
*/
Update<T> set(String name, Object value);
@@ -148,11 +141,9 @@ public interface Update<T> {
* <p>
* A more succinct version of setNullParameter().
* </p>
*
* @param name
* the parameter name.
* @param jdbcType
* the type of the property being bound.
*
* @param name the parameter name.
* @param jdbcType the type of the property being bound.
*/
Update<T> setNull(String name, int jdbcType);
@@ -166,4 +157,4 @@ public interface Update<T> {
*/
String getGeneratedSql();
}
}
+13 -17
View File
@@ -7,9 +7,9 @@ package com.avaje.ebean;
* This UpdateQuery is more for the cases where we want to build the where expression of the update using the
* {@link ExpressionList} "Criteria API" that is used with a normal ORM query.
* </p>
*
* <p>
* <h4>Example: Simple update</h4>
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -26,18 +26,17 @@ package com.avaje.ebean;
* update o_customer set status=?, updtime=? where id > ?
*
* }</pre>
*
* <p>
* Note that if the where() clause contains a join then the SQL update changes to use a
* <code> WHERE ID IN () </code> form.
* </p>
*
* <p>
* <h4>Example: Update with a JOIN</h4>
* <p>
* In this example the expression <code>.eq("billingAddress.country", nz)</code> requires a join
* to the address table.
* In this example the expression <code>.eq("billingAddress.country", nz)</code> requires a join
* to the address table.
* </p>
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -50,14 +49,14 @@ package com.avaje.ebean;
* .gt("id", 1000)
* .update();
* }</pre>
*
* <p>
* <pre>{@code sql
*
* update o_customer set status=?, updtime=?
* where id in (
* select t0.id c0
* from o_customer t0
* left outer join o_address t1 on t1.id = t0.billing_address_id
* left join o_address t1 on t1.id = t0.billing_address_id
* where t0.status = ?
* and t1.country_code = ?
* and t0.id > ? )
@@ -65,15 +64,13 @@ package com.avaje.ebean;
* }</pre>
*
* @param <T> The type of entity bean being updated
*
* @see SqlUpdate
*/
public interface UpdateQuery<T> {
/**
* Set the value of a property.
*
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -87,13 +84,13 @@ public interface UpdateQuery<T> {
* }</pre>
*
* @param property The bean property to be set
* @param value The value to set the property to
* @param value The value to set the property to
*/
UpdateQuery<T> set(String property, Object value);
/**
* Set the property to be null.
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -110,12 +107,11 @@ public interface UpdateQuery<T> {
UpdateQuery<T> setNull(String property);
/**
*
* Set using a property expression that does not need any bind values.
* <p>
* The property expression typically contains database functions.
* </p>
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -148,7 +144,7 @@ public interface UpdateQuery<T> {
* }</pre>
*
* @param propertyExpression A raw property expression
* @param values The values to bind with the property expression
* @param values The values to bind with the property expression
*/
UpdateQuery<T> setRaw(String propertyExpression, Object... values);
+1 -1
View File
@@ -29,7 +29,7 @@ public class ValuePair {
public Object getNewValue() {
return newValue;
}
/**
* Return the old value.
*/
@@ -1,61 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the default cache use specific entity type.
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Cache {
/**
* Set this to true to enable the use of query cache.
* <p>
* By default query caching is disabled as the query cache invalidates
* frequently and so it is typically used for specific bean types and cases.
* </p>
*/
boolean enableQueryCache() default false;
/**
* Set this to false to disable the use of bean cache.
* <p>
* By default bean caching is expected so this defaults to true. We might
* set this to false on a bean type that we want to use query caching but no
* bean caching (and this is expected to be a rare case).
* </p>
* <p>
* When bean caching is enabled by default "find by id" and "find by unique natural key"
* queries will try to use the bean cache. We use {@link com.avaje.ebean.Query#setUseCache(boolean)}
* with <code>false</code> for the case when we do NOT want to use the bean cache.
* </p>
*/
boolean enableBeanCache() default true;
/**
* Specify the property that is a natural unique identifier for the bean.
* <p>
* When a findUnique() query is used with this property as the sole expression
* then there will be a lookup into the L2 natural key cache.
* </p>
*/
String naturalKey() default "";
/**
* When set to true the beans returned from a query will default to be
* readOnly.
* <p>
* If the bean is readOnly and has no relationships then it may be sharable.
* </p>
* <p>
* If you try to modify a readOnly bean it will throw an
* IllegalStateException.
* </p>
*/
boolean readOnly() default false;
}
@@ -1,56 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Cache tuning hints for the L2 bean cache of a specific entity type.
* <p>
* Note that this is not useful when distributed L2 bean caches are used like
* ElasticSearch, Hazelcast, Ignite etc.
* </p>
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface CacheBeanTuning {
/**
* The maximum size for the cache.
* <p>
* This defaults to 0 which means unlimited.
* </p>
*/
int maxSize() default 0;
/**
* The maximum time (in seconds) that a cache entry is allowed to stay in the
* cache when it has not been accessed.
* <p>
* This defaults to 0 which means unlimited.
* </p>
*/
int maxIdleSecs() default 0;
/**
* The maximum time (in seconds) a cache entry is allowed to stay in the
* cache.
* <p>
* This is not generally required as the cache entries are automatically
* evicted when related data changes are committed.
* </p>
* <p>
* This defaults to 0 which means unlimited.
* </p>
*/
int maxSecsToLive() default 0;
/**
* The frequency (in seconds) that cache trimming should occur.
* <p>
* This is a hint for cache implementations that use background cache trimming.
* </p>
*/
int trimFrequency() default 0;
}
@@ -1,55 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify cache tuning for query caching on a specific entity type.
* <p>
* If this is not specified then the system default settings are used.
* </p>
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface CacheQueryTuning {
/**
* The maximum size for the cache.
* <p>
* This defaults to 0 which means unlimited.
* </p>
*/
int maxSize() default 0;
/**
* The maximum time (in seconds) that a cache entry is allowed to stay in the
* cache when it has not been accessed.
* <p>
* This defaults to 0 which means unlimited.
* </p>
*/
int maxIdleSecs() default 0;
/**
* The maximum time (in seconds) a cache entry is allowed to stay in the
* cache.
* <p>
* This is not generally required as the cache entries are automatically
* evicted when related data changes are committed.
* </p>
* <p>
* This defaults to 0 which means unlimited.
* </p>
*/
int maxSecsToLive() default 0;
/**
* The frequency (in seconds) that cache trimming should occur.
* <p>
* This is a hint for cache implementations that use background cache trimming.
* </p>
*/
int trimFrequency() default 0;
}
@@ -1,34 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks an entity bean as being included in the change logging.
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ChangeLog {
/**
* Specify if inserts should be explicitly Included or Excluded.
* <p>
* If not defined explicitly then the server default behaviour defined
* on ServerConfig is used.
* </p>
*/
ChangeLogInsertMode inserts() default ChangeLogInsertMode.DEFAULT;
/**
* When specified only include update requests that have at least one
* of the given properties as a dirty property.
* <p>
* This provides a way to filter requests to include in the change log such that
* only updates that include at least one of the given properties is included
* in the change log.
* </p>
*/
String[] updatesThatInclude() default {};
}
@@ -1,22 +0,0 @@
package com.avaje.ebean.annotation;
/**
* The mode used to determine if inserts should be included or not for a given bean type.
*/
public enum ChangeLogInsertMode {
/**
* Use the default behaviour as defined on ServerConfig.
*/
DEFAULT,
/**
* Include inserts in the change log.
*/
INCLUDE,
/**
* Exclude inserts in the change log.
*/
EXCLUDE
}
@@ -1,38 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* For a timestamp property that is set to the datetime when the entity is
* created/inserted.
* <p>
* This is effectively an alias for @WhenCreated which was added as it hints
* towards a better naming convention (WhenCreated, WhenModified).
* </p>
* <p>
* An alternative to using this annotation would be to use insertable=false,
* updateable=false with @Column and have the DB insert the current time
* (default value on the DB column is SYSTIME etc).
* </p>
* <p>
* The downside to this approach is that the inserted entity does not have the
* timestamp value after the insert has occurred. You need to fetch the entity
* back to get the inserted timestamp if you want to used it.
* </p>
*
* <h3>Example:</h3>
* <pre>{@code
*
* @CreatedTimestamp
* Timestamp whenCreated;
*
* }</pre>
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface CreatedTimestamp {
}
@@ -1,40 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify a collection property that will be stored into a DB ARRAY type.
* <p>
* If the target database does not support ARRAY type (so not Postgres)
* then the collection will be stored in JSON format into a VARCHAR column.
* </p>
*
* <h3>Example:</h3>
* <pre>{@code
*
* // Store as ARRAY of UUID on Postgres
* @DbArray
* List<UUID> uids = new ArrayList<>();
*
* // Store as ARRAY on Postgres
* @DbArray
* List<String> phoneNumbers = new ArrayList<>();
*
* // Store as ARRAY of INTEGER on Postgres
* @DbArray
* List<Long> someLongs = new ArrayList<>();
*
* }</pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DbArray {
/**
* For VARCHAR storage specify the column length (defaults to 1000).
*/
int length() default 0;
}
@@ -1,19 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* A database table or column comment.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})
public @interface DbComment {
/**
* The database table or column comment.
*/
String value();
}
@@ -1,17 +0,0 @@
package com.avaje.ebean.annotation;
/**
* Specify the DB storage type used to with <code>@DbEnumValue</code>.
*/
public enum DbEnumType {
/**
* Store values as database INTEGER.
*/
INTEGER,
/**
* Store values as database VARCHAR.
*/
VARCHAR
}
@@ -1,44 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify a method on an Enum that returns the value that should be stored in the DB.
* <p>
* This is the preferred option for mapping Enum's to DB values (preferred over the JPA
* standard @Enumerated and Ebean's @EnumValue annotations).
* </p>
* <h3>Example:</h3>
* <pre>{@code
*
* public enum Status {
* NEW("N"),
* ACTIVE("A"),
* INACTIVE("I");
*
* String dbValue;
* Status(String dbValue) {
* this.dbValue = dbValue;
* }
*
* @DbEnumValue
* public String getValue() {
* return dbValue;
* }
* }
*
* }</pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface DbEnumValue {
/**
* Specify the database type used to store the values (VARCHAR or INTEGER).
*/
DbEnumType storage() default DbEnumType.VARCHAR;
}
@@ -1,30 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used for mapping a Map<String,String> type property to Postgres HSTORE data type.
* <p>
* The Map property should have keys and values of type String.
* </p>
*
* <h3>Example:</h3>
* <pre>{@code
*
* @DbHstore
* Map<String, String> tags;
*
* }</pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DbHstore {
/**
* For VARCHAR storage specify the column length (defaults to 1000).
*/
int length() default 0;
}
@@ -1,44 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify a property holding JSON content.
* <p>
* By default the content will be stored in a DB Clob except on Postgres where DB JSON type is used.
* </p>
* <h3>Example:</h3>
* <pre>{@code
*
* // Store as JSON on Postgres or Clob on other databases
* @DbJson
* Map<String,Object> content;
*
* }</pre>
*
* <h3>Example with JSONB storage</h3>
* <pre>{@code
*
* // Store as JSONB on Postgres or Clob on other databases
* @DbJson(storage = DbJsonType.JSONB)
* Map<String,Object> content;
*
* }</pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DbJson {
/**
* Specify the database type used to store the JSON content.
*/
DbJsonType storage() default DbJsonType.JSON;
/**
* For VARCHAR storage specify the column length (defaults to 3000).
*/
int length() default 0;
}
@@ -1,43 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify a property holding JSON content.
* <p>
* The content will be stored on Postgres using it's JSONB type and as Clob for other databases.
* </p>
* <p>
* This is equivalent to using <code>@DbJson(storage = DbJsonType.JSONB)</code>
* </p>
*
* <h3>Example:</h3>
* <pre>{@code
*
* // Store as JSONB on Postgres or Clob on other databases
* @DbJsonB
* Map<String,Object> content;
*
* }</pre>
*
* <h3>Equivalent to:</h3>
* <pre>{@code
*
* // Store as JSONB on Postgres or Clob on other databases
* @DbJson(storage = DbJsonType.JSONB)
* Map<String,Object> content;
*
* }</pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DbJsonB {
/**
* For VARCHAR storage specify the column length.
*/
int length() default 0;
}
@@ -1,32 +0,0 @@
package com.avaje.ebean.annotation;
/**
* Specify the DB storage type used to store JSON content.
*/
public enum DbJsonType {
/**
* Store as JSON on Postgres and for other databases store as CLOB.
*/
JSON,
/**
* Store as JSONB on Postgres and for other databases store as CLOB.
*/
JSONB,
/**
* Store as database VARCHAR.
*/
VARCHAR,
/**
* Store as database CLOB.
*/
CLOB,
/**
* Store as database BLOB.
*/
BLOB
}
@@ -1,32 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to indicate that a particular string property should be treated as a 'code' and not analysed for text searching.
* <p>
* By default all Id properties and all Enum properties are treated as 'code' and not analysed.
* </p>
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DocCode {
/**
* Set to true to have the property additionally stored separately from _source.
*/
boolean store() default false;
/**
* Set a boost value specific to this property.
*/
float boost() default 1;
/**
* Set a value to use instead of null.
*/
String nullValue() default "";
}
@@ -1,37 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the property is included in the parent document store index.
*
* <pre>{@code
*
*
* @DocStore
* @Entity @Table(name = "o_order")
* public class Order {
*
* ...
* // include some customer details including
* // nested billingAddress
* @DocEmbedded(doc = "id,status,name,billingAddress(*,country(*)")
* @ManyToOne
* Customer customer;
*
*
* }</pre>
*/
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface DocEmbedded {
/**
* The properties on the embedded bean to include in the index.
*/
String doc() default "";
}
@@ -1,24 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the entity type maps to a document store (like ElasticSearch).
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface DocMapping {
/**
* The property name the mapping applies to.
*/
String name();
/**
* Mapping options.
*/
DocProperty options();
}
@@ -1,110 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the entity type maps to a document store (like ElasticSearch).
*/
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface DocProperty {
/**
* Set this to true to indicate that this property should be un-analysed.
*/
boolean code() default false;
/**
* Set this to true to get an additional un-analysed 'raw' field to use for sorting etc.
*/
boolean sortable() default false;
/**
* Set to true to have the property additionally stored separately from _source.
*/
boolean store() default false;
/**
* Set a boost value specific to this property.
*/
float boost() default 1;
/**
* Set a value to use instead of null.
*/
String nullValue() default "";
/**
* Set this to false to exclude this from the _all property.
*/
boolean includeInAll() default true;
/**
* The analyzer to use.
*/
String analyzer() default "";
/**
* The analyzer to use for searches.
*/
String searchAnalyzer() default "";
/**
* The index options for this property.
*/
Option options() default Option.DEFAULT;
/**
* Set this to false such that doc values are not stored separately for this property.
*/
boolean docValues() default true;
/**
* Set a copyTo field.
*/
String copyTo() default "";
/**
* Set to false to disable the field from indexing, it will only be get/set in _source.
*/
boolean enabled() default true;
/**
* Set to false such that norms are not stored.
*/
boolean norms() default true;
/**
* Index options for a property.
*/
enum Option {
/**
* Only index the doc number.
*/
DOCS,
/**
* Doc number and term frequencies are indexed.
*/
FREQS,
/**
* Doc number, term frequencies and term positions are indexed.
*/
POSITIONS,
/**
* Doc number, term frequencies, term positions and start/end offsets are indexed.
*/
OFFSETS,
/**
* Use the default which means analysed string properties use POSITIONS as the default and all other types use DOCS.
*/
DEFAULT
}
}
@@ -1,34 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to indicate that a particular string property should support sorting. What this typically means is that
* for ElasticSearch an additional 'raw' field is added that stores the un-analysed value. This un-analysed value
* can be used for sorting etc and the original field used for text searching.
* <p>
* For example, customer name and product name are good candidates for marking with @DocSortable.
* </p>
*/
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface DocSortable {
/**
* Set to true to have the property additionally stored separately from _source.
*/
boolean store() default false;
/**
* Set a boost value specific to this property.
*/
float boost() default 1;
/**
* Set a value to use instead of null.
*/
String nullValue() default "";
}
@@ -1,88 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the entity type maps to a document store (like ElasticSearch).
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface DocStore {
/**
* A unique Id used when queuing reindex events.
*/
String queueId() default "";
/**
* The ElasticSearch index name. If left unspecified the short name of the bean type is used.
*/
String indexName() default "";
/**
* The ElasticSearch index type. If left unspecified the short name of the bean type is used.
*/
String indexType() default "";
/**
* The number of shards this index should use.
*/
int shards() default 0;
/**
* The number of replicas this index should use.
*/
int replicas() default 0;
/**
* Additional mapping that can be defined on the properties.
*/
DocMapping[] mapping() default {};
/**
* Specify the behavior when bean Insert, Update, Delete events occur.
*/
DocStoreMode persist() default DocStoreMode.DEFAULT;
/**
* Specify the behavior when bean Insert occurs.
*/
DocStoreMode insert() default DocStoreMode.DEFAULT;
/**
* Specify the behavior when bean Update occurs.
*/
DocStoreMode update() default DocStoreMode.DEFAULT;
/**
* Specify the behavior when bean Delete occurs.
*/
DocStoreMode delete() default DocStoreMode.DEFAULT;
/**
* Specify to include only some properties in the doc store document.
* <p>
* If this is left as default then all scalar properties are included,
* all @ManyToOne properties are included with just the nested id property
* and no @OneToMany properties are included.
* </p>
* <p>
* Note that typically DocStoreEmbedded is used on @ManyToOne and @OneToMany
* properties to indicate what part of the nested document should be included.
* </p>
*
* <h3>Example:</h3>
* <pre>{@code
*
* // only include the customer id and name
* @DocStore(doc = "id,name")
* @Entity @Table(name = "o_order")
* public class Customer {
*
* }</pre>
*/
String doc() default "";
}
@@ -1,38 +0,0 @@
package com.avaje.ebean.annotation;
/**
* Defines the behavior options when a Insert, Update or Delete event occurs
* on a bean with an associated ElasticSearch index.
* <p>
* For some indexes or some transactions it can be beneficial to queue the event
* for later processing rather than look to update ElasticSearch at that time.
* </p>
*/
public enum DocStoreMode {
/**
* Add the event to the queue for processing later (delaying the update to the document store).
*/
QUEUE,
/**
* Update the document store when transaction succeeds.
*/
UPDATE,
/**
* Ignore the event and not update the document store.
* <p>
* This can be used on a index or for a transaction where you want to have more
* manual programmatic control over the updating of the document store. Say you want to
* IGNORE on a particular transaction and instead manually queue a bulk update.
* </p>
*/
IGNORE,
/**
* The actual mode of QUEUE, UPDATE or IGNORE is set from the default configuration.
*/
DEFAULT
}
@@ -1,19 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks a boolean property on a @Draftable bean that indicates if the bean instance is a 'draft' or 'live' bean.
* The property is transient and has no underlying DB column.
* <p>
* For beans returned from an <code>asDraft()</code> query this property will be set to true.
* </p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Draft {
}
@@ -1,20 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks a boolean property on a @Draftable bean that only exists on the 'draft' table
* and is used to detect when a draft has unpublished changes.
* <p>
* This property will automatically have it's value set to true when a draft is saved and
* automatically have it's value set to false when the bean is published.
* </p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DraftDirty {
}
@@ -1,19 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks a property on a @Draftable bean that only exists on the 'draft' and not the 'live' table.
* <p>
* Typically this would be used on a property that is used as part of application 'workflow' such as
* a publish workflow status or when publish timestamp.
* </p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DraftOnly {
}
@@ -1,19 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks a property on a @Draftable bean that is set to null on the 'draft bean' on publish.
* <p>
* This is expected to be put on properties that get 'reset' or 'cleared' after a publish.
* These properties might represent a publish comment or publish timestamp.
* </p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DraftReset {
}
@@ -1,29 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to indicate an entity bean that has 'draftable' support.
* <p>
* This means that a second set of tables is created to hold draft versions of
* the rows and that these can then be published which effectively copies/transfers
* the values from the 'draft' table to the 'live' table.
* </p>
* <p>
* Ebean Query supports 'find as draft' which builds the resulting object graph using
* the draft tables. This object graph is typically edited, approved in some application
* specific manor and then published.
* </p>
* <p>
* EbeanServer has a publish method which transfers/copies the draft object graph to
* the 'live' tables.
* </p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Draftable {
}
@@ -1,20 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to indicate an entity bean that has 'draftable' support but it not a 'top level'
* (or root level) bean but instead child related to another @Draftable entity bean.
* <p>
* Relationships to @DraftableElements (@OneToMany, @ManyToMany etc) are automatically
* deemed to have Cascade.ALL for save and delete (as well as orphan removal mode).
* </p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface DraftableElement {
}
@@ -1,31 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify property name to db column mapping for Embedded beans.
* <p>
* This is designed to be easier to use than the AttributeOverride annotation in
* standard JPA.
* </p>
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface EmbeddedColumns {
/**
* A list of property names mapped to DB columns.
* <p>
* For example <code>currency=IN_CURR, amount=IN_AMOUNT</code>
* </p>
* <p>
* Where currency and amount are properties and IN_CURR and IN_AMOUNT are the
* respective DB columns these properties will be mapped to.
* </p>
*/
String columns() default "";
}
@@ -1,24 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify that the property is stored in encrypted form.
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface Encrypted {
/**
* When true try to use DB encryption rather than local java encryption.
*/
boolean dbEncryption() default true;
/**
* Used to specify the DB column length.
*/
int dbLength() default 0;
}
@@ -1,48 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Enables you to specify a value to use to persist for an enum value.
*
* <pre>{@code
*
* public enum Status {
*
* @EnumValue("N")
* NEW,
*
* @EnumValue("A")
* ACTIVE,
*
* @EnumValue("I")
* INACTIVE,
* }
*
* }</pre>
* <p>
* This is an alternative to using the JPA standard approach or Ebean's
* {@link DbEnumValue} annotation.
* </p>
* <p>
* Note that if all the EnumValue values are parsable as Integers then Ebean
* will persist and fetch them as integers - otherwise they will be persisted
* and fetched as strings.
* </p>
*/
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface EnumValue {
/**
* Specify the value to persist for a specific enum value.
* <p>
* If all the values are parsable as Integers then Ebean will persist and
* fetch them as integers rather than strings.
* </p>
*/
String value();
}
@@ -1,28 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/*
Copied from gson!!!
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Expose {
/**
* If {@code true}, the field marked with this annotation is written out in the JSON while
* serializing. If {@code false}, the field marked with this annotation is skipped from the
* serialized output. Defaults to {@code true}.
*/
boolean serialize() default true;
/**
* If {@code true}, the field marked with this annotation is deserialized from the JSON.
* If {@code false}, the field marked with this annotation is skipped during deserialization.
* Defaults to {@code true}.
*/
boolean deserialize() default true;
}
@@ -1,12 +1,14 @@
package com.avaje.ebean.annotation;
import com.avaje.ebean.Query;
import com.avaje.ebean.config.Platform;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.avaje.ebean.Query;
/**
* Assign to a property to be based on a SQL formula.
* <p>
@@ -24,28 +26,27 @@ import com.avaje.ebean.Query;
* You may want to do this if the Formula is relatively expensive and only want
* it included in the query when you explicitly state it.
* </p>
*
* <pre class="code">
* // On the Order &quot;master&quot; bean
* <p>
* <pre>{@code
* // On the Order "master" bean
* // ... a formula using the Order details
* // ... sum(order_qty*unit_price)
* &#064;Transient
* &#064;Formula(select = &quot;_b${ta}.total_amount&quot;, join = &quot;join (select order_id, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) as _b${ta} on _b${ta}.order_id = ${ta}.id&quot;)
* @Transient
* @Formula(select = "_b${ta}.total_amount", join = "join (select order_id, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) as _b${ta} on _b${ta}.order_id = ${ta}.id")
* Double totalAmount;
*
* </pre>
*
* }</pre>
* <p>
* As the totalAmount formula is also Transient it is not included by default in
* queries - it needs to be explicitly included.
* </p>
*
* <pre>{@code
*
* // find by Id
* Order o1 = Ebean.find(Order.class)
* .select("id, totalAmount")
* .setId(1).findUnique();
*
*
* // find list ... using totalAmount in the where clause
* List<Order> list = Ebean.find(Order.class)
* .select("id, totalAmount")
@@ -53,7 +54,7 @@ import com.avaje.ebean.Query;
* .eq("status", Order.Status.NEW)
* .gt("totalAmount", 10)
* .findList();
*
*
* // as a join from customer
* List<Customer> l0 = Ebean.find(Customer.class)
* .select("id, name")
@@ -62,11 +63,12 @@ import com.avaje.ebean.Query;
* .gt("id", 0)
* .gt("orders.totalAmount", 10)
* .findList();
*
*
* }</pre>
*/
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Formula.List.class)
public @interface Formula {
/**
@@ -82,9 +84,8 @@ public @interface Formula {
* as count, sum etc.
* </p>
* <p>
* The join string should start with either "left outer join" or "join".
* The join string should start with either "left join" or "join".
* </p>
*
* <p>
* You will almost certainly use the "${ta}" as a place holder for the table
* alias of the table you are joining back to (the "base table" of the entity
@@ -94,7 +95,7 @@ public @interface Formula {
* The example below is used to support a total count of topics created by a
* user.
* </p>
*
* <p>
* <pre>{@code
*
* join (select user_id, count(*) as topic_count from f_topic group by user_id) as _tc on _tc.user_id = ${ta}.id
@@ -103,4 +104,16 @@ public @interface Formula {
*/
String join() default "";
Platform[] platforms() default {};
/**
* Repeatable support for {@link Formula}.
*/
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@interface List {
Formula[] value() default {};
}
}
@@ -1,19 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks an entity bean as having history support.
* <p>
* In Postgres for example this means there is an associated history table which is
* typically automatically populated via database triggers.
* </p>
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface History {
}
@@ -1,25 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks a property as being excluded from history.
* <p>
* This means the property values are not maintained in the history table. Typically this
* would be placed on relatively large properties (Clobs, Blobs, large varchar columns etc)
* that are considered not interesting enough to maintain history on excluding them reduces
* underlying database costs.
* </p>
* <p>
* When placed on a ManyToMany this means that the intersection table does not have history
* support.
* </p>
*/
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface HistoryExclude {
}
@@ -1,33 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation for declaring an index on a single column.
*
* @author rvbiljouw
*/
@Target({ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Index {
/**
* Name of the index. If left blank a name is derived using the built in naming convention.
*/
String name() default "";
/**
* If set true indicates this is a unique index.
*/
boolean unique() default false;
/**
* When placed on the class (rather than field) you can specify the columns
* to include in the index in order.
*/
String[] columnNames() default {};
}
@@ -1,32 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Similar to Jackson JsonIgnore but provides the option to just ignore serialize or deserialize.
* <p>
* This provides the same features as Expose but from the opposite perspective which is probably
* more common and more familiar to Jackson users.
* </p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface JsonIgnore {
/**
* If {@code true}, the field marked with this annotation is written out in the JSON while
* serializing. If {@code false}, the field marked with this annotation is skipped from the
* serialized output. Defaults to {@code false}.
*/
boolean serialize() default false;
/**
* If {@code true}, the field marked with this annotation is deserialized from the JSON.
* If {@code false}, the field marked with this annotation is skipped during deserialization.
* Defaults to {@code false}.
*/
boolean deserialize() default false;
}
@@ -1,34 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify that the elements of a OneToMany are private owned.
* <p>
* This means that if they are removed from the List/Set/Map they will be
* deleted when their parent object is saved.
* </p>
* <p>
* This could also be described as deleting orphans - in that beans removed from
* the List/Set/Map will be deleted automatically when the parent bean is saved.
* They are considered 'orphans' when they have been removed from the collection
* in that they are no longer associated/linked to their parent bean.
* </p>
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface PrivateOwned {
/**
* Set this to false if you don't want cascade REMOVE on this relationship.
* <p>
* That is, by default PrivateOwned implicitly adds a cascade REMOVE to the
* relationship and if you don't want that you need to set this to false.
* </p>
*/
boolean cascadeRemove() default true;
}
@@ -1,15 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks an entity bean as being included in read auditing.
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ReadAudit {
}
@@ -1,25 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to indicate a property on an entity bean used to control 'soft delete'
* (also known as 'logical delete').
* <p>
* The property should be of type boolean.
* </p>
* <pre>{@code
*
* @SoftDelete
* boolean deleted;
*
* }</pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface SoftDelete {
}
@@ -1,18 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Mark and entity bean that is used solely via RawSql.
* <p>
* This means the entity bean has no base table specified (via @Table).
* </p>
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Sql {
}
@@ -1,14 +1,14 @@
package com.avaje.ebean.annotation;
import com.avaje.ebean.TxIsolation;
import com.avaje.ebean.TxType;
import com.avaje.ebean.config.PersistBatch;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.avaje.ebean.TxIsolation;
import com.avaje.ebean.TxType;
import com.avaje.ebean.config.PersistBatch;
/**
* Specify transaction scoping for a method.
* <p>
@@ -33,22 +33,22 @@ import com.avaje.ebean.config.PersistBatch;
* to set the default behaviour to rollback on any exception and optionally
* change the setting to be consistent with EJB/Spring if people wish to do so.
* </p>
*
* <p>
* <pre>{@code
*
* // a normal class
* public class MySimpleUserService {
*
*
* // this method is transactional automatically handling
* // transaction begin, commit and rollback etc
* @Transactional
* public void runInTrans() throws IOException {
*
*
* // tasks performed within the transaction
* ...
* // find some objects
* Customer cust = ebeanServer.find(Customer.class, 42);
*
*
* Order order = ...;
* ...
* // save some objects
@@ -58,7 +58,7 @@ import com.avaje.ebean.config.PersistBatch;
*
* }</pre>
*/
@Target({ ElementType.METHOD, ElementType.TYPE })
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Transactional {
@@ -1,34 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the update mode for the specific entity type.
* <p>
* Control whether all 'loaded' properties are included in an Update or whether
* just properties that have changed will be included in the update.
* </p>
* <p>
* Note that the default can be set via ebean.properties.
* </p>
*
* <pre>
* ## Set to update all loaded properties
* ebean.updateChangesOnly=false
* </pre>
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface UpdateMode {
/**
* Set to false if you want to include all the 'loaded' properties in the
* update. Otherwise, just the properties that have changed will be included
* in the update.
*/
boolean updateChangesOnly() default true;
}
@@ -1,20 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* For a timestamp property that is set to the datetime when the entity was last
* updated.
* <p>
* This is effectively an alias for @WhenModified which was added as it hints
* towards a better naming convention (WhenCreated, WhenModified).
* </p>
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface UpdatedTimestamp {
}
@@ -1,38 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotate an entity bean with @View to indicates the bean is based on a view.
* <p>
* As such typically the view is defined in <code>extra-ddl.xml</code> using
* <code>create or replace view ...</code>.
* </p>
* <p>
* When using extra-ddl.xml Ebean will run the resulting DDL script after the
* <code>create-all</code> DDL (which is typically used during development) and for
* DB Migration will copy the scripts as <code>repeatable migration scripts</code> that
* will be run by FlywayDb (or Ebean's own migration runner) when their MD5 hash changes.
* </p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface View {
/**
* The name of the view this entity bean is based on.
*/
String name();
/**
* Tables this view is dependent on.
* <p>
* This is used with l2 caching to invalidate the query cache. Changes to these
* tables invalidate the query cache for the entity based on this view.
* </p>
*/
String[] dependentTables() default {};
}
@@ -1,38 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* For a timestamp property that is set to the datetime when the entity is
* created/inserted.
* <p>
* This is effectively an alias for @CreatedTimestamp and added to hint
* towards a better naming convention (WhenCreated, WhenModified).
* </p>
* <p>
* An alternative to using this annotation would be to use insertable=false,
* updateable=false with @Column and have the DB insert the current time
* (default value on the DB column is SYSTIME etc).
* </p>
* <p>
* The downside to this approach is that the inserted entity does not have the
* timestamp value after the insert has occurred. You need to fetch the entity
* back to get the inserted timestamp if you want to used it.
* </p>
*
* <h3>Example:</h3>
* <pre>{@code
*
* @WhenCreated
* Timestamp whenCreated;
*
* }</pre>
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface WhenCreated {
}
@@ -1,19 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* For a timestamp property that is set to the datetime when the entity was last modified.
* <p>
* This is effectively an alias for @UpdatedTimestamp and added to hint
* towards a better naming convention (WhenCreated, WhenModified).
* </p>
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface WhenModified {
}
@@ -1,6 +1,9 @@
package com.avaje.ebean.annotation;
import com.avaje.ebean.config.Platform;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@@ -8,38 +11,35 @@ import java.lang.annotation.Target;
/**
* Add an Literal to add to the where clause when a many property (List, Set or
* Map) is loaded or refreshed.
*
* <pre>{@code
*
* // on a OneToMany property...
*
*
* @OneToMany
* @Where(clause = "deleted='y'")
* List<Topic> topics;
*
* }</pre>
*
* <p>
* Note that you can include "${ta}" as a place holder for the table alias if
* you need to include the table alias in the clause.
* </p>
*
* <pre>{@code
* // ... including the ${ta} table alias placeholder...
*
*
* @OneToMany
* @Where(clause = "${ta}.deleted='y'")
* List<Topic> topics;
*
* }</pre>
*
* <p>
* This will be added to the where clause when lazy loading the OneToMany
* property or when there is a join to that OneToMany property.
* </p>
*/
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Where.List.class)
public @interface Where {
/**
@@ -51,4 +51,18 @@ public @interface Where {
*/
String clause();
/**
* The platform where this annotation is active. Default: any platform
*/
Platform[] platforms() default {};
/**
* Repeatable support for {@link Where}.
*/
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@interface List {
Where[] value() default {};
}
}
@@ -1,29 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Mapped onto a entity bean property that represents the user id of
* who created the entity>
* <p>
* To use this annotation you need to implement CurrentUserProvider.
* The type of the bean property should match the type returned by
* CurrentUserProvider.
*</p>
* <h3>Example:</h3>
* <pre>{@code
*
* @WhoCreated
* String whoCreated;
*
* }</pre>
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface WhoCreated {
}
@@ -1,29 +0,0 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Mapped onto a entity bean property that represents the user id of
* who last modified the entity>
* <p>
* To use this annotation you need to implement CurrentUserProvider.
* The type of the bean property should match the type returned by
* CurrentUserProvider.
* </p>
*
* <h3>Example:</h3>
* <pre>{@code
*
* @WhoModified
* String whoModified;
*
* }</pre>
*/
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface WhoModified {
}
@@ -1,14 +0,0 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Extra deployment annotations</TITLE>
</HEAD>
<Body BGCOLOR="#ffffff">
Extra deployment annotations
<p>
Extra deployment annotations for entity beans.
</p>
</Body>
</HTML>
@@ -1,11 +1,11 @@
package com.avaje.ebean.bean;
import com.avaje.ebean.ExpressionList;
import java.io.Serializable;
import java.util.Collection;
import java.util.Set;
import com.avaje.ebean.ExpressionList;
/**
* Lazy loading capable Maps, Lists and Sets.
* <p>
@@ -23,14 +23,25 @@ import com.avaje.ebean.ExpressionList;
public interface BeanCollection<E> extends Serializable {
enum ModifyListenMode {
/** The common mode */
/**
* The common mode
*/
NONE,
/** Mode used for PrivateOwned */
/**
* Mode used for PrivateOwned
*/
REMOVALS,
/** Mode used for ManyToMany relationships */
/**
* Mode used for ManyToMany relationships
*/
ALL
}
/**
* Set the disableLazyLoad state.
*/
void setDisableLazyLoad(boolean disableLazyLoad);
/**
* Load bean from another collection.
*/
@@ -34,12 +34,12 @@ public final class CallStack implements Serializable {
public int hashCode() {
int hc = 0;
for (int i = 0; i < callStack.length; i++) {
hc = 31 * hc + callStack[i].hashCode();
for (StackTraceElement aCallStack : callStack) {
hc = 92821 * hc + aCallStack.hashCode();
}
return hc;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -88,14 +88,14 @@ public final class CallStack implements Serializable {
*/
public String description(String newLine) {
StringBuilder sb = new StringBuilder(400);
for (int i = 0; i < callStack.length; i++) {
sb.append(callStack[i].toString()).append(newLine);
for (StackTraceElement aCallStack : callStack) {
sb.append(aCallStack.toString()).append(newLine);
}
return sb.toString();
}
public String getOriginKey(int queryHash) {
return enc(queryHash)+ "." + zeroHash + "." + pathHash;
return enc(queryHash) + "." + zeroHash + "." + pathHash;
}
private static final int radix = 1 << 6;
@@ -116,10 +116,10 @@ public final class CallStack implements Serializable {
}
private static final char intToBase64[] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'
};
}
@@ -15,9 +15,9 @@ import java.io.Serializable;
public interface EntityBean extends Serializable {
String[] _ebean_getPropertyNames();
String _ebean_getPropertyName(int pos);
/**
* Return the enhancement marker value.
* <p>

Some files were not shown because too many files have changed in this diff Show More