Compare commits

..
Author SHA1 Message Date
Rob Bygrave cb89300027 [maven-release-plugin] prepare release ebean-10.1.7 2017-03-05 22:44:37 +13:00
Rob Bygrave 27cb0d062d Bump ebean-dbmigration to 10.1.4 2017-03-05 22:42:00 +13:00
Rob Bygrave 140c1dd965 #985 - IllegalArgumentException when using @DbArray of type List<String> with @ChangeLog 2017-03-05 11:40:17 +13:00
Rob Bygrave 75b9e748f4 #985 - IllegalArgumentException when using @DbArray of type List<String> with @ChangeLog 2017-03-05 11:40:08 +13:00
Koen De GrooteandRob Bygrave 289c0253b1 Warning suppressions. (#986)
* Went over compilation warnings with Xlint. Only imports for DateMidnight are left, as they cannot receive a suppression annotation.

Not doing this one.

* Doing inline fully qualified path of the deprecated path.
2017-03-05 11:08:45 +13:00
Rob Bygrave 07ce758302 #984 - ENH: DocumentStore API - add RawDoc with findEach() and findEachWhile() 2017-03-02 01:12:02 +13:00
Rob Bygrave d91729f65d #983 - Add credentials configuration support for document store (like basic auth for ElasticSearch) 2017-03-01 22:15:28 +13:00
Rob Bygrave 9e64d09e07 Update maven plugin (with separate testEnhance goal and enhance goal) 2017-03-01 22:07:47 +13:00
Roland PramlandRob Bygrave 5f63d5c35f Fix multi tenant bean change (#982)
* FIX: beanChange has tenant-id

* FIX: NPE in DefaultServer.currentTenantId()
2017-02-26 13:12:26 +13:00
Rob Bygrave 23e1ab4bfd No effective change - imports 2017-02-26 13:10:42 +13:00
Rob Bygrave 0e2900d796 #980 - fix several bugs in findSingleAttibute - Refactor moving logic into DefaultOrmQuery setDefaultSelectClause() from findSingleAttributeList() (to support alternate calling via EbeanServer) 2017-02-26 13:08:10 +13:00
Roland PramlandRob Bygrave a46e086dc4 fix several bugs in findSingleAttibute (#980)
* add test case for distinct on id property

* suggested fix for "select distinct id"

* add test case for distinct with fetch

* FIX: .setDistinct(true) can be used in conjunction with fetch() now

* add test case for distinct with beans that have a disriminator column

* FIX: discriminator column is only read if also Id is read.

* fine tuned the test case

* added test cases for findSingleAttributeList without distinct

* improved fix to support also findSingleAttribute without distinct

* ADD: Bonus test case - assertion not yet verified
2017-02-26 12:37:36 +13:00
Roland PramlandRob Bygrave 40ca179509 FIX: do not hit database if inherited entity has no children (#974)
* FIX: do not hit database if inherited entity has no children

* ADD: Testcase for creating references of inherited beans
2017-02-26 12:25:55 +13:00
Roland PramlandRob Bygrave 7632910027 FIX: potential NPE - manager can be null - eg when creted with new ExternalJdbcTransaction(conn) (#979) 2017-02-24 12:53:35 +13:00
Roland PramlandRob Bygrave ca777d7967 no effective code change: add some try-with resources (#978)
* no effective code change: add some try-with resources

* moved return statement outside try-with-resources, because otherwise the order changes
2017-02-24 12:52:22 +13:00
Roland PramlandRob Bygrave a315c7c11e More small fixes (#977)
* no effecitve code change: add @FunctionalInterface to designated interfaces

* no effective code change: removed obsolete imports

* no effective code change: removed obsolete @SuppressWarnings

* no effective code change: add @SuppressWarnings to UUID_PLACEHOLDER
2017-02-24 08:42:27 +13:00
Rob Bygrave 35f3f53443 No effective change - format and imports only 2017-02-24 00:06:13 +13:00
Roland PramlandRob Bygrave 40f5596837 add missing @override (#975)
* no effective code change: add missing @override in "io.ebean.*" package
* no effective code change: add missing @override in "io.ebeaninternal.api.*" package
* no effective code change: add missing @override in "io.ebeaninternal.server.*" package
* no effective code change: add missing @override in "io.ebeaninternal.util.*" package
* no effective code change: add missing @override in "io.ebeanservice.*" package
* no effective code change: add missing @override in "src/test/java/"
2017-02-24 00:01:25 +13:00
maksym-kitandRob Bygrave 43c978e41a Pass dataType to DataBind for Types.OTHER (#923) 2017-02-23 23:50:43 +13:00
Koen De GrooteandRob Bygrave 6120a465e1 Simple fixes (#976)
* Should be only the really simple stuff.
* Final cleanups.
2017-02-23 23:46:51 +13:00
Rob Bygrave 8bb884374b #970 - FOR UPDATE queries are not honored when beans are already cached 2017-02-21 22:53:14 +13:00
Rob Bygrave 3d8db775f7 #966 - ENH: Add serverConfig.setDbOffline(true) ... for creating new EbeanServer without a DataSource (for DbMigration typically) 2017-02-21 22:04:28 +13:00
Rob Bygrave b3b8f6b154 #973 - Refactor - Tidy internals of DefaultBeanLoader 2017-02-21 21:57:11 +13:00
Rob Bygrave e4c80582a5 [maven-release-plugin] prepare for next development iteration 2017-02-13 22:18:56 +13:00
Rob Bygrave 1846427859 [maven-release-plugin] prepare release ebean-10.1.6 2017-02-13 22:18:44 +13:00
Rob Bygrave 82102340b8 #960 - Incorrect query when using '.betweenProperties' with '@SoftDelete' 2017-02-09 23:43:45 +13:00
Rob Bygrave d9e884b8bd #969 - ENH: Add Finder.query(String ormQuery) ... helper method 2017-02-09 23:27:13 +13:00
Rob Bygrave 6744c7886a #968 - Refactor - Update ANTLR 4 generated code to 4.6 2017-02-09 23:20:33 +13:00
Rob Bygrave 271b4ee095 Modify pom - bump java8-parent to 1.3 2017-02-09 23:12:11 +13:00
Rob Bygrave 7cfdd331ca Merge branch 'master' of github.com:ebean-orm/ebean 2017-02-09 22:37:58 +13:00
Rob Bygrave 7e15faa9a8 #967 - ENH: Add DocStoreConfig.setAllowAllCertificates(true) ... 2017-02-09 22:37:25 +13:00
Roland PramlandRob Bygrave 1292c86b76 removed duplicate StringHelper (#958) 2017-01-31 22:10:45 +13:00
Rob Bygrave 0260a73cb6 #957 - Javadoc update only 2017-01-27 00:36:25 +13:00
Rob Bygrave 085fdaf177 #956 - Bump dependencies - avaje-datasource and ebean-dbmigration 2017-01-26 23:30:58 +13:00
Rob Bygrave a4b49dfa27 No effective change - Fix javadoc issues in Finder 2017-01-12 18:53:34 +13:00
Rob Bygrave d056151852 [maven-release-plugin] prepare for next development iteration 2017-01-12 00:46:22 +13:00
Rob Bygrave f9ba6f9a3a [maven-release-plugin] prepare release ebean-10.1.5 2017-01-12 00:46:11 +13:00
Rob Bygrave 2fa4345742 #945 - Invalid SQL when using @Aggregation with a fetch() to a ManyToOne - missing columns in GROUP BY 2017-01-12 00:42:27 +13:00
Rob Bygrave d9147327c1 #944 - Incorrect join (should be outer join) when predicate only path traverses an optional relationship to a mandatory relationship 2017-01-11 23:21:50 +13:00
Rob Bygrave 5ad9a611f9 #941 - @Transactional( type = TxType.MANDATORY ) creates a new transaction even if there is one available 2017-01-11 22:41:22 +13:00
Rob Bygrave 3fb497b651 No effective change - style, merge ifs 2017-01-11 22:17:29 +13:00
Rob Bygrave fbfe5d1ff8 #943 - Refactor internals - Performance tweak / tidy for WhoCreated, WhoModified on OneToMany connections. #942 2017-01-11 21:42:23 +13:00
Rob Bygrave b6f21f8649 No effective change - refactor merge AnnotationFields initWhoModified() and initWhoCreated() methods 2017-01-11 20:59:11 +13:00
Nagy VilmosandRob Bygrave 8fd04807c7 WhoCreated, WhoModified on OneToMany connections. (#942)
* WhoCreated, WhoModified on OneToMany connections.

* PostgreSQL table name fix in tests.
2017-01-11 20:54:20 +13:00
Rob Bygrave e49c42302a [maven-release-plugin] prepare for next development iteration 2017-01-09 22:39:47 +13:00
Rob Bygrave d96abece75 [maven-release-plugin] prepare release ebean-10.1.4 2017-01-09 22:39:36 +13:00
Rob Bygrave c953da637e Bump ebean-annotation to 2.2 for meta-annotation support on @Formula 2017-01-09 22:37:10 +13:00
Rob Bygrave 8d39b0a996 #940 - Allow findNative to use @Formula properties (add test for MySql := use with RawSql and findNative) 2017-01-09 22:29:15 +13:00
Rob Bygrave 0efcf1eeb3 Merge branch 'master' of github.com:ebean-orm/ebean 2017-01-09 19:40:23 +13:00
Rob Bygrave 335cef870f #939 - Make ModifyAwareSet serializable ... (for serializable entity beans with @DbJson etc) 2017-01-09 19:39:54 +13:00
Michael BenzandRob Bygrave 4c40962f04 MigrationXmlWriter adds DOCTYPE xml to avoid warning of missing external DTD in eclipse IDE. (#937) 2017-01-05 09:16:39 +13:00
Thibault MeyerandRob Bygrave 9be0d22cfb Upgrade provided dependencies (#936)
- javax.validation from 1.0.0.GA to 1.1.0.Final
- servlet-api from 2.4 to javax.servlet-api 3.1.0
- joda-time from 1.6 to 2.9.7
- postgresql from 9.4.1202-jdbc41 to 9.4.1212.jre7
- h2 from 1.4.192 to 1.4.193

Signed-off-by: Thibault Meyer <meyer.thibault@gmail.com>
2017-01-01 19:57:02 +13:00
Thibault MeyerandRob Bygrave 2893d73fad Upgrade test dependencies (#935)
- avaje-agentloader from 2.1.1 to 2.1.2
- avaje-moduuid from 1.2 to 2.1
- commons-io from 2.4 to 2.5
- hsqldb from 2.0.0 to 2.3.4
- mysql-connector-java from 5.1.36 to 6.0.5
- sqlite-jdbc from 3.8.11.2 to 3.15.1

Signed-off-by: Thibault Meyer <meyer.thibault@gmail.com>
2017-01-01 19:55:56 +13:00
Thibault MeyerandRob Bygrave 33d66ea9d1 Upgrade antlr4-runtime to prior version 4.6 (#934)
Signed-off-by: Thibault Meyer <meyer.thibault@gmail.com>
2017-01-01 19:54:25 +13:00
Nagy VilmosandRob Bygrave 073ea9c550 SQL Server boolean mapping fix (#932) 2017-01-01 19:52:57 +13:00
Rob Bygrave 8467934021 [maven-release-plugin] prepare for next development iteration 2016-12-23 16:14:19 +13:00
Rob Bygrave 96ba63407f [maven-release-plugin] prepare release ebean-10.1.3 2016-12-23 16:14:10 +13:00
Rob Bygrave 88df6ffc6e #931 - Refactor internals - DefaultTypeManager ... 2016-12-23 13:33:11 +13:00
Rob Bygrave 3efcfec300 #930 - Refactor (renames etc) for SQL Server History support 2016-12-23 13:18:15 +13:00
Rob BygraveandGitHub e51eb00889 Merge pull request #929 from vilmosnagy/feature/sqlServer2016History
SqlServer 2016 history support.
2016-12-23 13:00:23 +13:00
vilmos.nagy 9ae27ddcdd SqlServer 2016 history support. 2016-12-22 19:22:44 +01:00
Rob Bygrave b9516e64a3 #928 - Pom - change over to io.ebean persistence-api from org.avaje.ebean one. 2016-12-22 23:45:35 +13:00
Rob Bygrave f7f5552bf0 #927 - Pom - bump ebean-dbmigration to 10.1.2 2016-12-22 23:38:18 +13:00
Rob Bygrave adec2ab1b8 #926 - Pom - bump avaje-datasource to 1.1.4 2016-12-22 22:42:24 +13:00
Rob Bygrave da6d7284f8 No effective change - update Readme to maven groupId io.ebean 2016-12-22 00:00:35 +13:00
Rob Bygrave 1c160fea5a No functional change - update enhancement agent to 10.1.2 2016-12-21 23:38:32 +13:00
Rob Bygrave cc87de76d7 [maven-release-plugin] prepare for next development iteration 2016-12-21 00:09:30 +13:00
Rob Bygrave 70b380e6e7 [maven-release-plugin] prepare release ebean-10.1.2 2016-12-21 00:09:19 +13:00
Rob Bygrave 3e419d3e3a No effective change - test ebean.properties back to H2 for default 2016-12-20 21:31:02 +13:00
Rob Bygrave 7e2be20b6e #925 - Change generated SQL for H2, Postgres and MySql to not use column alias' 2016-12-20 21:30:00 +13:00
Rob Bygrave ab2d5fb4c8 No effective change - update test to use trimmed sql (trim out sql column alias to allow it to be optional) 2016-12-20 21:14:12 +13:00
Rob Bygrave 809901ff13 No effective change - update H2 specific test 2016-12-20 21:02:36 +13:00
Rob Bygrave fcc58d77e8 No effective change - update tests using Platform enum rather than name 2016-12-20 20:41:55 +13:00
Rob Bygrave bc93a82b1a #900 - Error - Can't fetch JsonDB field - org.postgresql.util.PSQLException: ERROR: could not identify an equality operator for type json 2016-12-20 03:00:08 +13:00
Rob Bygrave 84e1e12b66 #900 - Error - Can't fetch JsonDB field - org.postgresql.util.PSQLException: ERROR: could not identify an equality operator for type json 2016-12-20 02:59:47 +13:00
Rob Bygrave 2eb0c12213 #924 - Bump ebean-dbmigration dependency to 10.1.1 (sql server fix) 2016-12-19 22:19:53 +13:00
Rob Bygrave 4941134ce1 #922 - NPE Issue with ebean-elastic and multi-tenant Ebean ... NPE at DLoadContext line 96 2016-12-14 00:53:30 +13:00
Rob Bygrave cf37fda3f4 #921 - Refactor internals - Change internal use of "findRowCount" to "findCount" 2016-12-13 19:51:11 +13:00
Rob Bygrave f429811f79 [maven-release-plugin] prepare for next development iteration 2016-12-12 02:10:10 +13:00
Rob Bygrave 70fd988d8c [maven-release-plugin] prepare release ebean-10.1.1 2016-12-12 02:09:55 +13:00
Rob Bygrave fe4167ed60 #920 - Update DBMigration to io.ebean 2016-12-12 02:07:52 +13:00
Rob Bygrave 0eef69a277 #920 - Change logger package to io.ebean (e.g. for logging SQL instead of org.avaje.ebean.SQL use io.ebean.SQL) 2016-12-11 23:42:38 +13:00
Rob Bygrave 76bfd805c0 #919 - io.ebean package, use ebean-annotation 2016-12-11 23:34:29 +13:00
Rob Bygrave 971e2dc91b #919 - io.ebean package initial 2016-12-11 23:23:22 +13:00
Rob Bygrave 5821dc96b9 [maven-release-plugin] prepare for next development iteration 2016-12-10 00:08:52 +13:00
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
2144 changed files with 15629 additions and 12469 deletions
+4 -4
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 - ebean](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.avaje.ebean%22%20AND%20a%3A%22ebean%22 "maven central ebean")
[Maven central - ebean](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.ebean%22%20AND%20a%3A%22ebean%22 "maven central ebean")
[Maven central - all related projects](http://search.maven.org/#search%7Cga%7C1%7Cebean "maven central all related projects")
## Current versions
* [![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
* [![Maven Central : ebean](https://maven-badges.herokuapp.com/maven-central/io.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/io.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/io.ebean/ebean-maven-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.avaje.ebean/ebean-maven-plugin) - ebean-maven-plugin
+34 -39
View File
@@ -4,24 +4,20 @@
<parent>
<groupId>org.avaje</groupId>
<artifactId>java8-parent</artifactId>
<version>1.1</version>
<version>1.3</version>
</parent>
<groupId>org.avaje.ebean</groupId>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>9.4.2</version>
<version>10.1.7</version>
<packaging>jar</packaging>
<name>ebean</name>
<url>http://ebean-orm.github.io/</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-9.4.2</tag>
<tag>ebean-10.1.7</tag>
</scm>
<dependencies>
@@ -33,15 +29,15 @@
</dependency>
<dependency>
<groupId>org.avaje.ebean</groupId>
<groupId>io.ebean</groupId>
<artifactId>persistence-api</artifactId>
<version>2.1.3</version>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.avaje.ebean</groupId>
<groupId>io.ebean</groupId>
<artifactId>ebean-annotation</artifactId>
<version>1.5</version>
<version>2.2</version>
</dependency>
<dependency>
@@ -53,7 +49,7 @@
<dependency>
<groupId>org.avaje</groupId>
<artifactId>avaje-datasource</artifactId>
<version>1.1.3</version>
<version>2.1.1</version>
</dependency>
<dependency>
@@ -65,13 +61,13 @@
<dependency>
<groupId>org.avaje</groupId>
<artifactId>avaje-classpath-scanner</artifactId>
<version>2.2.1</version>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.avaje</groupId>
<artifactId>avaje-dbmigration</artifactId>
<version>1.2.1</version>
<groupId>io.ebean</groupId>
<artifactId>ebean-dbmigration</artifactId>
<version>10.1.4</version>
</dependency>
<dependency>
@@ -83,7 +79,7 @@
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.5.3</version>
<version>4.6</version>
</dependency>
<!-- Jackson core used internally by Ebean -->
@@ -112,21 +108,21 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6</version>
<version>2.9.7</version>
<scope>provided</scope>
</dependency>
@@ -134,7 +130,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1202-jdbc41</version>
<version>9.4.1212.jre7</version>
<scope>provided</scope>
</dependency>
@@ -157,14 +153,14 @@
<dependency>
<groupId>org.avaje</groupId>
<artifactId>avaje-agentloader</artifactId>
<version>1.1.1</version>
<version>2.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.avaje.ebean</groupId>
<groupId>io.ebean</groupId>
<artifactId>ebean-agent</artifactId>
<version>8.1.1</version>
<version>10.1.6</version>
<scope>test</scope>
</dependency>
@@ -173,28 +169,28 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.192</version>
<version>1.4.193</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.11.2</version>
<version>3.15.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.0.0</version>
<version>2.3.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version>
<version>6.0.5</version>
<scope>test</scope>
</dependency>
@@ -209,14 +205,14 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.avaje.moduuid</groupId>
<artifactId>avaje-moduuid</artifactId>
<version>1.2</version>
<version>2.1</version>
<scope>test</scope>
</dependency>
@@ -227,19 +223,18 @@
<plugins>
<plugin>
<groupId>org.avaje.ebean</groupId>
<groupId>io.ebean</groupId>
<artifactId>ebean-maven-plugin</artifactId>
<version>8.1.1</version>
<version>10.1.6</version>
<executions>
<execution>
<id>test</id>
<phase>process-test-classes</phase>
<configuration>
<classSource>target/test-classes</classSource>
<transformArgs>debug=1</transformArgs>
</configuration>
<goals>
<goal>enhance</goal>
<goal>testEnhance</goal>
</goals>
</execution>
</executions>
@@ -283,11 +278,11 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<doctitle>Ebean 9</doctitle>
<overview>src/main/java/com/avaje/ebean/overview.html</overview>
<doctitle>Ebean 10</doctitle>
<overview>src/main/java/io/ebean/overview.html</overview>
<source>1.8</source>
<doclet>org.avaje.doclet.PygmentsDoclet</doclet>
<excludePackageNames>com.avaje.ebeaninternal.*:com.avaje.ebean.util:com.avaje.ebean.dbmigration.ddlgeneration:com.avaje.ebean.dbmigration.migration:com.avaje.ebean.dbmigration.migrationreader:com.avaje.ebean.dbmigration.model</excludePackageNames>
<excludePackageNames>io.ebeaninternal.*:com.avaje.ebean.util:io.ebean.dbmigration.ddlgeneration:io.ebean.dbmigration.migration:io.ebean.dbmigration.migrationreader:io.ebean.dbmigration.model</excludePackageNames>
<docletArtifact>
<groupId>org.avaje</groupId>
<artifactId>pygments-doclet</artifactId>
@@ -1,119 +0,0 @@
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;
/**
* Assign to a property to be based on a SQL formula.
* <p>
* This is typically a SQL Literal value, SQL case statement, SQL function or
* similar.
* </p>
* <p>
* Any property based on a formula becomes a read only property.
* </p>
* <p>
* You may also put use the Transient annotation with the Formula annotation.
* The effect of the Transient annotation in this case is that the formula will
* <b>NOT</b> be included in queries by default - you have to explicitly include
* it via {@link Query#select(String)} or {@link Query#fetch(String, String, com.avaje.ebean.FetchConfig)}.
* 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>
* <p>
* <pre>{@code
* // On the Order "master" bean
* // ... a formula using the Order details
* // ... sum(order_qty*unit_price)
* @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>
* <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")
* .where()
* .eq("status", Order.Status.NEW)
* .gt("totalAmount", 10)
* .findList();
*
* // as a join from customer
* List<Customer> l0 = Ebean.find(Customer.class)
* .select("id, name")
* .fetch("orders", "status, totalAmount")
* .where()
* .gt("id", 0)
* .gt("orders.totalAmount", 10)
* .findList();
*
* }</pre>
*/
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Formula.List.class)
public @interface Formula {
/**
* The SQL to be used in the SELECT part of the SQL to populate a property.
*/
String select();
/**
* OPTIONAL - the SQL to be used in the JOIN part of the SQL to support the
* formula.
* <p>
* This is commonly used to join a 'dynamic view' to support aggregation such
* as count, sum etc.
* </p>
* <p>
* 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
* bean).
* </p>
* <p>
* 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
*
* }</pre>
*/
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,68 +0,0 @@
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;
/**
* 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})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Where.List.class)
public @interface Where {
/**
* The clause added to the lazy load query.
* <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>
*/
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 +0,0 @@
package com.avaje.ebeaninternal.api;
@@ -1,14 +0,0 @@
package com.avaje.ebeaninternal.server.autotune.service;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.server.autotune.AutoTuneService;
public class AutoTuneServiceFactory {
public static AutoTuneService create(SpiEbeanServer server, ServerConfig serverConfig) {
return new DefaultAutoTuneService(server, serverConfig);
}
}
@@ -1 +0,0 @@
package com.avaje.ebeaninternal.server.cache;
@@ -1,123 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import com.avaje.ebeaninternal.server.core.InternString;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanTable;
import com.avaje.ebeaninternal.server.deploy.meta.DeployTableJoin;
import com.avaje.ebeaninternal.server.deploy.meta.DeployTableJoinColumn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Used for associated beans in place of a BeanDescriptor. This is done to avoid
* recursion issues due to the potentially bi-directional and circular
* relationships between beans.
* <p>
* It holds the main deployment information and not all the detail that is held
* in a BeanDescriptor.
* </p>
*/
public class BeanTable {
private static final Logger logger = LoggerFactory.getLogger(BeanTable.class);
private final BeanDescriptorMap owner;
private final Class<?> beanType;
/**
* The base table.
*/
private final String baseTable;
private final BeanProperty[] idProperties;
/**
* Create the BeanTable.
*/
public BeanTable(DeployBeanTable mutable, BeanDescriptorMap owner) {
this.owner = owner;
this.beanType = mutable.getBeanType();
this.baseTable = InternString.intern(mutable.getBaseTable());
this.idProperties = mutable.createIdProperties(owner);
}
public String toString(){
return baseTable;
}
/**
* Return the base table for this BeanTable.
* This is used to determine the join information
* for associations.
*/
public String getBaseTable() {
return baseTable;
}
/**
* Gets the unqualified base table.
*
* @return the unqualified base table
*/
public String getUnqualifiedBaseTable(){
final String[] chunks = baseTable.split("\\.");
return chunks.length == 2 ? chunks[1] :chunks[0];
}
/**
* Return the Id properties.
*/
public BeanProperty[] getIdProperties() {
return idProperties;
}
/**
* Return the class for this beanTable.
*/
public Class<?> getBeanType() {
return beanType;
}
public void createJoinColumn(String foreignKeyPrefix, DeployTableJoin join, boolean reverse, String sqlFormulaSelect) {
boolean complexKey = false;
BeanProperty[] props = idProperties;
if (idProperties.length == 1){
if (idProperties[0] instanceof BeanPropertyAssocOne<?>) {
BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>)idProperties[0];
props = assocOne.getProperties();
complexKey = true;
}
}
for (BeanProperty prop : props) {
String lc = prop.getDbColumn();
String fk = lc;
if (foreignKeyPrefix != null) {
fk = owner.getNamingConvention().getForeignKey(foreignKeyPrefix, fk);
}
if (complexKey) {
// just to copy the column name rather than prefix with the foreignKeyPrefix.
// I think that with complex keys this is the more common approach.
logger.debug("On table[{}] foreign key column [{}]", baseTable, lc);
fk = lc;
}
if (sqlFormulaSelect != null) {
fk = sqlFormulaSelect;
}
DeployTableJoinColumn joinCol = new DeployTableJoinColumn(lc, fk);
joinCol.setForeignSqlFormula(sqlFormulaSelect);
if (reverse) {
joinCol = joinCol.reverse();
}
join.addJoinColumn(joinCol);
}
}
}
@@ -1,185 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import com.avaje.ebean.event.BeanPersistController;
import com.avaje.ebean.event.BeanPersistRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
/**
* Chains multiple BeanPersistController's together.
*
* Used when multiple BeanPersistController register for the same bean type.
*/
public class ChainedBeanPersistController implements BeanPersistController {
private static final Sorter SORTER = new Sorter();
private final List<BeanPersistController> list;
private final BeanPersistController[] chain;
/**
* Construct adding 2 BeanPersistController's.
*/
public ChainedBeanPersistController(BeanPersistController c1, BeanPersistController c2) {
this(addList(c1, c2));
}
/**
* Helper method used to create a list from 2 BeanPersistController's.
*/
private static List<BeanPersistController> addList(BeanPersistController c1, BeanPersistController c2) {
ArrayList<BeanPersistController> addList = new ArrayList<>(2);
addList.add(c1);
addList.add(c2);
return addList;
}
/**
* Construct given the list of BeanPersistController's.
*/
public ChainedBeanPersistController(List<BeanPersistController> list) {
this.list = list;
BeanPersistController[] c = list.toArray(new BeanPersistController[list.size()]);
Arrays.sort(c, SORTER);
this.chain = c;
}
/**
* Return the size of the chain.
*/
protected int size() {
return chain.length;
}
/**
* Register a new BeanPersistController and return the resulting chain.
*/
public ChainedBeanPersistController register(BeanPersistController c) {
if (list.contains(c)){
return this;
} else {
ArrayList<BeanPersistController> newList = new ArrayList<>();
newList.addAll(list);
newList.add(c);
return new ChainedBeanPersistController(newList);
}
}
/**
* De-register a BeanPersistController and return the resulting chain.
*/
public ChainedBeanPersistController deregister(BeanPersistController c) {
if (!list.contains(c)){
return this;
} else {
ArrayList<BeanPersistController> newList = new ArrayList<>();
newList.addAll(list);
newList.remove(c);
return new ChainedBeanPersistController(newList);
}
}
/**
* Always returns 0 (not used for this object).
*/
@Override
public int getExecutionOrder() {
return 0;
}
/**
* Always returns false (not used for this object).
*/
@Override
public boolean isRegisterFor(Class<?> cls) {
return false;
}
@Override
public void postDelete(BeanPersistRequest<?> request) {
for (BeanPersistController aChain : chain) {
aChain.postDelete(request);
}
}
@Override
public void postInsert(BeanPersistRequest<?> request) {
for (BeanPersistController aChain : chain) {
aChain.postInsert(request);
}
}
@Override
public void postUpdate(BeanPersistRequest<?> request) {
for (BeanPersistController aChain : chain) {
aChain.postUpdate(request);
}
}
@Override
public void postSoftDelete(BeanPersistRequest<?> request) {
for (BeanPersistController aChain : chain) {
aChain.postSoftDelete(request);
}
}
@Override
public boolean preDelete(BeanPersistRequest<?> request) {
for (BeanPersistController aChain : chain) {
if (!aChain.preDelete(request)) {
return false;
}
}
return true;
}
@Override
public boolean preSoftDelete(BeanPersistRequest<?> request) {
for (BeanPersistController aChain : chain) {
if (!aChain.preSoftDelete(request)) {
return false;
}
}
return true;
}
@Override
public boolean preInsert(BeanPersistRequest<?> request) {
for (BeanPersistController aChain : chain) {
if (!aChain.preInsert(request)) {
return false;
}
}
return true;
}
@Override
public boolean preUpdate(BeanPersistRequest<?> request) {
for (BeanPersistController aChain : chain) {
if (!aChain.preUpdate(request)) {
return false;
}
}
return true;
}
/**
* Helper to order the BeanPersistController's in a chain.
*/
private static class Sorter implements Comparator<BeanPersistController> {
public int compare(BeanPersistController o1, BeanPersistController o2) {
int i1 = o1.getExecutionOrder() ;
int i2 = o2.getExecutionOrder() ;
return (i1<i2 ? -1 : (i1==i2 ? 0 : 1));
}
}
}
@@ -1,109 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import com.avaje.ebean.event.BeanPersistListener;
/**
* Handles multiple BeanPersistListener's for a given entity type.
*/
public class ChainedBeanPersistListener implements BeanPersistListener {
private final List<BeanPersistListener> list;
private final BeanPersistListener[] chain;
/**
* Construct adding 2 BeanPersistListener's.
*/
ChainedBeanPersistListener(BeanPersistListener c1, BeanPersistListener c2) {
this(addList(c1, c2));
}
/**
* Return the size of the chain.
*/
protected int size() {
return chain.length;
}
@Override
public boolean isRegisterFor(Class<?> cls) {
// never called
return false;
}
/**
* Helper method used to create a list from 2 BeanPersistListener.
*/
private static List<BeanPersistListener> addList(BeanPersistListener c1, BeanPersistListener c2) {
ArrayList<BeanPersistListener> addList = new ArrayList<>(2);
addList.add(c1);
addList.add(c2);
return addList;
}
/**
* Construct given the list of BeanPersistListener's.
*/
public ChainedBeanPersistListener(List<BeanPersistListener> list) {
this.list = list;
this.chain = list.toArray(new BeanPersistListener[list.size()]);
}
/**
* Register a new BeanPersistListener and return the resulting chain.
*/
public ChainedBeanPersistListener register(BeanPersistListener c) {
if (list.contains(c)){
return this;
} else {
List<BeanPersistListener> newList = new ArrayList<>();
newList.addAll(list);
newList.add(c);
return new ChainedBeanPersistListener(newList);
}
}
/**
* De-register a BeanPersistListener and return the resulting chain.
*/
public ChainedBeanPersistListener deregister(BeanPersistListener c) {
if (!list.contains(c)){
return this;
} else {
ArrayList<BeanPersistListener> newList = new ArrayList<>();
newList.addAll(list);
newList.remove(c);
return new ChainedBeanPersistListener(newList);
}
}
public void deleted(Object bean) {
for (BeanPersistListener aChain : chain) {
aChain.deleted(bean);
}
}
public void softDeleted(Object bean) {
for (BeanPersistListener aChain : chain) {
aChain.softDeleted(bean);
}
}
public void inserted(Object bean) {
for (BeanPersistListener aChain : chain) {
aChain.inserted(bean);
}
}
public void updated(Object bean, Set<String> updatedProperties) {
for (BeanPersistListener aChain : chain) {
aChain.updated(bean, updatedProperties);
}
}
}
@@ -1,77 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import com.avaje.ebean.event.BeanPostLoad;
import java.util.ArrayList;
import java.util.List;
/**
* Handles multiple BeanPostLoad's for a given entity type.
*/
public class ChainedBeanPostLoad implements BeanPostLoad {
private final List<BeanPostLoad> list;
private final BeanPostLoad[] chain;
/**
* Construct given the list of BeanPostLoad's.
*/
public ChainedBeanPostLoad(List<BeanPostLoad> list) {
this.list = list;
this.chain = list.toArray(new BeanPostLoad[list.size()]);
}
/**
* Register a new BeanPostLoad and return the resulting chain.
*/
public ChainedBeanPostLoad register(BeanPostLoad c) {
if (list.contains(c)){
return this;
} else {
List<BeanPostLoad> newList = new ArrayList<>();
newList.addAll(list);
newList.add(c);
return new ChainedBeanPostLoad(newList);
}
}
/**
* De-register a BeanPostLoad and return the resulting chain.
*/
public ChainedBeanPostLoad deregister(BeanPostLoad c) {
if (!list.contains(c)){
return this;
} else {
ArrayList<BeanPostLoad> newList = new ArrayList<>();
newList.addAll(list);
newList.remove(c);
return new ChainedBeanPostLoad(newList);
}
}
/**
* Return the size of the chain.
*/
protected int size() {
return chain.length;
}
@Override
public boolean isRegisterFor(Class<?> cls) {
// never called
return false;
}
/**
* Fire postLoad on all registered BeanPostLoad implementations.
*/
@Override
public void postLoad(Object bean) {
for (BeanPostLoad aChain : chain) {
aChain.postLoad(bean);
}
}
}
@@ -1,96 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import com.avaje.ebean.event.BeanQueryAdapter;
import com.avaje.ebean.event.BeanQueryRequest;
/**
* Handles multiple BeanQueryAdapter for a given entity type.
*/
public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
private static final Sorter SORTER = new Sorter();
private final List<BeanQueryAdapter> list;
private final BeanQueryAdapter[] chain;
/**
* Construct given the list of BeanQueryAdapter's.
*/
public ChainedBeanQueryAdapter(List<BeanQueryAdapter> list) {
this.list = list;
BeanQueryAdapter[] c = list.toArray(new BeanQueryAdapter[list.size()]);
Arrays.sort(c, SORTER);
this.chain = c;
}
/**
* Register a new BeanQueryAdapter and return the resulting chain.
*/
public ChainedBeanQueryAdapter register(BeanQueryAdapter c) {
if (list.contains(c)){
return this;
} else {
List<BeanQueryAdapter> newList = new ArrayList<>();
newList.addAll(list);
newList.add(c);
return new ChainedBeanQueryAdapter(newList);
}
}
/**
* De-register a BeanQueryAdapter and return the resulting chain.
*/
public ChainedBeanQueryAdapter deregister(BeanQueryAdapter c) {
if (!list.contains(c)){
return this;
} else {
ArrayList<BeanQueryAdapter> newList = new ArrayList<>();
newList.addAll(list);
newList.remove(c);
return new ChainedBeanQueryAdapter(newList);
}
}
/**
* Return 0 as not used by this Chained adapter.
*/
public int getExecutionOrder() {
return 0;
}
/**
* Return false as only individual adapters are registered.
*/
public boolean isRegisterFor(Class<?> cls) {
return false;
}
public void preQuery(BeanQueryRequest<?> request) {
for (BeanQueryAdapter aChain : chain) {
aChain.preQuery(request);
}
}
/**
* Helper to order the BeanQueryAdapter's in a chain.
*/
private static class Sorter implements Comparator<BeanQueryAdapter> {
public int compare(BeanQueryAdapter o1, BeanQueryAdapter o2) {
int i1 = o1.getExecutionOrder() ;
int i2 = o2.getExecutionOrder() ;
return (i1<i2 ? -1 : (i1==i2 ? 0 : 1));
}
}
}
@@ -1,170 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import java.util.Set;
/**
* Converts logical property names to database columns.
*/
public abstract class DeployParser {
/**
* used to identify sql literal.
*/
protected static final char SINGLE_QUOTE = '\'';
/**
* used to identify query named parameters.
*/
protected static final char COLON = ':';
/**
* Used to determine when a column name terminates.
*/
protected static final char UNDERSCORE = '_';
/**
* Used to determine when a column name terminates.
*/
protected static final char PERIOD = '.';
protected boolean encrypted;
protected String source;
protected StringBuilder sb;
protected int sourceLength;
protected int pos;
protected String word;
protected char wordTerminator;
protected abstract String convertWord();
public abstract String getDeployWord(String expression);
/**
* Return the join includes.
*/
public abstract Set<String> getIncludes();
public void setEncrypted(boolean encrypted) {
this.encrypted = encrypted;
}
public String parse(String source) {
if (source == null) {
return null;
}
pos = -1;
this.source = source;
this.sourceLength = source.length();
this.sb = new StringBuilder(source.length() + 20);
while (nextWord()) {
String deployWord = convertWord();
sb.append(deployWord);
if (pos < sourceLength) {
sb.append(wordTerminator);
if (wordTerminator == SINGLE_QUOTE) {
readLiteral();
}
}
}
return sb.toString();
}
private boolean nextWord() {
if (!findWordStart()) {
return false;
}
StringBuilder wordBuffer = new StringBuilder();
wordBuffer.append(source.charAt(pos));
while (++pos < sourceLength) {
char ch = source.charAt(pos);
if (isWordPart(ch)) {
wordBuffer.append(ch);
} else {
wordTerminator = ch;
break;
}
}
word = wordBuffer.toString();
return true;
}
private boolean findWordStart() {
while (++pos < sourceLength) {
char ch = source.charAt(pos);
if (ch == SINGLE_QUOTE) {
// read a literal value and just
// append to string builder
sb.append(ch);
readLiteral();
} else if (ch == COLON) {
// read a named parameter
// just append to string builder
sb.append(ch);
readNamedParameter();
} else if (isWordStart(ch)) {
// its the start of a word that could
// be translated
return true;
} else {
sb.append(ch);
}
}
return false;
}
/**
* Read the rest of a literal value. These do not get translated so are just
* read and appended to the string builder.
*/
private void readLiteral() {
while (++pos < sourceLength) {
char ch = source.charAt(pos);
sb.append(ch);
if (ch == SINGLE_QUOTE) {
break;
}
}
}
/**
* Read a named parameter. These are not translated. They will be replaced
* by positioned parameters later.
*/
private void readNamedParameter() {
while (++pos < sourceLength) {
char ch = source.charAt(pos);
sb.append(ch);
if (Character.isWhitespace(ch)) {
break;
} else if (ch == ',') {
break;
}
}
}
/**
* return true if the char is a letter, digit or underscore.
*/
private boolean isWordPart(char ch) {
return Character.isLetterOrDigit(ch) || ch == UNDERSCORE || ch == PERIOD;
}
private boolean isWordStart(char ch) {
return Character.isLetter(ch);
}
}
@@ -1,52 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import java.util.HashSet;
import java.util.Set;
import com.avaje.ebeaninternal.server.el.ElPropertyDeploy;
/**
* Converts logical property names to database columns with table alias.
* <p>
* In doing so it builds an 'includes' set which becomes the joins required to
* support the properties parsed.
* </p>
*/
public final class DeployPropertyParser extends DeployParser {
private final BeanDescriptor<?> beanDescriptor;
private final Set<String> includes = new HashSet<>();
public DeployPropertyParser(BeanDescriptor<?> beanDescriptor) {
this.beanDescriptor = beanDescriptor;
}
public Set<String> getIncludes() {
return includes;
}
@Override
public String getDeployWord(String expression) {
ElPropertyDeploy elProp = beanDescriptor.getElPropertyDeploy(expression);
if (elProp == null){
return null;
} else {
addIncludes(elProp.getElPrefix());
return elProp.getElPlaceholder(encrypted);
}
}
@Override
public String convertWord() {
String r = getDeployWord(word);
return r == null ? word : r;
}
private void addIncludes(String prefix) {
if (prefix != null){
includes.add(prefix);
}
}
}
@@ -1,90 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import java.util.Set;
import com.avaje.ebeaninternal.server.el.ElPropertyDeploy;
/**
* For updates converts logical property names to database columns and bean type to base table.
*/
public final class DeployUpdateParser extends DeployParser {
private final BeanDescriptor<?> beanDescriptor;
public DeployUpdateParser(BeanDescriptor<?> beanDescriptor) {
this.beanDescriptor = beanDescriptor;
}
/**
* Return null as not used for updates.
*/
@Override
public Set<String> getIncludes() {
return null;
}
public String convertWord() {
String dbWord = getDeployWord(word);
if (dbWord != null) {
return dbWord;
}
// maybe tableAlias.propertyName
return convertSubword(0, word, null);
}
private String convertSubword(int start, String currentWord, StringBuilder localBuffer) {
int dotPos = currentWord.indexOf('.', start);
if (start == 0 && dotPos == -1){
return currentWord;
}
if (start == 0){
localBuffer = new StringBuilder();
}
if (dotPos == -1){
// no match...
localBuffer.append(currentWord.substring(start));
return localBuffer.toString();
}
// append up to the dot
localBuffer.append(currentWord.substring(start, dotPos+1));
if (dotPos == currentWord.length()-1){
// ends with a "." ???
return localBuffer.toString();
}
// get the remainder after the dot
start = dotPos+1;
String remainder = currentWord.substring(start, currentWord.length());
//String dbWord = deployMap.get(remainder.toLowerCase());
String dbWord = getDeployWord(remainder);
if (dbWord != null){
// we have found a match for the remainder
localBuffer.append(dbWord);
return localBuffer.toString();
} else {
//
return convertSubword(start, currentWord, localBuffer);
}
}
public String getDeployWord(String expression) {
if (expression.equalsIgnoreCase(beanDescriptor.getName())){
return beanDescriptor.getBaseTable();
}
ElPropertyDeploy elProp = beanDescriptor.getElPropertyDeploy(expression);
if (elProp != null){
return elProp.getDbColumn();
} else {
return null;
}
}
}
@@ -1,13 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
/**
* Used to visit all the InheritInfo in a single inheritance hierarchy.
*/
public interface InheritInfoVisitor {
/**
* visit the InheritInfo for this node.
*/
void visit(InheritInfo inheritInfo);
}
@@ -1,78 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
/**
* Helper object to find generic parameter types for a given class.
*/
public class ParamTypeUtil {
/**
* Find and return the parameter type given a generic interface or class.
* <p>
* This assumes there is only one generic parameter.
* </p>
* <p>
* Returns null if no match was found.
* </p>
* @param cls the class to search for the parameter type
* @param matchType the type which has the generic parameter
*/
public static Class<?> findParamType(Class<?> cls, Class<?> matchType) {
// search for: implementing a generic interface
Type paramType = matchByInterfaces(cls, matchType);
if (paramType == null){
// search for: extending a generic class
Type genericSuperclass = cls.getGenericSuperclass();
if (genericSuperclass != null){
paramType = matchParamType(genericSuperclass, matchType);
}
}
if (paramType instanceof Class<?>){
// only interested in classes
return (Class<?>)paramType;
} else {
return null;
}
}
/**
* Check if the type is a generic one with parameters and of the correct type we are
* searching for. Return the parameter type if this matches otherwise return null.
*/
private static Type matchParamType(Type type, Class<?> matchType) {
if (type instanceof ParameterizedType){
ParameterizedType pt = (ParameterizedType)type;
Type rawType = pt.getRawType();
boolean isAssignable = matchType.isAssignableFrom((Class<?>) rawType);
if (isAssignable) {
// assume there is only one parameter type
Type[] typeArguments = pt.getActualTypeArguments();
if (typeArguments.length != 1){
String m = "Expecting only 1 generic paramater but got "+typeArguments.length+" for "+type;
throw new RuntimeException(m);
}
return typeArguments[0];
}
}
return null;
}
/**
* Search the interfaces this class implements.
*/
private static Type matchByInterfaces(Class<?> cls, Class<?> matchType) {
Type[] gis = cls.getGenericInterfaces();
for (Type gi : gis) {
Type match = matchParamType(gi, matchType);
if (match != null) {
return match;
}
}
return null;
}
}
@@ -1,42 +0,0 @@
package com.avaje.ebeaninternal.server.deploy;
import com.avaje.ebean.event.BeanPersistListener;
import com.avaje.ebeaninternal.server.core.bootup.BootupClasses;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
/**
* Manages the assignment/registration of BeanPersistListener with their
* respective DeployBeanDescriptor's.
*/
public class PersistListenerManager {
private static final Logger logger = LoggerFactory.getLogger(PersistListenerManager.class);
private final List<BeanPersistListener> list;
public PersistListenerManager(BootupClasses bootupClasses) {
list = bootupClasses.getBeanPersistListeners();
}
public int getRegisterCount() {
return list.size();
}
/**
* Return the BeanPersistController for a given entity type.
*/
public <T> void addPersistListeners(DeployBeanDescriptor<T> deployDesc) {
for (BeanPersistListener listener : list) {
if (listener.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
deployDesc.addPersistListener(listener);
}
}
}
}
@@ -1,10 +0,0 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Helpers for Id property conversion</TITLE>
</HEAD>
<Body BGCOLOR="#ffffff">
Helpers for Id property conversion
</Body>
</HTML>
@@ -1,150 +0,0 @@
package com.avaje.ebeaninternal.server.deploy.meta;
import com.avaje.ebeaninternal.server.deploy.BeanCascadeInfo;
import com.avaje.ebeaninternal.server.deploy.BeanTable;
/**
* Abstract base for properties mapped to an associated bean, list, set or map.
*/
public abstract class DeployBeanPropertyAssoc<T> extends DeployBeanProperty {
/**
* The type of the joined bean.
*/
protected Class<T> targetType;
/**
* Persist settings.
*/
private final BeanCascadeInfo cascadeInfo = new BeanCascadeInfo();
/**
* The join table information.
*/
private BeanTable beanTable;
/**
* Join between the beans.
*/
protected final DeployTableJoin tableJoin = new DeployTableJoin();
/**
* Literal added to where clause of lazy loading query.
*/
private String extraWhere;
/**
* From the deployment mappedBy attribute.
*/
private String mappedBy;
private String docStoreDoc;
/**
* Construct the property.
*/
DeployBeanPropertyAssoc(DeployBeanDescriptor<?> desc, Class<T> targetType) {
super(desc, targetType, null, null);
this.targetType = targetType;
}
/**
* Return the target DeployBeanDescriptor for this associated bean property.
*/
public DeployBeanDescriptor<?> getTargetDeploy() {
return desc.getDeploy(targetType).getDescriptor();
}
/**
* Return the type of the target.
* <p>
* This is the class of the associated bean, or beans contained in a list,
* set or map.
* </p>
*/
public Class<T> getTargetType() {
return targetType;
}
/**
* Return a literal expression that is added to the query that lazy loads
* the collection.
*/
public String getExtraWhere() {
return extraWhere;
}
/**
* Set a literal expression to add to the query that lazy loads the
* collection.
*/
public void setExtraWhere(String extraWhere) {
this.extraWhere = extraWhere;
}
/**
* return the join to use for the bean.
*/
public DeployTableJoin getTableJoin() {
return tableJoin;
}
/**
* Return the BeanTable for this association.
* <p>
* This has the table name which is used to determine the relationship for
* this association.
* </p>
*/
public BeanTable getBeanTable() {
return beanTable;
}
/**
* Set the bean table.
*/
public void setBeanTable(BeanTable beanTable) {
this.beanTable = beanTable;
getTableJoin().setTable(beanTable.getBaseTable());
}
/**
* Get the persist info.
*/
public BeanCascadeInfo getCascadeInfo() {
return cascadeInfo;
}
/**
* Return the mappedBy deployment attribute.
* <p>
* This is the name of the property in the 'detail' bean that maps back to
* this 'master' bean.
* </p>
*/
public String getMappedBy() {
return mappedBy;
}
/**
* Set mappedBy deployment attribute.
*/
public void setMappedBy(String mappedBy) {
if (!"".equals(mappedBy)) {
this.mappedBy = mappedBy;
}
}
/**
* Set DocStoreEmbedded deployment information.
*/
public void setDocStoreEmbedded(String embeddedDoc) {
this.docStoreDoc = embeddedDoc;
}
public String getDocStoreDoc() {
return docStoreDoc;
}
}
@@ -1,209 +0,0 @@
package com.avaje.ebeaninternal.server.deploy.meta;
import com.avaje.ebean.bean.BeanCollection.ModifyListenMode;
import com.avaje.ebeaninternal.server.deploy.ManyType;
import com.avaje.ebeaninternal.server.deploy.TableJoin;
/**
* Property mapped to a List Set or Map.
*/
public class DeployBeanPropertyAssocMany<T> extends DeployBeanPropertyAssoc<T> {
/**
* The type of the many, set, list or map.
*/
final ManyType manyType;
ModifyListenMode modifyListenMode = ModifyListenMode.NONE;
/**
* Flag to indicate manyToMany relationship.
*/
boolean manyToMany;
/**
* Flag to indicate this is a unidirectional relationship.
*/
boolean unidirectional;
/**
* Join for manyToMany intersection table.
*/
DeployTableJoin intersectionJoin;
/**
* For ManyToMany this is the Inverse join used to build reference queries.
*/
DeployTableJoin inverseJoin;
String fetchOrderBy;
String mapKey;
String intersectionDraftTable;
/**
* Create this property.
*/
public DeployBeanPropertyAssocMany(DeployBeanDescriptor<?> desc, Class<T> targetType, ManyType manyType) {
super(desc, targetType);
this.manyType = manyType;
}
/**
* When generics is not used for manyType you can specify via annotations.
* <p>
* Really only expect this for Scala due to a Scala compiler bug at the moment.
* Otherwise I'd probably not bother support this.
* </p>
*/
@SuppressWarnings("unchecked")
public void setTargetType(Class<?> cls){
this.targetType = (Class<T>)cls;
}
/**
* Return the many type.
*/
public ManyType getManyType() {
return manyType;
}
/**
* Return true if this is many to many.
*/
public boolean isManyToMany() {
return manyToMany;
}
/**
* Set to true if this is a many to many.
*/
public void setManyToMany() {
this.manyToMany = true;
}
/**
* Return the mode for listening to changes to the List Set or Map.
*/
public ModifyListenMode getModifyListenMode() {
return modifyListenMode;
}
/**
* Set the mode for listening to changes to the List Set or Map.
*/
public void setModifyListenMode(ModifyListenMode modifyListenMode) {
this.modifyListenMode = modifyListenMode;
}
/**
* Return true if this is a unidirectional relationship.
*/
public boolean isUnidirectional() {
return unidirectional;
}
/**
* Set to true if this is a unidirectional relationship.
*/
public void setUnidirectional() {
this.unidirectional = true;
}
/**
* Create the immutable version of the intersection join.
*/
public TableJoin createIntersectionTableJoin() {
if (intersectionJoin != null){
return new TableJoin(intersectionJoin);
} else {
return null;
}
}
/**
* Create the immutable version of the inverse join.
*/
public TableJoin createInverseTableJoin() {
if (inverseJoin != null){
return new TableJoin(inverseJoin);
} else {
return null;
}
}
/**
* ManyToMany only, join from local table to intersection table.
*/
public DeployTableJoin getIntersectionJoin() {
return intersectionJoin;
}
public DeployTableJoin getInverseJoin() {
return inverseJoin;
}
/**
* ManyToMany only, join from local table to intersection table.
*/
public void setIntersectionJoin(DeployTableJoin intersectionJoin) {
this.intersectionJoin = intersectionJoin;
}
/**
* ManyToMany only, join from foreign table to intersection table.
*/
public void setInverseJoin(DeployTableJoin inverseJoin) {
this.inverseJoin = inverseJoin;
}
/**
* Return the order by clause used to order the fetching of the data for
* this list, set or map.
*/
public String getFetchOrderBy() {
return fetchOrderBy;
}
/**
* Return the default mapKey when returning a Map.
*/
public String getMapKey() {
return mapKey;
}
/**
* Set the default mapKey to use when returning a Map.
*/
public void setMapKey(String mapKey) {
if (mapKey != null && !mapKey.isEmpty()) {
this.mapKey = mapKey;
}
}
/**
* Set the order by clause used to order the fetching or the data for this
* list, set or map.
*/
public void setFetchOrderBy(String orderBy) {
if (orderBy != null && !orderBy.isEmpty()) {
fetchOrderBy = orderBy;
}
}
/**
* Return a draft table for intersection between 2 @Draftable entities.
*/
public String getIntersectionDraftTable() {
return (intersectionDraftTable != null) ? intersectionDraftTable : intersectionJoin.getTable();
}
/**
* ManyToMany between 2 @Draftable entities to also need draft intersection table.
*/
public void setIntersectionDraftTable() {
this.intersectionDraftTable = intersectionJoin.getTable()+"_draft";
}
}
@@ -1,90 +0,0 @@
package com.avaje.ebeaninternal.server.deploy.meta;
import java.util.List;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptorMap;
import com.avaje.ebeaninternal.server.deploy.BeanProperty;
import com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocOne;
/**
* Used for associated beans in place of a BeanDescriptor. This is done to avoid
* recursion issues due to the potentially bi-directional and circular
* relationships between beans.
* <p>
* It holds the main deployment information and not all the detail that is held
* in a BeanDescriptor.
* </p>
*/
public class DeployBeanTable {
private final Class<?> beanType;
/**
* The base table.
*/
private String baseTable;
private List<DeployBeanProperty> idProperties;
/**
* Create the BeanTable.
*/
public DeployBeanTable(Class<?> beanType) {
this.beanType = beanType;
}
/**
* Return the base table for this BeanTable.
* This is used to determine the join information
* for associations.
*/
public String getBaseTable() {
return baseTable;
}
/**
* Set the base table for this BeanTable.
*/
public void setBaseTable(String baseTable) {
this.baseTable = baseTable;
}
/**
* Return the id properties.
*/
public BeanProperty[] createIdProperties(BeanDescriptorMap owner) {
BeanProperty[] props = new BeanProperty[idProperties.size()];
for (int i = 0; i < idProperties.size(); i++) {
props[i] = createProperty(owner, idProperties.get(i));
}
return props;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private BeanProperty createProperty(BeanDescriptorMap owner, DeployBeanProperty prop){
if (prop instanceof DeployBeanPropertyAssocOne<?>){
return new BeanPropertyAssocOne(owner, (DeployBeanPropertyAssocOne<?>)prop);
} else {
return new BeanProperty(prop);
}
}
/**
* Set the Id properties.
*/
public void setIdProperties(List<DeployBeanProperty> idProperties) {
this.idProperties = idProperties;
}
/**
* Return the class for this beanTable.
*/
public Class<?> getBeanType() {
return beanType;
}
}
@@ -1,185 +0,0 @@
package com.avaje.ebeaninternal.server.deploy.meta;
import javax.persistence.JoinColumn;
import com.avaje.ebeaninternal.server.deploy.BeanProperty;
import com.avaje.ebeaninternal.server.deploy.BeanTable;
/**
* A join pair of local and foreign properties.
*/
public class DeployTableJoinColumn {
/**
* The local database column name.
*/
String localDbColumn;
/**
* SQL formula used for local column
*/
String localSqlFormula;
/**
* The foreign database column name.
*/
String foreignDbColumn;
/**
* SQL formula used for foreign column
*/
String foreignSqlFormula;
boolean insertable;
boolean updateable;
/**
* Construct when automatically determining the join.
* <p>
* Assume that we want the foreign key to be insertable and updateable.
* </p>
*/
public DeployTableJoinColumn(String localDbColumn, String foreignDbColumn) {
this(localDbColumn, foreignDbColumn, true, true);
}
/**
* Construct with explicit insertable and updateable flags.
*/
public DeployTableJoinColumn(String localDbColumn, String foreignDbColumn, boolean insertable, boolean updateable) {
this.localDbColumn = nullEmptyString(localDbColumn);
this.foreignDbColumn = nullEmptyString(foreignDbColumn);
this.insertable = insertable;
this.updateable = updateable;
}
public void setLocalSqlFormula(String localSqlFormula) {
if (localSqlFormula != null) {
this.localSqlFormula = localSqlFormula;
this.localDbColumn = null;
this.insertable = false;
this.updateable = false;
}
}
public String getLocalSqlFormula() {
return localSqlFormula;
}
public void setForeignSqlFormula(String foreignSqlFormula) {
if (foreignSqlFormula != null) {
this.foreignSqlFormula = foreignSqlFormula;
this.foreignDbColumn = null;
this.insertable = false;
this.updateable = false;
}
}
public String getForeignSqlFormula() {
return foreignSqlFormula;
}
public DeployTableJoinColumn(boolean order, JoinColumn jc, BeanTable beanTable) {
this(jc.referencedColumnName(), jc.name(), jc.insertable(), jc.updatable());
setReferencedColumn(beanTable);
if (!order){
reverse();
}
}
private void setReferencedColumn(BeanTable beanTable){
if (localDbColumn == null){
BeanProperty[] idProperties = beanTable.getIdProperties();
if (idProperties.length == 1){
localDbColumn = idProperties[0].getDbColumn();
}
}
}
/**
* Reverse the direction of the join.
*/
public DeployTableJoinColumn reverse() {
String temp = localDbColumn;
localDbColumn = foreignDbColumn;
foreignDbColumn = temp;
temp = localSqlFormula;
localSqlFormula = foreignSqlFormula;
foreignSqlFormula = temp;
return this;
}
/**
* Helper method to null out empty strings.
*/
private String nullEmptyString(String s){
if ("".equals(s)){
return null;
}
return s;
}
public DeployTableJoinColumn copy(boolean reverse) {
// Note that the insertable and updateable are just copied
// which may not always be the correct thing to do
// but will leave it like this for now
DeployTableJoinColumn ret;
if (reverse){
ret = new DeployTableJoinColumn(foreignDbColumn, localDbColumn, insertable, updateable);
ret.setLocalSqlFormula(foreignSqlFormula);
ret.setForeignSqlFormula(localSqlFormula);
} else {
ret = new DeployTableJoinColumn(localDbColumn, foreignDbColumn, insertable, updateable);
ret.setLocalSqlFormula(localSqlFormula);
ret.setForeignSqlFormula(foreignSqlFormula);
}
return ret;
}
public String toString() {
return localDbColumn + " = " + foreignDbColumn;
}
/**
* Return true if this column should be insertable.
*/
public boolean isInsertable() {
return insertable;
}
/**
* Return true if this column should be updateable.
*/
public boolean isUpdateable() {
return updateable;
}
/**
* Return the foreign database column name.
*/
public String getForeignDbColumn() {
return foreignDbColumn;
}
/**
* Return the local database column name.
*/
public String getLocalDbColumn() {
return localDbColumn;
}
/**
* Set the local database column name.
*/
public void setLocalDbColumn(String localDbColumn) {
this.localDbColumn = localDbColumn;
}
}
@@ -1,10 +0,0 @@
<html>
<head>
<meta HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
<title>Temporary objects used to collect deployment information</title>
</head>
<body BGCOLOR="#ffffff">
Temporary objects used to collect deployment information
</body>
</html>
@@ -1,14 +0,0 @@
<html>
<head>
<meta HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
<title>Bean description</title>
</head>
<body BGCOLOR="#ffffff">
Bean description
<p>
Describes beans with their properties and configuration.
</p>
</body>
</html>
@@ -1,92 +0,0 @@
package com.avaje.ebeaninternal.server.deploy.parse;
import com.avaje.ebean.RawSql;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanPropertyAssocOne;
import com.avaje.ebeaninternal.server.deploy.meta.DeployTableJoin;
import com.avaje.ebeaninternal.server.query.SqlJoinType;
import java.util.HashMap;
/**
* Wraps information about a bean during deployment parsing.
*/
public class DeployBeanInfo<T> {
/**
* Holds TableJoins for secondary table properties.
*/
private final HashMap<String,DeployTableJoin> tableJoinMap = new HashMap<>();
private final DeployUtil util;
private final DeployBeanDescriptor<T> descriptor;
/**
* Create with a DeployUtil and BeanDescriptor.
*/
public DeployBeanInfo(DeployUtil util, DeployBeanDescriptor<T> descriptor) {
this.util = util;
this.descriptor = descriptor;
}
public String toString() {
return ""+descriptor;
}
/**
* Return the BeanDescriptor currently being processed.
*/
public DeployBeanDescriptor<T> getDescriptor() {
return descriptor;
}
/**
* Return the DeployUtil we are using.
*/
public DeployUtil getUtil() {
return util;
}
/**
* Appropriate TableJoin for a property mapped to a secondary table.
*/
public DeployTableJoin getTableJoin(String tableName) {
String key = tableName.toLowerCase();
DeployTableJoin tableJoin = tableJoinMap.get(key);
if (tableJoin == null) {
tableJoin = new DeployTableJoin();
tableJoin.setTable(tableName);
tableJoin.setType(SqlJoinType.INNER);
descriptor.addTableJoin(tableJoin);
tableJoinMap.put(key, tableJoin);
}
return tableJoin;
}
/**
* Set a the join alias for a assoc one property.
*/
public void setBeanJoinType(DeployBeanPropertyAssocOne<?> beanProp, boolean outerJoin) {
DeployTableJoin tableJoin = beanProp.getTableJoin();
tableJoin.setType(outerJoin ? SqlJoinType.OUTER : SqlJoinType.INNER);
}
/**
* Add named RawSql from ebean.xml.
*/
public void addRawSql(String name, RawSql rawSql) {
descriptor.addRawSql(name, rawSql);
}
/**
* Add the named query.
*/
public void addNamedQuery(String name, String query) {
descriptor.addNamedQuery(name, query);
}
}
@@ -1,78 +0,0 @@
package com.avaje.ebeaninternal.server.deploy.parse;
import java.util.HashSet;
/**
* Keywords deemed inappropriate for use as table alias' column or table name.
* <p>
* That is, they might cause sql syntax errors if used.
* </p>
*/
public class SqlReservedWords {
private static final String baseKeyWords =
"ALIAS,ALTER,ADD,ALL,ARE,AND,ANY,ARRAY"
+",AS,ASC,AT"
+",AVG,BEGIN,BETWEEN,BIGINT,BINARY,BIT,BIT_LENGTH,BLOB,BOOLEAN"
+",BOTH,BY,CALL,CALLED,CASCADE,CASCADED,CASE,CAST,CATALOG,CHAR"
+",CHARACTER,CHECK,CLOB,CLOSE,COALESCE,COLLATE"
+",COLLATION,COLUMN,COMMIT,CONDITION,CONNECT,CONNECTION,CONSTRAINT"
+",CONSTRAINTS,CONSTRUCTOR,CONTAINS,CONTINUE,CONVERT"
+",COUNT,CREATE,CROSS,CURRENT_DATE"
+",CURRENT_PATH,CURRENT_ROLE,CURRENT_TIME,CURRENT_TIMESTAMP"
+",CURRENT_USER,CURSOR,DATE"
+",DAY,DEC,DECIMAL,DECLARE,DEFAULT,DELETE"
+",DESC"
+",DISTINCT,DO,DOUBLE,DROP,ELSE,ELSEIF,END,EQUALS"
+",EXEC,EXIT,EXISTS,EXTRACT"
+",FLOAT,FROM,FOR,FREE"
+",GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR"
+",IF,IN,INNER,INOUT,INSERT"
+",INT,INTEGER,INTO,IS,JOIN"
+",LAST,LIKE,LIMIT"
+",MAX,MIN"
+",NCHAR,NCLOB,NOT"
+",NULL,NULLIF,NUMERIC,"
+",OR,ORDER,OUTER"
+",REAL,REF,REFERENCES"
+",RETURN,RETURNS"
+",SELECT,SSL"
+",SMALLINT,"
+",SYSTEM,SYSTEM_USER,TABLE"
+",TO"
+",TRIGGER,UNION,UNIQUE"
+",UPDATE,USER,VARCHAR,VIEW,WHEN"
+",WHERE,WITH";
private static final HashSet<String> keywords = new HashSet<>();
static {
String[] initialKeywords = baseKeyWords.split(",");
for (String initialKeyword : initialKeywords) {
keywords.add(initialKeyword.trim());
}
}
/**
* Return true if the tableAlias is a keyword.
*/
public static synchronized boolean isKeyword(String keyword){
String s = keyword.trim().toUpperCase();
return keywords.contains(s);
}
/**
* Add a sql keyword to the known set.
*/
public static synchronized void addKeyword(String keyword){
if (keyword != null){
keyword = keyword.trim().toUpperCase();
if (!keyword.isEmpty()){
keywords.add(keyword);
}
}
}
}
@@ -1,48 +0,0 @@
package com.avaje.ebeaninternal.server.deploy.parse;
import java.util.List;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanProperty;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanPropertyAssocMany;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanPropertyAssocOne;
/**
* Mark transient properties.
*/
public class TransientProperties {
public TransientProperties() {
}
/**
* Mark any additional properties as transient.
*/
public void process(DeployBeanDescriptor<?> desc) {
List<DeployBeanProperty> props = desc.propertiesBase();
for (DeployBeanProperty prop : props) {
if (!prop.isDbRead() && !prop.isDbInsertable() && !prop.isDbUpdateable()) {
// non-transient...
prop.setTransient();
}
}
List<DeployBeanPropertyAssocOne<?>> ones = desc.propertiesAssocOne();
for (DeployBeanPropertyAssocOne<?> prop : ones) {
if (prop.getBeanTable() == null) {
if (!prop.isEmbedded()) {
prop.setTransient();
}
}
}
List<DeployBeanPropertyAssocMany<?>> manys = desc.propertiesAssocMany();
for (DeployBeanPropertyAssocMany<?> prop : manys) {
if (prop.getBeanTable() == null) {
prop.setTransient();
}
}
}
}
@@ -1,16 +0,0 @@
<!ELEMENT ebean (table | iudextender | findextender | datasource | primarykeys | property)* >
<!ELEMENT table EMPTY >
<!ATTLIST table name CDATA #REQUIRED>
<!ELEMENT iudextender EMPTY >
<!ATTLIST iudextender classname CDATA #REQUIRED>
<!ELEMENT findextender EMPTY >
<!ATTLIST findextender classname CDATA #REQUIRED>
<!ELEMENT datasource EMPTY >
<!ATTLIST datasource name CDATA #REQUIRED>
<!ELEMENT primarykeys EMPTY >
<!ATTLIST primarykeys keys CDATA #REQUIRED>
<!ELEMENT property EMPTY >
<!ATTLIST property name CDATA #REQUIRED
datatype CDATA #REQUIRED
deploydatatype CDATA #IMPLIED
deployname CDATA #IMPLIED >
@@ -1,11 +0,0 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Deployment information parsing</TITLE>
</HEAD>
<Body BGCOLOR="#ffffff">
Deployment information parsing
</Body>
</HTML>
@@ -1 +0,0 @@
package com.avaje.ebeaninternal.server.el;
@@ -1,292 +0,0 @@
package com.avaje.ebeaninternal.server.lib.util;
import java.util.HashMap;
import java.util.Map;
/**
* Utility String class that supports String manipulation functions.
*/
public class StringHelper {
/**
* Parses out a list of Name Value pairs that are delimited together. Will
* always return a StringMap. If allNameValuePairs is null, or no name
* values can be parsed out an empty StringMap is returned.
*
* @param allNameValuePairs the entire string to be parsed.
* @param listDelimiter (typically ';') the delimited between the list
* @param nameValueSeparator (typically '=') the separator between the name and value
*/
public static Map<String, String> delimitedToMap(String allNameValuePairs,
String listDelimiter, String nameValueSeparator) {
HashMap<String, String> params = new HashMap<>();
if ((allNameValuePairs == null) || (allNameValuePairs.isEmpty())) {
return params;
}
// trim off any leading listDelimiter...
allNameValuePairs = trimFront(allNameValuePairs, listDelimiter);
return getKeyValue(params, 0, allNameValuePairs, listDelimiter, nameValueSeparator);
}
/**
* Trims off recurring strings from the front of a string.
*
* @param source the source string
* @param trim the string to trim off the front
*/
public static String trimFront(String source, String trim) {
if (source == null) {
return null;
}
if (source.indexOf(trim) == 0) {
// dp("trim ...");
return trimFront(source.substring(trim.length()), trim);
} else {
return source;
}
}
/**
* Return true if the value is null or an empty string.
*/
public static boolean isNull(String value) {
return value == null || value.trim().isEmpty();
}
/**
* Recursively pulls out the key value pairs from a raw string.
*/
private static HashMap<String, String> getKeyValue(HashMap<String, String> map, int pos,
String allNameValuePairs, String listDelimiter, String nameValueSeparator) {
if (pos >= allNameValuePairs.length()) {
// dp("end as "+pos+" >= "+allNameValuePairs.length() );
return map;
}
int equalsPos = allNameValuePairs.indexOf(nameValueSeparator, pos);
int delimPos = allNameValuePairs.indexOf(listDelimiter, pos);
if (delimPos == -1) {
delimPos = allNameValuePairs.length();
}
if (equalsPos == -1) {
// dp("no more equals...");
return map;
}
if (delimPos == (equalsPos + 1)) {
// dp("Ignoring as nothing between delim and equals...
// delim:"+delimPos+" eq:"+equalsPos);
return getKeyValue(map, delimPos + 1, allNameValuePairs, listDelimiter,
nameValueSeparator);
}
if (equalsPos > delimPos) {
// there is a key without a value?
String key = allNameValuePairs.substring(pos, delimPos);
key = key.trim();
if (!key.isEmpty()) {
map.put(key, null);
}
return getKeyValue(map, delimPos + 1, allNameValuePairs, listDelimiter,
nameValueSeparator);
}
String key = allNameValuePairs.substring(pos, equalsPos);
if (delimPos > -1) {
String value = allNameValuePairs.substring(equalsPos + 1, delimPos);
// dp("cont "+key+","+value+" pos:"+pos+"
// len:"+allNameValuePairs.length());
key = key.trim();
map.put(key, value);
pos = delimPos + 1;
// recurse the rest of the values...
return getKeyValue(map, pos, allNameValuePairs, listDelimiter, nameValueSeparator);
} else {
// dp("ERROR: delimPos < 0 ???");
return map;
}
}
/**
* This method takes a String and will replace all occurrences of the match
* String with that of the replace String.
*
* @param source the source string
* @param match the string used to find a match
* @param replace the string used to replace match with
* @return the source string after the search and replace
*/
public static String replaceString(String source, String match, String replace) {
if (source == null) {
return null;
}
if (replace == null) {
return source;
}
if (match == null) {
throw new NullPointerException("match is null?");
}
if (match.equals(replace)) {
return source;
}
return replaceString(source, match, replace, 30, 0, source.length());
}
/**
* Additionally specify the additionalSize to add to the buffer. This will
* make the buffer bigger so that it doesn't have to grow when replacement
* occurs.
*/
public static String replaceString(String source, String match, String replace,
int additionalSize, int startPos, int endPos) {
if (source == null) {
return null;
}
char match0 = match.charAt(0);
int matchLength = match.length();
if (matchLength == 1 && replace.length() == 1) {
char replace0 = replace.charAt(0);
return source.replace(match0, replace0);
}
if (matchLength >= replace.length()) {
additionalSize = 0;
}
int sourceLength = source.length();
int lastMatch = endPos - matchLength;
StringBuilder sb = new StringBuilder(sourceLength + additionalSize);
if (startPos > 0) {
sb.append(source.substring(0, startPos));
}
char sourceChar;
boolean isMatch;
int sourceMatchPos;
for (int i = startPos; i < sourceLength; i++) {
sourceChar = source.charAt(i);
if (i > lastMatch || sourceChar != match0) {
sb.append(sourceChar);
} else {
// check to see if this is a match
isMatch = true;
sourceMatchPos = i;
// check each following character...
for (int j = 1; j < matchLength; j++) {
sourceMatchPos++;
if (source.charAt(sourceMatchPos) != match.charAt(j)) {
isMatch = false;
break;
}
}
if (isMatch) {
i = i + matchLength - 1;
sb.append(replace);
} else {
// was not a match
sb.append(sourceChar);
}
}
}
return sb.toString();
}
/**
* A search and replace with multiple matching strings.
* <p>
* Useful when converting CRNL CR and NL all to a BR tag for example.
* </p>
* <p>
* <pre><code>
* String[] multi = { &quot;\r\n&quot;, &quot;\r&quot;, &quot;\n&quot; };
* content = StringHelper.replaceStringMulti(content, multi, &quot;&lt;br/&gt;&quot;);
* </code></pre>
*/
public static String replaceStringMulti(String source, String[] match, String replace) {
return replaceStringMulti(source, match, replace, 30, 0, source.length());
}
/**
* Additionally specify an additional size estimate for the buffer plus
* start and end positions.
* <p>
* The start and end positions can limit the search and replace. Otherwise
* these default to startPos = 0 and endPos = source.length().
* </p>
*/
public static String replaceStringMulti(String source, String[] match, String replace,
int additionalSize, int startPos, int endPos) {
int shortestMatch = match[0].length();
char[] match0 = new char[match.length];
for (int i = 0; i < match0.length; i++) {
match0[i] = match[i].charAt(0);
if (match[i].length() < shortestMatch) {
shortestMatch = match[i].length();
}
}
StringBuilder sb = new StringBuilder(source.length() + additionalSize);
char sourceChar;
int len = source.length();
int lastMatch = endPos - shortestMatch;
if (startPos > 0) {
sb.append(source.substring(0, startPos));
}
int matchCount;
for (int i = startPos; i < len; i++) {
sourceChar = source.charAt(i);
if (i > lastMatch) {
sb.append(sourceChar);
} else {
matchCount = 0;
for (int k = 0; k < match0.length; k++) {
if (matchCount == 0 && sourceChar == match0[k]) {
if (match[k].length() + i <= len) {
++matchCount;
int j = 1;
for (; j < match[k].length(); j++) {
if (source.charAt(i + j) != match[k].charAt(j)) {
--matchCount;
break;
}
}
if (matchCount > 0) {
i = i + j - 1;
sb.append(replace);
break;
}
}
}
}
if (matchCount == 0) {
sb.append(sourceChar);
}
}
}
return sb.toString();
}
}
@@ -1 +0,0 @@
package com.avaje.ebeaninternal.server.loadcontext;
@@ -1 +0,0 @@
package com.avaje.ebeaninternal.server.query;
@@ -1 +0,0 @@
package com.avaje.ebeaninternal.server.querydefn;
@@ -1 +0,0 @@
package com.avaje.ebeaninternal.server.text.csv;
@@ -1,38 +0,0 @@
package com.avaje.ebeaninternal.server.type;
import java.util.Set;
/**
* Wraps a Set for the purposes of detecting modifications.
*/
public class ModifyAwareSet<E> extends ModifyAwareCollection<E> implements Set<E>, ModifyAwareOwner {
/**
* Create with an Owner that is notified of modifications.
*/
public ModifyAwareSet(ModifyAwareOwner owner, Set<E> s) {
super(owner, s);
}
/**
* Create as top level with it's own ModifyAwareOwner instance wrapping the given Set.
*/
public ModifyAwareSet(Set<E> s) {
super(new ModifyAwareFlag(), s);
}
@Override
public boolean isMarkedDirty() {
return owner.isMarkedDirty();
}
@Override
public void markAsModified() {
owner.markAsModified();
}
@Override
public void resetMarkedDirty() {
owner.resetMarkedDirty();
}
}
@@ -1,51 +0,0 @@
package com.avaje.ebeaninternal.server.type;
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
import org.joda.time.DateMidnight;
import java.sql.Date;
import java.sql.Types;
/**
* ScalarType for Joda DateMidnight. This maps to a JDBC Date.
*/
public class ScalarTypeJodaDateMidnight extends ScalarTypeBaseDate<DateMidnight> {
/**
* Instantiates a new scalar type joda date midnight.
*/
public ScalarTypeJodaDateMidnight() {
super(DateMidnight.class, false, Types.DATE);
}
@Override
public long convertToMillis(DateMidnight value) {
return value.getMillis();
}
@Override
public DateMidnight convertFromDate(Date ts) {
return new DateMidnight(ts.getTime());
}
@Override
public Date convertToDate(DateMidnight t) {
return new Date(t.getMillis());
}
@Override
public Object toJdbcType(Object value) {
if (value instanceof DateMidnight) {
return new Date(((DateMidnight) value).getMillis());
}
return BasicTypeConverter.toDate(value);
}
@Override
public DateMidnight toBeanType(Object value) {
if (value instanceof java.util.Date) {
return new DateMidnight(((java.util.Date) value).getTime());
}
return (DateMidnight) value;
}
}
@@ -1,26 +0,0 @@
package com.avaje.ebeanservice.docstore.api;
import com.avaje.ebean.text.json.JsonReadOptions;
import com.avaje.ebeaninternal.api.SpiQuery;
/**
* A Query request for the document store.
*/
public interface DocQueryRequest<T> {
/**
* Return the query for this request.
*/
SpiQuery<T> getQuery();
/**
* Create JsonReadOptions taking into account persistence context and lazy loading support.
*/
JsonReadOptions createJsonReadOptions();
/**
* Execute secondary queries.
*/
void executeSecondaryQueries(boolean forEach);
}
@@ -1,4 +0,0 @@
/**
* Mapping for document store integration.
*/
package com.avaje.ebeanservice.docstore.api.mapping;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Administrative control of AutoTune during runtime.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.beans.PropertyChangeListener;
import java.util.Map;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.sql.CallableStatement;
import java.sql.SQLException;
@@ -73,8 +73,8 @@ import java.sql.SQLException;
* }
* }</pre>
*
* @see com.avaje.ebean.SqlUpdate
* @see com.avaje.ebean.Ebean#execute(CallableSql)
* @see SqlUpdate
* @see Ebean#execute(CallableSql)
*/
public interface CallableSql {
@@ -1,6 +1,6 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.RawSql.ColumnMapping;
import io.ebean.RawSql.ColumnMapping;
import javax.persistence.PersistenceException;
import java.util.ArrayList;
@@ -1,7 +1,7 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.RawSql.Sql;
import com.avaje.ebeaninternal.server.querydefn.SimpleTextParser;
import io.ebean.RawSql.Sql;
import io.ebeaninternal.server.querydefn.SimpleTextParser;
/**
* Parses sql-select queries to try and determine the location where WHERE and
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Bean holding the details to update the document store.
@@ -1,6 +1,7 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebeanservice.docstore.api.DocQueryRequest;
import io.ebeanservice.docstore.api.DocQueryRequest;
import io.ebeanservice.docstore.api.RawDoc;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
@@ -165,6 +166,24 @@ public interface DocumentStore {
*/
<T> void findEachWhile(DocQueryRequest<T> query, Predicate<T> consumer);
/**
* Find each processing raw documents.
*
* @param indexNameType The full index name and type
* @param rawQuery The query to execute
* @param consumer Consumer to process each document
*/
void findEach(String indexNameType, String rawQuery, Consumer<RawDoc> consumer);
/**
* Find each processing raw documents stopping when the predicate returns false.
*
* @param indexNameType The full index name and type
* @param rawQuery The query to execute
* @param consumer Consumer to process each document until false is returned
*/
void findEachWhile(String indexNameType, String rawQuery, Predicate<RawDoc> consumer);
/**
* Process the queue entries sending updates to the document store or queuing them for later processing.
*/
@@ -1,9 +1,9 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.cache.ServerCacheManager;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.text.csv.CsvReader;
import com.avaje.ebean.text.json.JsonContext;
import io.ebean.cache.ServerCacheManager;
import io.ebean.config.ServerConfig;
import io.ebean.text.csv.CsvReader;
import io.ebean.text.json.JsonContext;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1012,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>
@@ -1,11 +1,11 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.cache.ServerCacheManager;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.meta.MetaInfoManager;
import com.avaje.ebean.plugin.SpiServer;
import com.avaje.ebean.text.csv.CsvReader;
import com.avaje.ebean.text.json.JsonContext;
import io.ebean.cache.ServerCacheManager;
import io.ebean.config.ServerConfig;
import io.ebean.meta.MetaInfoManager;
import io.ebean.plugin.SpiServer;
import io.ebean.text.csv.CsvReader;
import io.ebean.text.json.JsonContext;
import org.jetbrains.annotations.Nullable;
import javax.persistence.NonUniqueResultException;
@@ -232,9 +232,9 @@ public interface EbeanServer {
*
* // Find order additionally fetching the customer, details and details.product name.
*
* String eql = "fetch customer fetch details fetch details.product (name) where id = :orderId ";
* String ormQuery = "fetch customer fetch details fetch details.product (name) where id = :orderId ";
*
* Query<Order> query = Ebean.createQuery(Order.class, eql);
* Query<Order> query = Ebean.createQuery(Order.class, ormQuery);
* query.setParameter("orderId", 2);
*
* Order order = query.findUnique();
@@ -251,11 +251,11 @@ public interface EbeanServer {
* }</pre>
*
* @param beanType The type of bean to fetch
* @param eql The Ebean query
* @param ormQuery The Ebean ORM 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);
<T> Query<T> createQuery(Class<T> beanType, String ormQuery);
/**
* Create a query for a type of entity bean.
@@ -298,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>
@@ -885,7 +907,7 @@ 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#findFutureCount()
* @see Query#findFutureCount()
*/
<T> FutureRowCount<T> findFutureCount(Query<T> query, Transaction transaction);
@@ -900,7 +922,7 @@ public interface EbeanServer {
* @param query the query to execute the fetch Id's on
* @param transaction the transaction (can be null).
* @return a Future object for the list of Id's
* @see com.avaje.ebean.Query#findFutureIds()
* @see Query#findFutureIds()
*/
<T> FutureIds<T> findFutureIds(Query<T> query, Transaction transaction);
@@ -1,9 +1,9 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.common.SpiContainer;
import com.avaje.ebean.config.ContainerConfig;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebeaninternal.server.lib.ShutdownManager;
import io.ebean.common.SpiContainer;
import io.ebean.config.ContainerConfig;
import io.ebean.config.ServerConfig;
import io.ebeaninternal.server.lib.ShutdownManager;
import javax.persistence.PersistenceException;
import java.lang.reflect.Constructor;
@@ -30,7 +30,7 @@ import java.util.Properties;
public class EbeanServerFactory {
private static final String DEFAULT_CONTAINER = "com.avaje.ebeaninternal.server.core.DefaultContainer";
private static final String DEFAULT_CONTAINER = "io.ebeaninternal.server.core.DefaultContainer";
private static SpiContainer container;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Query by Example expression.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.util.Collection;
import java.util.Map;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* An expression that is part of a WHERE or HAVING clause.
@@ -1,10 +1,10 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.search.Match;
import com.avaje.ebean.search.MultiMatch;
import com.avaje.ebean.search.TextCommonTerms;
import com.avaje.ebean.search.TextQueryString;
import com.avaje.ebean.search.TextSimple;
import io.ebean.search.Match;
import io.ebean.search.MultiMatch;
import io.ebean.search.TextCommonTerms;
import io.ebean.search.TextQueryString;
import io.ebean.search.TextSimple;
import java.util.Collection;
import java.util.List;
@@ -1,10 +1,10 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.search.Match;
import com.avaje.ebean.search.MultiMatch;
import com.avaje.ebean.search.TextCommonTerms;
import com.avaje.ebean.search.TextQueryString;
import com.avaje.ebean.search.TextSimple;
import io.ebean.search.Match;
import io.ebean.search.MultiMatch;
import io.ebean.search.TextCommonTerms;
import io.ebean.search.TextQueryString;
import io.ebean.search.TextSimple;
import org.jetbrains.annotations.Nullable;
import javax.persistence.NonUniqueResultException;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.io.Serializable;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.util.Set;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.util.List;
import java.util.Set;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import org.jetbrains.annotations.Nullable;
@@ -18,7 +18,7 @@ import java.util.List;
* </p>
* <pre>{@code
*
* public class CustomerFinder extends Finder<Customer> {
* public class CustomerFinder extends Finder<Long,Customer> {
*
* public CustomerFinder() {
* super(Customer.class);
@@ -31,7 +31,7 @@ import java.util.List;
* }
*
* public List<Customer> findNew() {
* return query()
* return query().where()
* .eq("status", Customer.Status.NEW)
* .orderBy("name")
* .findList()
@@ -157,4 +157,17 @@ 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);
}
/**
* Creates a query using the ORM query language.
*/
public Query<T> query(String ormQuery) {
return db().createQuery(type, ormQuery);
}
}
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.util.List;
import java.util.concurrent.Future;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import javax.persistence.PersistenceException;
import java.util.List;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.util.concurrent.Future;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Represents a Conjunction or a Disjunction.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Used to specify the type of like matching used.
@@ -32,4 +32,4 @@ public enum LikeType {
* </p>
*/
EQUAL_TO
}
}
@@ -1,6 +1,6 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.bean.EntityBean;
import io.ebean.bean.EntityBean;
import javax.persistence.MappedSuperclass;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.io.Serializable;
import java.util.ArrayList;
@@ -162,6 +162,7 @@ public final class OrderBy<T> implements Serializable {
list.add(p);
}
@Override
public String toString() {
return list.toString();
}
@@ -201,6 +202,7 @@ public final class OrderBy<T> implements Serializable {
* Return a hash value for this OrderBy. This can be to determine logical
* equality for OrderBy clauses.
*/
@Override
public int hashCode() {
return list.hashCode();
}
@@ -255,9 +257,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;
}
@@ -276,6 +278,7 @@ public final class OrderBy<T> implements Serializable {
return highLow != null ? highLow.equals(e.highLow) : e.highLow == null;
}
@Override
public String toString() {
return toStringFormat();
}
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.util.List;
import java.util.concurrent.Future;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Defines the scope for PersistenceContext.
@@ -6,8 +6,8 @@ package com.avaje.ebean;
* Ebean has traditionally used Transaction scope for the PersistenceContext. This is used to change the scope to
* use (by default) and explicitly set the scope to use for an individual query.
*
* @see com.avaje.ebean.config.ServerConfig#setPersistenceContextScope(PersistenceContextScope)
* @see com.avaje.ebean.Query#setPersistenceContextScope(PersistenceContextScope)
* @see io.ebean.config.ServerConfig#setPersistenceContextScope(PersistenceContextScope)
* @see Query#setPersistenceContextScope(PersistenceContextScope)
*/
public enum PersistenceContextScope {
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import javax.persistence.PersistenceException;
@@ -1,6 +1,6 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.config.PropertyMap;
import io.ebean.config.PropertyMap;
import java.util.Properties;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import org.jetbrains.annotations.Nullable;
@@ -243,7 +243,7 @@ public interface Query<T> {
/**
* Specify the PersistenceContextScope to use for this query.
* <p/>
* When this is not set the 'default' configured on {@link com.avaje.ebean.config.ServerConfig#setPersistenceContextScope(PersistenceContextScope)}
* When this is not set the 'default' configured on {@link io.ebean.config.ServerConfig#setPersistenceContextScope(PersistenceContextScope)}
* is used - this value defaults to {@link PersistenceContextScope#TRANSACTION}.
* <p/>
* Note that the same persistence Context is used for subsequent lazy loading and query join queries.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.util.Iterator;
@@ -61,20 +61,24 @@ public interface QueryIterator<T> extends Iterator<T>, java.io.Closeable {
/**
* Returns <tt>true</tt> if the iteration has more elements.
*/
@Override
boolean hasNext();
/**
* Returns the next element in the iteration.
*/
@Override
T next();
/**
* Remove is not allowed.
*/
@Override
void remove();
/**
* Close the underlying resources held by this iterator.
*/
@Override
void close();
}
@@ -1,6 +1,6 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.util.CamelCaseHelper;
import io.ebean.util.CamelCaseHelper;
import java.io.Serializable;
import java.sql.ResultSet;
@@ -292,6 +292,7 @@ public final class RawSql implements Serializable {
this.distinct = distinct;
}
@Override
public String toString() {
if (!parsed) {
return "unparsed[" + unparsedSql + "]";
@@ -636,12 +637,13 @@ 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;
}
@Override
public String toString() {
return dbColumn + "->" + propertyName;
}
@@ -724,8 +726,8 @@ public final class RawSql implements Serializable {
@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,7 +1,7 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.RawSql.ColumnMapping;
import com.avaje.ebean.RawSql.Sql;
import io.ebean.RawSql.ColumnMapping;
import io.ebean.RawSql.Sql;
import java.sql.ResultSet;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.io.Serializable;
import java.util.List;
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.io.Serializable;
import java.math.BigDecimal;
@@ -39,16 +39,19 @@ public interface SqlRow extends Serializable, Map<String, Object> {
/**
* Remove a property from the map. Returns the value of the removed property.
*/
@Override
Object remove(Object name);
/**
* Return a property value by its name.
*/
@Override
Object get(Object name);
/**
* Set a value to a property.
*/
@Override
Object put(String name, Object value);
/**
@@ -118,51 +121,61 @@ public interface SqlRow extends Serializable, Map<String, Object> {
/**
* String description of the underlying map.
*/
@Override
String toString();
/**
* Clear the map.
*/
@Override
void clear();
/**
* Returns true if the map contains the property.
*/
@Override
boolean containsKey(Object key);
/**
* Returns true if the map contains the value.
*/
@Override
boolean containsValue(Object value);
/**
* Returns the entrySet of the map.
*/
@Override
Set<Map.Entry<String, Object>> entrySet();
/**
* Returns true if the map is empty.
*/
@Override
boolean isEmpty();
/**
* Returns the key set of the map.
*/
@Override
Set<String> keySet();
/**
* Put all the values from t into this map.
*/
@Override
void putAll(Map<? extends String, ?> t);
/**
* Return the size of the map.
*/
@Override
int size();
/**
* Return the values from this map.
*/
@Override
Collection<Object> values();
}
}
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* A SqlUpdate for executing insert update or delete statements.
@@ -50,7 +50,7 @@ public interface SqlUpdate {
* {@link Transaction#setBatchSize(int)}.
* </p>
*
* @see com.avaje.ebean.Ebean#execute(SqlUpdate)
* @see Ebean#execute(SqlUpdate)
*/
int execute();
@@ -1,9 +1,8 @@
package com.avaje.ebean;
package io.ebean;
import com.avaje.ebean.annotation.DocStoreMode;
import com.avaje.ebean.config.DocStoreConfig;
import com.avaje.ebean.config.PersistBatch;
import com.avaje.ebean.config.ServerConfig;
import io.ebean.annotation.DocStoreMode;
import io.ebean.config.DocStoreConfig;
import io.ebean.config.ServerConfig;
import javax.persistence.PersistenceException;
import javax.persistence.RollbackException;
@@ -324,7 +323,7 @@ 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)
* @see io.ebean.config.ServerConfig#setPersistBatch(PersistBatch)
*/
void setBatch(PersistBatch persistBatchMode);
@@ -345,7 +344,7 @@ 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)
* @see io.ebean.config.ServerConfig#setPersistBatchOnCascade(PersistBatch)
*/
void setBatchOnCascade(PersistBatch batchOnCascadeMode);
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Provides a callback that can be registered with a Transaction.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Adapter that can be extended for easier implementation of TransactionCallback.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Execute a TxCallable in a Transaction scope.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Execute a TxRunnable in a Transaction scope.
@@ -1,6 +1,4 @@
package com.avaje.ebean;
import com.avaje.ebean.config.PersistBatch;
package io.ebean;
import java.util.ArrayList;
@@ -103,6 +101,7 @@ public final class TxScope {
/**
* Describes this TxScope instance.
*/
@Override
public String toString() {
return "TxScope[" + type + "] readOnly[" + readOnly + "] isolation[" + isolation
+ "] serverName[" + serverName + "] rollbackFor[" + rollbackFor + "] noRollbackFor[" + noRollbackFor + "]";
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* An Insert Update or Delete statement.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* An update query typically intended to perform a bulk update of many rows that match the query.
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
/**
* Holds two values as the result of a difference comparison.
@@ -51,6 +51,7 @@ public class ValuePair {
this.oldValue = oldValue;
}
@Override
public String toString() {
return newValue + "," + oldValue;
}
@@ -1,4 +1,4 @@
package com.avaje.ebean;
package io.ebean;
import java.sql.Timestamp;
import java.util.Map;
@@ -1,8 +1,8 @@
package com.avaje.ebean.annotation;
package io.ebean.annotation;
import com.avaje.ebean.TxIsolation;
import com.avaje.ebean.TxType;
import com.avaje.ebean.config.PersistBatch;
import io.ebean.TxIsolation;
import io.ebean.TxType;
import io.ebean.PersistBatch;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -20,7 +20,7 @@ import java.lang.annotation.Target;
* <ul>
* <li>EJB's javax.ejb.TransactionAttribute</li>
* <li>Spring's org.springframework.transaction.annotation.Transactional</li>
* <li>and this one, Ebean's own com.avaje.ebean.annotation.Transactional</li>
* <li>and this one, Ebean's own Transactional</li>
* </ul>
* Spring created their one because the EJB annotation does not support features
* such as isolation level and specifying rollbackOn, noRollbackOn exceptions.
@@ -0,0 +1,4 @@
/**
* Transactional annotations.
*/
package io.ebean.annotation;
@@ -1,6 +1,6 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
import com.avaje.ebean.ExpressionList;
import io.ebean.ExpressionList;
import java.io.Serializable;
import java.util.Collection;
@@ -1,4 +1,4 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
/**
* Interface to define the addition of a bean to the underlying collection.
@@ -1,4 +1,4 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
/**
* Loads a entity bean collection.
@@ -1,4 +1,4 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
/**
* Loads a entity bean.
@@ -1,4 +1,4 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
import java.io.Serializable;
import java.util.Arrays;
@@ -32,14 +32,16 @@ public final class CallStack implements Serializable {
this.pathHash = enc(pathHash);
}
@Override
public int hashCode() {
int hc = 0;
for (StackTraceElement aCallStack : callStack) {
hc = 31 * hc + aCallStack.hashCode();
hc = 92821 * hc + aCallStack.hashCode();
}
return hc;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -79,6 +81,7 @@ public final class CallStack implements Serializable {
return pathHash;
}
@Override
public String toString() {
return zeroHash + ":" + pathHash + ":" + callStack[0];
}
@@ -1,4 +1,4 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
/**
* Marker interface for classes enhanced to support Transactional methods.
@@ -1,4 +1,4 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
@@ -1,7 +1,7 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.ValuePair;
import io.ebean.Ebean;
import io.ebean.ValuePair;
import javax.persistence.EntityNotFoundException;
import javax.persistence.PersistenceException;
@@ -696,40 +696,42 @@ public final class EntityBeanIntercept implements Serializable {
/**
* Return a dirty property hash taking into account embedded beans.
*/
public int getDirtyPropertyHash() {
return addDirtyPropertyHash(37);
public StringBuilder getDirtyPropertyKey() {
StringBuilder sb = new StringBuilder();
addDirtyPropertyKey(sb);
return sb;
}
/**
* Add and return a dirty property hash recursing into embedded beans.
*/
public int addDirtyPropertyHash(int hash) {
private void addDirtyPropertyKey(StringBuilder sb) {
int len = getPropertyLength();
for (int i = 0; i < len; i++) {
if (changedProps != null && changedProps[i]) {
// the property has been changed on this bean
hash = hash * 31 + (i + 1);
sb.append(i).append(',');
} else if (embeddedDirty != null && embeddedDirty[i]) {
// an embedded property has been changed - recurse
EntityBean embeddedBean = (EntityBean) owner._ebean_getField(i);
hash = hash * 31 + embeddedBean._ebean_getIntercept().addDirtyPropertyHash(hash);
sb.append(i).append('[');
embeddedBean._ebean_getIntercept().addDirtyPropertyKey(sb);
sb.append(']');
}
}
return hash;
}
/**
* Return a loaded property hash.
*/
public int getLoadedPropertyHash() {
int hash = 37;
public StringBuilder getLoadedPropertyKey() {
StringBuilder sb = new StringBuilder();
int len = getPropertyLength();
for (int i = 0; i < len; i++) {
if (isLoadedProperty(i)) {
hash = hash * 31 + (i + 1);
sb.append(i).append(',');
}
}
return hash;
return sb;
}
/**
@@ -857,7 +859,7 @@ public final class EntityBeanIntercept implements Serializable {
loadedProps[propertyIndex] = true;
}
private final void preGetterCallback() {
private void preGetterCallback() {
if (preGetterCallback != null) {
preGetterCallback.preGetterTrigger();
}
@@ -1,4 +1,4 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
import java.lang.ref.WeakReference;
import java.util.LinkedHashSet;
@@ -120,6 +120,7 @@ public final class NodeUsageCollector {
return loadProperty;
}
@Override
public String toString() {
return node + " read:" + used + " modified:" + modified;
}
@@ -1,4 +1,4 @@
package com.avaje.ebean.bean;
package io.ebean.bean;
/**
* Collects the profile information.

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