Commit Graph

804 Commits

Author SHA1 Message Date
Oliver Gierke
f2acbdd3eb DATAJPA-997 - Release version 2.0 M1 (Kay). 2016-11-23 10:35:47 +01:00
Oliver Gierke
e30c4c0138 DATAJPA-997 - Prepare 2.0 M1 (Kay). 2016-11-23 10:35:08 +01:00
Oliver Gierke
8e20bff03d DATAJPA-997 - Updated changelog. 2016-11-23 10:34:55 +01:00
Oliver Gierke
b1faf8fe24 DATAJPA-998 - Prepare 2.0 development.
Upgraded to Spring Data build parent and Commons in 2.0. No upgrade to Spring 5 yet as it requires Hibernate 5 which currently breaks our tests, mostly because of [0].

Added workaround for compiler ambiguities that stem from the upgrade to 1.8 as compile target [1]. Temporarily removed tests for JpaSort for the same reason.

Adapted to API changes in DefaultResourceLoader in preparation of the move to Spring 5.

[0] https://hibernate.atlassian.net/browse/HHH-10690
[1] http://mail.openjdk.java.net/pipermail/compiler-dev/2016-November/010521.html
2016-11-16 15:05:50 +01:00
Oliver Gierke
3bba394b7d DATAJPA-1000 - Fixed alias detection for fetch joins.
We now ignore potentially defined fetch expressions in joins when detecting aliases inside joins.
2016-11-11 10:09:32 +01:00
Oliver Gierke
84fd3bcc39 DATAJPA-977 - Updated changelog. 2016-11-03 18:56:36 +01:00
Oliver Gierke
c5fa1024b1 DATAJPA-993 - Polishing.
Original pull request: #180.
2016-11-03 16:43:20 +01:00
Stanislav Bashkyrtsev
2fbdd53493 DATAJPA-993 - Improved example of infrastructure setup in reference documentation.
Previously EntityManagerFactory was created manually which resulted in LocalContainerEntityManagerFactoryBean not being exposed to
ApplicationContext. The latter is an important bean since it enables
exception translation.

Original pull request: #180.
2016-11-03 16:43:20 +01:00
Oliver Gierke
1477c18994 DATAJPA-790 - Polishing.
JavaDoc, formattgin, license years, author headers.

Related tickets: DATAJPA-684
Original pull request: #182.
2016-11-03 16:43:18 +01:00
Jocelyn Ntakpe
3f5467dc85 DATAJPA-790 - QueryException when applying @EntityGraph on findAll(Predicate,Pageable).
We now create the count query that's required for pagination queries without applying the query hints.

Related tickets: DATAJPA-684
Original pull request: #182.
2016-11-03 11:25:46 +01:00
Michał Niczyporuk
b2426d89ed DATAJPA-992 - Fixed package name in JavaDoc for AuditingEntityListener.
Original pull request: #183.
2016-11-03 10:47:12 +01:00
Oliver Gierke
ba40a4b857 DATAJPA-978 - Upgraded Hibernate 5.2 build profile to 5.2.4. 2016-10-28 11:17:03 +02:00
Oliver Gierke
fc073672af DATAJPA-984 - Improved translation of one-element tuples in projections.
If a query returns a one-element tuple and that single element returned is type-compatible to the type to be returned we return it as is. Previously, we insisted on creating a Map from the tuple (which usually works for projection interfaces).

This is needed to support custom simple types (i.e. types that the JPA provider can convert itself but which are not exposed through the metamodel - usually types managed through JPA AttributeConverters or provider specific conversion mechanisms).
2016-10-21 09:10:20 +02:00
Oliver Gierke
a71e513476 DATAJPA-978 - Upgraded Hibernate 5.2 build profile to 5.2.3. 2016-10-21 09:10:18 +02:00
Oliver Gierke
8756765866 DATAJPA-966 - Updated changelog. 2016-09-29 14:41:59 +02:00
Oliver Gierke
1a4ebb5eeb DATAJPA-975 - Updated changelog. 2016-09-29 11:42:02 +02:00
Oliver Gierke
19eca5f9e0 DATAJPA-974 - Query for tuples now uses joins correctly.
When creating the selections for a derived query using a projection we now explicitly create joins for plural attributes. Looks like Hibernate fails to create a proper query if the path is referred to via root.get(…) and the select clause includes references to other non-plural attributes.
2016-09-28 15:06:27 +02:00
Christoph Strobl
e5b398410c DATAJPA-970 - Remove explicit group name from alias detection pattern.
We now use the group index instead of an explicit name. This fixes problems when using the pattern on Java 6.

Original pull request: #181.
2016-09-23 10:22:51 +02:00
Oliver Gierke
79bc398811 DATAJPA-964 - Updated changelog. 2016-09-21 08:03:35 +02:00
Oliver Gierke
b07bdc089d DATAJPA-916 - Updated changelog. 2016-09-21 08:03:34 +02:00
Oliver Gierke
5c41f5ad1a DATAJPA-965 - Polishing.
Removed some unnecessary overrides in JpaOrder.
2016-09-20 10:28:20 +02:00
Christoph Strobl
b8e7fecccc DATAJPA-965 - Fix potential blind SQL injection in Sort when used in combination with @Query.
We now decline sort expressions that contain functions such as ORDER BY LENGTH(name) when used with repository having a String query defined via the @Query annotation.

Think of a query method as follows:

@Query("select p from Person p where LOWER(p.lastname) = LOWER(:lastname)")
List<Person> findByLastname(@Param("lastname") String lastname, Sort sort);

Calls to findByLastname("lannister", new Sort("LENGTH(firstname)")) from now on throw an Exception indicating function calls are not allowed within the _ORDER BY_ clause. However you still can use JpaSort.unsafe("LENGTH(firstname)") to restore the behavior.

Kudos to Niklas Särökaari, Joona Immonen, Arto Santala, Antti Virtanen, Michael Holopainen and Antti Ahola who brought this to our attention.
2016-09-20 10:28:05 +02:00
Oliver Gierke
c227c67530 DATAJPA-962 - Update Travis build profiles.
Disabled the build profile for Spring 4.2 and enabled ones for Spring 5.
2016-09-09 22:23:58 +02:00
Oliver Gierke
287104c2e3 DATAJPA-960 - Fixed alias detection for queries not containing an alias.
We're now more lenient against manually defined queries that do not contain aliases when adding order by clauses to them. The alias detection now doesn't accidentally pick up "where" anymore in case no primary alias is declared and the code applying the order by clause only qualifies the expressions created if there actually is an alias in the first place.
2016-09-07 18:47:39 +02:00
Oliver Gierke
585ada91f3 DATAJPA-956 - Fixed accidental pick up of non-EntityManagerFactor JNDI objects.
We now exclude all candidates beans that could theoretically become an EntityManagerFactory unless we definitely know so.

Previously bean definitions for JndiObjectFactoryBean that didn't expose an expected type (e.g. ones defined via JavaConfig) were propagated to the creation of a DefaultJpaContext.
2016-09-04 13:01:40 +02:00
Oleksandr Mandryk
9d0120d6c6 DATAJPA-953 - Fixed typo in reference documentation. 2016-08-20 08:30:25 +02:00
Oliver Gierke
d75019bae9 DATAJPA-951 - Prevent preemptive conversion to Optional in JpaQueryExecution.
JpaQueryExecution applies a ConversionService to convert between low-level types such as integers, longs and byte arrays. That ConversionService also preemptively converts objects into JDK 8's Optional in case the invoked method's return type is Optional.

We now explicitly remove the converter taking care of the latter to avoid Optionals to be created before the actual result conversion is applied, as it needs to see the raw value to create DTOs or interface based projections correctly.
2016-08-17 16:31:30 +02:00
Oliver Gierke
e34d5d93e6 DATAJPA-950 - Upgraded Hibernate 5 build profile to Hibernate 5.2.2. 2016-08-11 23:41:32 +02:00
Oliver Gierke
937c650276 DATAJPA-938 - Enable DOTALL mode for regular expression detecting constructor expressions in manually declared queries.
The usage of the DOTALL mode makes sure that line breaks in query definitions don't cause any trouble when trying to detect constructor expressions.
2016-08-11 23:34:16 +02:00
Mark Paluch
9381d6a5a3 DATAJPA-912 - Fix broken test in RepositoryWithCompositeKeyTests.
Use a page size of 1 to enforce a count query creation. The expected exception is only visible with Hibernate 4.1.x when a count query is issued.

Related pull request: #174.
2016-08-04 20:57:47 -07:00
Oliver Gierke
21991ce5c6 DATAJPA-938 - Fixed constructor expression detection in QueryUtils.
Slightly loosened our regular expression to detect constructor expressions as previously it didn't match select expressions that contained a distinct clause.
2016-08-03 18:15:00 -07:00
Oliver Gierke
c228d3e5d8 DATAJPA-941 - Avoid causing exceptions in JPA type check.
We're now using Class.isInstance(…) in favor of .cast(…) in JpaClassUtils.isOfType(…) as the latter causes exceptions to be thrown unnecessarily.
2016-08-02 12:26:34 -07:00
Oliver Gierke
23a963f13d DATAJPA-882 - After release cleanups. 2016-07-27 14:32:37 +02:00
Oliver Gierke
70b3207dd4 DATAJPA-882 - Prepare next development iteration. 2016-07-27 14:32:33 +02:00
Oliver Gierke
20f0c0da6f DATAJPA-882 - Release version 1.11 M1 (Ingalls). 2016-07-27 13:52:12 +02:00
Oliver Gierke
2facef327e DATAJPA-882 - Prepare 1.11 M1 (Ingalls). 2016-07-27 13:51:37 +02:00
Oliver Gierke
f9a3ac6990 DATAJPA-882 - Updated changelog. 2016-07-27 13:51:27 +02:00
Mark Paluch
1ea8096827 DATAJPA-937 - Fix format string in QueryByExamplePredicateBuilder.getPredicates. 2016-07-27 12:01:03 +02:00
Oliver Gierke
5ee723cbe0 DATAJPA-413 - Polishing.
Removed some unnecessary accessor methods.

Original pull request: #133.
2016-07-20 12:15:07 +02:00
Mark Paluch
529eff5a8f DATAJPA-413 - Guard identifier derivation against null values and add tests.
Added guard against null values in identifiers. Null values can occur because id generation was not completed yet. Add tests for identifier derivation using @IdClass for Hibernate, OpenJPA and EclipseLink.

Original pull request: #133.
2016-07-20 12:15:07 +02:00
Thomas Darimont
b0d03050cb DATAJPA-413 - Improved handling of entities annotated with @IdClass.
Added special handling for IdClass' typed id values to prevent
nested identifier classes from failing to be populated in JpaMetamodelEntityInformation.

Original pull request: #133.
2016-07-20 12:15:07 +02:00
Mark Paluch
edf63705c9 DATAJPA-912 - Optimize paged query execution.
We execute paged queries now in an optimized way. The data is obtained for each paged execution but the count query is deferred. We determine the total from the pageable and the results in which we don't hit the page size bounds (i.e. results are less than a full page without offset or results are greater 0 and less than a full page with offset). In all other cases we issue an additional count query.
2016-07-20 11:39:53 +02:00
Mark Paluch
a373a28637 DATAJPA-932 - Integrate version badge from spring.io.
Add version badge from spring.io and replace fixed version numbers with a placeholder.
2016-07-20 08:49:43 +02:00
Oliver Gierke
0fae610163 DATAJPA-929 - Further guards against null values returned from ManagedType.
Extracted the functionality to check for JPA managed types into a dedicated wrapper for the JPA Metamodel. This allows all clients to benefit from the null guards we have to put in place due to [0]. Adapted the fix introduced for DATAJPA-904 to make use of the newly created infrastructure, too.

[0] https://hibernate.atlassian.net/browse/HHH-10968
2016-07-19 10:53:02 +02:00
Oliver Gierke
8e616afdc4 DATAJPA-923 - Polishing. 2016-07-14 09:16:36 +02:00
Oliver Gierke
e4b9ba8e0e DATAJPA-923 - QueryByExamplePredicateBuilder now considers match mode.
We now inspect QueryByExamplePredicateBuilder.isAndMatching() to decide whether to concatenate the predicates built using and or or.

Related tickets: DATACMNS-879.
2016-07-14 09:16:17 +02:00
Oliver Gierke
30030a11c1 DATAJPA-915 - Upgraded Hibernate 5.2 profile to 5.2.1. 2016-07-01 10:56:42 +02:00
Oliver Gierke
513be636a3 DATAJPA-915 - Added build profile for Hibernate 5.0 snapshots. 2016-06-20 15:37:44 +02:00
Oliver Gierke
685e06eee6 DATAJPA-915 - Updated build profiles for Hibernate.
Added build profiles for Hibernate 5.2 and 5.2 snapshots as well as one for Spring 4.3.
2016-06-20 14:40:59 +02:00
Oliver Gierke
0f1e3f1dd0 DATAJPA-884 - Updated changelog. 2016-06-15 14:31:47 +02:00