Commit Graph

390 Commits

Author SHA1 Message Date
Oliver Gierke
240ace24f3 DATAJPA-265 - Further polishing.
Original pull request: #50.
2013-11-12 12:04:20 +01:00
Oliver Gierke
80e1777a5b DATAJPA-265 - Improve implementation of AuditingBeanFactoryPostProcessor.
Polished the implementation of AuditingBeanFactoryPostProcessor to selectively add depends-on clauses to all bean definitions that will result in EntityManagerFactory instances eventually. Added unit tests to verify intended behavior for Java based configuration. Polished newly integrated test cases.

Removed obsolete code from AuditingEntityListener. Added configuration sample snippet. Polished reference documentation.

Original pull request: #50.
2013-11-11 20:43:07 +01:00
Thomas Darimont
44806cb7f1 DATAJPA-265 - Support for auditing configuration via JavaConfig.
Introduces the necessary infrastructure to configure auditing with JPA via JavaConfig using @EnableJpaAuditing.

Original pull request: #50.
2013-11-11 20:20:05 +01:00
Thomas Darimont
23e27f3332 DATAJPA-424 - Fixed alias detection in manually defined queries using SpEL.
ExpressionBasedStringQuery now resolves and evaluates SpEL expressions of the actual query in the constructor and passes the resolved query to the StringQuery constructor. This enables the alias detection mechanism to work properly.

Original pull request: #51
2013-11-07 13:50:46 +01:00
Oliver Gierke
9a279f83cf DATAJPA-419 - Adapt to new non-lazy-instantiation model of repositories.
Mostly mayor cleanups the way test cases bootstrap the repositories as they're now instantiated eagerly.
2013-11-05 16:41:48 +01:00
Oliver Gierke
e3b0148383 DATAJPA-405 - Guard against null predicates on query creation.
We now only call CriteriaQuery.where(…) if the predicate we handle is a non-null value. Adapted Jpa(Count)QueryCreator accordingly.
2013-10-27 17:41:50 +01:00
Oliver Gierke
d4d352584d DATAJPA-481 - Upgraded to Spring Framework 3.2.4.
Upgraded to Spring Data Build 1.3.0.BUILD-SNAPSHOT to benefit from upgrade to Spring Framework 3.2.4.

Made the sample mapping file in test folder a valid XML document to prevent Eclipse from marking it as error.
2013-10-27 17:41:50 +01:00
Oliver Gierke
5be0897d08 DATAJPA-481 - Upgraded to Spring Framework 3.2.4.
Upgraded to Spring Data Build 1.3.0.BUILD-SNAPSHOT to benefit from upgrade to Spring Framework 3.2.4.
2013-10-25 19:43:06 +02:00
Oliver Gierke
33216534be DATAJPA-415 - Polishing.
Simplified implementation of ParameterBinder.convertToCollectionIfNecessary(…).

Added a simpler test case for plain query execution and ignored that for EclipseLink and OpenJpa as it fails with both the EclipseLink and OpenJpa versions we currently rely on. See the ignored test cases for links to bug reports.

Original pull request: #45.
2013-10-22 16:42:11 +02:00
Thomas Darimont
2636f59304 DATAJPA-415 - Convert array parameter values to Collection if necessary.
In order to support query methods with array-typed parameters (e.g. parameters passed in as varargs) correctly we have to convert such an array into a collection. Previously we passed those parameters as is which led to Exceptions in EclipseLink and Hibernate, e.g. Hibernate: IllegalArgumentException: Encountered array-valued parameter binding, but was expecting [java.lang.Integer].
2013-10-22 14:35:03 +02:00
Oliver Gierke
b99508fbf9 DATAJPA-416 - Polishing.
Refer to the JPA ticket instead of the DATACMNS one. Use Repository instead of JpaRepository in test cases. Some code formatting.

Original pull request: #46.
2013-10-22 14:23:04 +02:00
Thomas Darimont
2b08a05085 DATAJPA-416 - Add support for nested repositories.
Support for considering nested repository interfaces can now be configured on the EnableJpaRepositories annotation via the considerNestedRepositories property. Previously nested repository definitions were ignored by the repositories infrastructure. This depends on DATACMNS-90.

Original pull request: #46.
2013-10-22 14:21:27 +02:00
Oliver Gierke
e7505b40a5 DATAJPA-83 - Added getOne(ID id) to JpaRepository.
Added a getOne(ID id) method to both JpaRepository as well as SimpleJpaRepository to be able to obtain references to entities (as implemented by EntityManager.getReference(…)).
2013-10-07 17:00:45 +02:00
Oliver Gierke
b8c81e9a2f DATAJPA-409 - Added unit test for count query creation for nested references. 2013-10-03 19:31:01 +02:00
Thomas Darimont
18f89afa78 DATAJPA-407 - Fixes potential IndexOutOfBoundsException in ClasspathScanningPersistenceUnitPostProcessor.
So far, ClasspathScanningPersistenceUnitPostProcessor threw an IndexOutOfBoundsException on Windows as the OS-specific file separator doesn't match the forward slash used in the URI. This is fixed by modified scanForMappingFileLocations() to use '/' to build up the resource path.

Original pull request: #44.
2013-10-01 15:40:28 +02:00
Thomas Darimont
32f0f7830d DATAJPA-406 - Fix documentation of default value in @Modifying.
Corrected documentation to reflect the actual state of the @Modifying annotation which is that the clearAutomatically attribute is set to false by default. The implications of setting this attribute to true (which causes all pending non-flushed changes to be dropped) are now stated clearly.

Original pull request: #43.
2013-10-01 13:46:02 +02:00
Thomas Darimont
b6fbda9770 DATAJPA-396 - Fixed potential multi-threading issues in PartTreeJpaQuery.
The CriteriaQuery implementations unfortunately is not thread-safe for some persistence providers. E.g. Hibernate changes the state of it's implementation during the first attempt to use the instance. This causes multi-threading issues if we cache the query instance for later usage (as the instance might be used concurrently).

We now synchronize the first usage of the cached CriteriaQuery instance to guard against this situation.

Original pull request: #42.
2013-09-30 18:53:37 +02:00
Thomas Darimont
3735464ec2 DATAJPA-389 - Introduce NativeSqlQuery type for native sql queries.
Extracted the functionality specific to the handling of native queries out of SimpleJpaQuery and moved that to the new NativeJpaQuery type. Moved common functionality to AbstractStringBasedJpaQuery and used that as a new base class for SimpleJpaQuery and NativeJpaQuery. Introduced JpqQueryFactory to centralize construction of JpaQuery objects. Renamed getQuery() method in StringQuery to getQueryString().

Original pull request: #36.
2013-09-26 12:15:53 +02:00
Oliver Gierke
0a11d30aac DATAJPA-401 - Non-optional associations don't trigger join creation anymore.
When building Expression instances for attribute traversals we now inspect the mapping annotation to detect non-optional associations and prevent an extra left join from being created. This is because the join is only necessary to not drop null values from the result.

Added integration tests for Hibernate, EclipseLink and OpenJpa. EclipseLink needs a bit of special treatment as it exposes the inner join being created for a plain ….get(…) attribute traversal.
2013-09-25 12:11:50 +02:00
Oliver Gierke
4b7c413f5b DATAJPA-403 - Improve predicate building by reusing existing joins if possible.
QueryUtils now checks already existing joins and reuses them when building expressions. Inspired by the pull request #41 by Alexandre Payment but polished and added integration test to make sure the joins really get reused.
2013-09-25 09:33:55 +02:00
Thomas Darimont
8c1e4c20ea DATAJPA-398 - Added test case for overriding CRUD method with @Query.
Added test case to verify that it is possible to adjust the query of well known repository interface methods like findAll() via @Query.

Original pull request: #38.
2013-09-24 14:52:16 +02:00
Thomas Darimont
e9eecab14d DATAJPA-399 - Add Java Config example to readme.md.
Added java config and replaced the xml version.
Added reference to new SD JPA Guide as well as Spring-Boot and the latest version of SD JPA 1.4.1.
2013-09-23 16:10:23 +02:00
Thomas Darimont
c6c4a3b344 DATAJPA-386 - Prepare for next iteration.
Updated pom.xml to refer to the current version of SD Commons 1.7.0.BUILD-SNAPSHOT.
2013-09-18 13:19:15 +02:00
Spring Buildmaster
2a2255dca9 DATAJPA-386 - Prepare next development iteration. 2013-09-09 15:30:01 -07:00
Spring Buildmaster
0e2663e9a4 DATAJPA-386 - Release version 1.4.0.RELEASE. 2013-09-09 15:29:59 -07:00
Thomas Darimont
d41a466b4d DATAJPA-386 - Prepare 1.4.0 Release. 2013-09-09 15:26:18 -07:00
Thomas Darimont
63082054bf Fixed project name in readme.md 2013-08-27 14:27:02 +02:00
Oliver Gierke
dfff8ef174 DATACMNS-357 - Test case for new state detection for entities with primitive ids.
Ignore test case for EclipseLink as it throws an exception complaining about long being used where Long is expected.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=415027
2013-08-14 10:16:11 +02:00
Oliver Gierke
e5e4b4dd3b DATAJPA-347 - Upgrade to Spring Data Commons 1.6.0.BUILD-SNAPSHOT. 2013-08-14 09:24:53 +02:00
Oliver Gierke
0b9e711315 DATAJPA-375 - Fixed application of sort to queries with existing order by.
Improved existingin order by detection to detect the existing clause independent of the case. Before we only detected lower case "order by" expressions.
2013-08-13 13:06:48 +02:00
Dale Wijand
e65dec893d DATAJPA-392 - Fixed typo in package-info.java of utility package.
Original pull request: #17.
2013-08-13 12:09:23 +02:00
Oliver Gierke
a1b939f6ab DATAJPA-388 - CDI extension now detects @Alternative EntityManagers.
We now make sure an alternative EntityManager (producer) is overriding a previously found EntityManager. Vice versa, we do not override a previously found one, except it marked as alternative.
2013-08-12 13:08:24 +02:00
Oliver Gierke
fd8b7b6a00 DATAJPA-391 - Added test case to show projections for manually defined queries. 2013-08-09 19:21:35 +02:00
Thomas Darimont
0ce929a429 DATAJPA-367 - Issue error for missing spring-aspects.jar if auditing is enabled in xml config.
As the auditing feature requires spring-aspects.jar on the classpath we issue now check whether the jar is present - if not we issue an appropriate error message. Added appropriate note to the JPA reference doc. Added test case to AuditingBeanDefinitionParserTests to verify that a XMLParserError message is emitted if the required class from spring-aspects is not on the class path.

Original pull request: #34.
2013-08-09 11:33:48 +02:00
Thomas Darimont
2456b244c3 DATAJPA-381 - Remove Hibernate specific test in PartTreeJpaQueryIntegrationTests.
Dropped the test case shouldSetTemporalQueryParameterToTimestamp(…) for DATAJPA-107 in PartTreeJpaQueryIntegrationTests as it uses Hibernate specific API, esp. API that is not available anymore in Hibernate 4.1.

Original pull request: #33.
2013-08-05 16:54:16 +02:00
Spring Buildmaster
1f571ad751 DATAJPA-347 - Prepare nexte development iteration. 2013-08-01 09:18:13 -07:00
Spring Buildmaster
5505f9cd60 DATAJPA-347 - Release version 1.4.0.RC1. 2013-08-01 09:18:09 -07:00
Oliver Gierke
d4119dcdbe DATAJPA-379 - Prepare 1.4.0.RC1 release.
Upgraded to Spring Data Build parent 1.1.1.RELEASE. Upgraded to Spring Data Commons 1.6.0.RC1. Switched to milestone repository. Adapted documentation references to RC1 of SPring Data Commons. Updated changelog, notice and readme.
2013-08-01 18:07:32 +02:00
Thomas Darimont
22b1f6fa1b DATAJPA-344 - Explain about save strategy repositories in ref doc.
Added section "entity persistence" to the reference documentation explaining the supported strategies for the detection of new-entities.

Original pull request: #32.
2013-07-30 18:22:32 +02:00
Thomas Darimont
619c1e6a55 DATAJPA-107 - Add support to specify TemporalType for Date query parameters.
Introduced JpaParameters abstraction to support custom jpa-specific annotations on query parameters. Adjusted Parameter binders to use the JpaParameters abstraction. Added special handling for temporal JpaParameters to ParameterBinder.bind(…) and CriteriaQueryParameterBinder.bind(…).

Adapted changes introduced in DATACMNS-350. Original pull request: #31.
2013-07-30 15:09:07 +02:00
Thomas Darimont
fbb88e8c76 DATAJPA-346 - EclipseLink specific workaround for joins in QueryUtils.
Added fix in QueryUtils to work around an EclipseLinks specialty to add strict joins on a call to root.get(…) even if a later root.join(…, JoinType.LEFT) should trump this.

We needed the first call to examine the metamodel of the path obtained to decide whether to join at all in next steps. We now work around this issue by doing a lot of ugly type checking and casting on the Metamodel directly.

We filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=413892 to maybe let EclipseLink improve at that point.

Original pull request: #30.
2013-07-29 12:06:12 +02:00
Thomas Darimont
6824cc158e DATAJPA-269 - Add support for derived identifier of nested composite keys.
Extended JpaMetamodelEntityInformation to deal with entities with custom composite keys for which we have to derive the identifier. Introduced IdentifierDerivingDirectFieldAccessFallbackBeanWrapper that is capable of deriving identifier values. Added test case to verify the support for save / load of entities with custom composite keys.

Original pull request: #28.
2013-07-26 15:32:45 +02:00
Thomas Darimont
5e5f494ac5 DATAJPA-377 - Remove "order by"-part from generated count query.
Adjusted createCountQueryFor(…) in QueryUtils to leave out the order by part in the generated query. This avoids problems with databases that require columns specified in the order by clause to be in the select / group by list for count queries (e.g. H2). In addition to that this should give us a little performance boost if the database did not already optimize the query execution.

Original pull request: #29.
2013-07-25 21:31:30 +02:00
Oliver Gierke
153999d141 DATAJPA-376 - PersistentProperty now considers JPA @Transient.
JpaPersistentPropertyImpl is now considered persistent if it carries a @javax.persistence.Transient annotation. This should allow persistence providers to safely generate additional fields and not cause trouble in the mapping framework this way.
2013-07-25 10:34:21 +02:00
Thomas Darimont
34854d2f02 DATAJPA-370 - Added missing package-info.java files. 2013-07-24 10:05:53 +02:00
Oliver Gierke
295424feb2 DATAJPA-373 - Fixed potential NullPointerException in StringQuery. 2013-07-24 09:56:22 +02:00
Thomas Darimont
3fd4fd1abe DATAJPA-368 - Added documentation of SpEL expression in @Query(…).
Added appropriate sections to chapter 2. Fixed type in native query example.
Updated author information on the index page.

Original pull request: #26.
2013-07-17 16:02:42 +02:00
Thomas Darimont
528363e125 DATAJPA-170 - Add support for SpEL in query expressions.
Introduced ExpressionBasedStringQuery to support the SpEL expression template rendering. This allows manually defined queries in either @Query or Spring Data named queries to use SpEL and reference the #entityName. Changed SimpleJpaQuery to use ExpressionBasedStringQuery by default. Added test case for repositories with SpEL expression based query methods.

Original pull request: #25.
2013-07-17 10:38:13 +02:00
Thomas Darimont
f25032abfa DATAJPA-353 - Fixed mapping file locations detected by CPSPUPP to conform to the JPA spec.
Adjusted scanForMappingFileLocations(…) in ClasspathScanningPersistenceUnitPostProcessor to resolve the paths to class-path loadable paths. Updated test cases accordingly. Added test case and required resources to verify that mapping files with recursive wildcard pattern can be found from multiple locations in class path.

Original pull request: #24.
2013-07-16 17:33:11 +02:00
Oliver Gierke
4ff0671105 DATAJPA-148 - Remove qualification of sort reference for functions.
When applying Sort instances we now check for the presence of a ( which indicates a function to be executed.
2013-06-27 22:19:01 +02:00