Commit Graph

819 Commits

Author SHA1 Message Date
Mark Paluch
7eb5818474 DATAJPA-1027 - Use newer Java 8 on Travis CI. 2016-12-16 11:28:35 +01:00
Oliver Gierke
cd9f9ab9f4 DATAJPA-1026 - Adapt API in JpaRepositoryFactoryBean.
Related ticket: DATACMNS-891.
2016-12-15 16:17:23 +01:00
Oliver Gierke
8fbc1d0326 DATAJPA-1023 - StreamExceution now rejects non-transactional execution.
StreamExecution now makes use of the newly introduced SurroundingTransactionDetectingMethodInterceptor to find out about whether the transaction is used in code that already has a transaction running. This is necessary to make sure the Stream returned by the method can actually be consumed as the surrounding transaction keeps the transaction open.

Related tickets: DATACMNS-959.
2016-12-14 16:08:24 +01:00
Oliver Gierke
eb351d6664 DATAJPA-1024 - TupleConverter now guards against single-element tuples with null value.
We now also return a single-element tuple value as is if it's null as for some reason some persistence providers (*cough* Hibernate *cough*) will return a single-element, null value containing tuple (instead of null in the first place) for queries that didn't yield a result.
2016-12-13 10:53:26 +01:00
Oliver Gierke
b2a76f055b DATACMNS-1019 - Assert Hibernate 5.2 compatibility.
Improved our detection of Hibernate 5.2 in the query lookup for String based queries, general PersistenceProvider detection (due to changed interface hierarchies in Hibernate 5.2). Tweaked the setup for some integration tests to point to Hibernate 5.2 specific persistence units using the new location for the persistence provider implementation class.
2016-12-06 15:27:23 +01:00
Oliver Gierke
3921de96ac DATAJPA-1019 - Simplified test case offending Hibernate 5.
Looks like the test case introduced for DATAJPA-622 introduced an invalid identifier setup which isn't tolerated on Hibernate 5 anymore. Simplified that to keep using Long identifiers to avoid the redeclaration of getId() which caused the mapping issue.
2016-12-06 14:31:28 +01:00
Oliver Gierke
2eada61148 DATAJPA-1018 - Upgrade Hibernate 5.0 build profile to 5.0.10. 2016-12-06 14:31:18 +01:00
Oliver Gierke
91b5aa75cf DATAJPA-1018 - Upgrade to Hibernate 5.1.1.
…to benefit from the fix for [0].

[0] https://hibernate.atlassian.net/browse/HHH-10514
2016-12-06 13:37:09 +01:00
Oliver Gierke
d06281c348 DATAJPA-1016 - Bump infrastructure requirements to JPA 2.1.
Upgraded minimum Hibernate required version to 4.3. Removed Travis build profiles for everything below that. Upgraded to Spring Framework 5.0 snapshots.

Removed integration test execution for OpenJPA for now as Spring Framework 5 doesn't ship OpenJpaVendorAdapter anymore as there's no JPA 2.1 compatible OpenJPA version available currently.
2016-12-05 15:05:45 +01:00
Oliver Gierke
b23a9b88b8 DATAJPA-1015 - Reduce log output for Travis CI build. 2016-12-05 14:45:14 +01:00
Oliver Gierke
dbf4c4ac6e DATAJPA-1014 - Register JpaRepositoryFactory in spring.factories.
This is required for the switch in support for multi-store detection.

Related ticket: DATACMNS-952.
2016-12-05 14:32:42 +01:00
Oliver Gierke
82c18c0769 DATAJPA-920 - Polishing.
Formatting and a bit of JavaDoc polish in JpaQueryCreator.

Original pull request: #176.
2016-12-05 14:32:42 +01:00
Mark Paluch
84314e279e DATAJPA-920 - Add support for exists projection in repository query derivation.
We now support exists projections in derived queries. Queries select the primary key using tuple queries limiting the result to the first row.

interface UserRepository extends Repository<User, Long> {
    boolean existsByFirstname(String firstname);
}

Original pull request: #176.
2016-12-05 14:32:42 +01:00
Oliver Gierke
8ed35882c1 DATAJPA-997 - After release cleanups. 2016-11-23 10:59:10 +01:00
Oliver Gierke
8458c0fb54 DATAJPA-997 - Prepare next development iteration. 2016-11-23 10:59:08 +01:00
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