Commit Graph

178 Commits

Author SHA1 Message Date
Oliver Gierke
fe36a77f38 DATAJPA-135 - Improved extensibility of QueryDslRepositorySupport.
Moved @PersistenceContext annotation to the setter method to make it overridable and thus re-configurable. Introduced protected getEntityManager() method to allow subclasses having access to the EntityManager.
2011-12-09 13:02:20 +01:00
Oliver Gierke
bb124e1e58 DATAJPA-133 - Updated changelog. 2011-12-06 22:51:53 +01:00
Oliver Gierke
0aa6aaca2a DATAJPA-73 - Added id to locking section of reference documentation. 2011-12-06 18:59:11 +01:00
Oliver Gierke
c915077074 DATAJPA-73 - Added support for locking.
Repository query methods can now be equipped with a @Lock annotation that carries the LockModeType to be used when executing the query. Beyond that, CRUD methods can be redeclared to carry lock metadata as well.

interface UserRepository extends Repository<User, Long> {
  // CRUD method redeclaration
  @Lock(LockModeType.READ)
  List<User> findAll();

  // Query method
  @Lock(LockModeType.READ)
  List<User> findByLastname(String lastname);
}
2011-12-06 11:12:57 +01:00
Tomasz Nurkiewicz
d49d4d5f0a DATAJPA-124 - Optimized pagination execution.
For pagination we already need to trigger a count query to find out the total number of pages available. Now if there are less elements available than the offset of the current page points to we don't need to trigger the actual content reading query at all. E.g. if there's only 20 elements in the database and we request page 3 by a page size of 10 we already know that there won't be any elements found.

Implemented that optimization for general CRUD pagination as well as pagination in query methods.
2011-12-05 18:24:29 +01:00
Oliver Gierke
e3da457137 DATAJPA-123, DATAJPA-122 - Updated reference documentation.
Added documentation of ClasspathScanningPersistenceUnitPostProcessor to reference documentation.
2011-12-05 17:24:46 +01:00
Oliver Gierke
42b60cf8d4 DATAJPA-132 - Implemented handling of True and False keywords on query creation.
Query derivation mechanism now supports True and False as keywords in finder methods:

class User {
  boolean active;
}

interface UserRepository<User, Long> {
  List<User> findByActiveTrue() ;
}
2011-12-05 14:38:39 +01:00
Oliver Gierke
d3bced0f86 DATAJPA-123 - Added classpath-scanning PersistenceUnitPostProcessor.
Added ClasspathScanningPersistenceUnitPostProcessor that will scan the configured base package for classes annotated with @Entity or @MappedSuperclass and add them to the PersistenceUnit handled.

Beyond that it will scan for JPA XML mapping files if an optional mapping file name pattern is configured on the PUPP instance.
2011-12-03 11:55:57 +01:00
Oliver Gierke
aef195eaed DATAJPA-129 - Allow definition of NamedQuery name to be used in @Query.
@Query now has a name attribute that allows defining the NamedQuery name to be used to override the convention based ${domainClass}.${finderMethodName}.
2011-12-03 01:30:53 +01:00
Oliver Gierke
c134e10727 DATAJPA-117 - Added nativeQuery flag to @Query.
@Query can now be used to execute native queries by setting the nativeQuery flag of the annotation to true. Polished JavaDoc of the @Query annotation. Upgraded EclipseLink dependency to 2.3.1 as we stumble over a NullPointerException otherwise which is fixed in the current one.
2011-12-03 00:34:23 +01:00
Oliver Gierke
7d6216285e DATAJPA-120 - Replaced @OneToOne with @ManyToOne in AbstractAuditable. 2011-12-02 17:47:07 +01:00
Oliver Gierke
add1336ed1 DATACMNS-91 - Enforce parameter handling defined by CrudRepository.
Reject null values for id and entity values. Polished JavaDoc in terms of parameter specification.
2011-12-02 17:47:07 +01:00
Oliver Gierke
a8acfed05e DATAJPA-127 - Use 4.0.0.RELEASE as upper exclusive Spring dependency version bound.
Use repo.springsource.org as repository URL.
2011-12-02 17:46:59 +01:00
Oliver Gierke
6cda41ba39 Fixed Maven properties not to contain dot hierarchies as this breaks docbook generation.
See http://code.google.com/p/docbkx-tools/issues/detail?id=20 for details.
2011-12-02 17:46:59 +01:00
Oliver Gierke
45bcdb60ac DATAJPA-127 - Setup hybrid Spring 3.0.6 / 3.1 build.
Removed deprecated usage of XmlBeanFactory in tests.
2011-12-02 17:46:40 +01:00
Oliver Gierke
5ffbb4f1d1 DATAJPA-102 - Upgraded to Querydsl 2.2.5. 2011-11-23 12:37:57 +01:00
Oliver Gierke
70b42b8ba3 Removed unused import. 2011-11-23 12:35:26 +01:00
Oliver Gierke
99e04dbcae DATACMNS-98 - Adapt refactorings. 2011-11-23 12:27:26 +01:00
Oliver Gierke
eaaad64774 Added missing quote in reference documentation. 2011-11-08 13:28:04 +01:00
Oliver Gierke
02558854de DATAJPA-115 - Upgraded to Querydsl 2.2.3. 2011-10-14 14:37:30 +02:00
Oliver Gierke
d6c4c2ef12 Polished UserRepositoryTests. 2011-10-12 11:36:48 +02:00
Oliver Gierke
db8aebe4d7 DATAJPA-111 - Removed unnecessary em.clear() from mass delete methods. 2011-10-12 11:36:33 +02:00
Oliver Gierke
c8a0f0d3b6 DATAJPA-110 - Fixed alias detection for entity names containing numbers. 2011-10-11 18:23:21 +02:00
Oliver Gierke
54f8cb8700 DATAJPA-108 - Added support for GreaterThanEqual and LessThanEqual. 2011-10-11 18:15:25 +02:00
Oliver Gierke
515a85f005 DATAJPA-113 - Improved DI for QueryDslRepositorySupport.
Removed @Required annotation from the setter for EntityManager property. The annotation triggered a dependency check that was not aware of the EntityManager being injected by a PersistenceAnnotationBeanPostProcessor. As we already have a validation callback using @PostConstruct we can simply rely on the not-null check for the EntityManager being implemented there.
2011-10-11 12:57:05 +02:00
Oliver Gierke
7a3b20992d DATACMNS-84 - Adapt refactorings. 2011-10-07 12:18:48 +02:00
Oliver Gierke
63e564aee3 DATACMNS-82 - Adapted changes in Spring Data Commons. 2011-09-30 12:12:32 +02:00
Igor Mihalik
046e2bd71d DATAJPA-109 - Upgrade to spring version 3.0.6.RELEASE. 2011-09-28 18:12:40 +02:00
Oliver Gierke
a5cb8ee6c0 DATAJPA-54 - Added forCounting() flag to @QueryHints.
The flag defaults to true and allows disabling of QueryHints being applied to the count query additionally triggered for pagination.
2011-09-06 13:47:38 +02:00
Oliver Gierke
6fec65b504 DATAJPA-97 - Added test to verify hints get applied to all queries correctly.
The actual fix for this ticket has been introduced during the refactoring for DATAJPA-86 (04349d25dc) thus it's already fixed in 1.1.0.M1. Added a test case to verify the behavior.
2011-09-06 13:19:59 +02:00
Oliver Gierke
86d0006155 DATAJPA-103 - Consolidate Expression creation for property references from method names and Order expressions. 2011-09-06 12:27:24 +02:00
Oliver Gierke
9bf6703c63 DATADOC-99 - ParameterExpressionProvider now uses parameter type instead of handed in type if assignable.
JpaQueryCreator hands Comparable into ParameterExpressionProvider to create ParameterExpression instances for Comparables. The ParameterExpressionProvider in turn now inspects the actual Parameter type and hand this one into the builder in case it's assignable (read: more concrete) to the given type requested.
2011-09-06 11:49:07 +02:00
Oliver Gierke
ab5aad51d5 DATAJPA-101 - Prepare 1.1.x development line. 2011-09-05 14:34:16 +02:00
Oliver Gierke
4976684e96 DATAJPA-101 - Prepare release of 1.1.0.M1. 2011-09-05 14:20:51 +02:00
Oliver Gierke
0b737586c8 Reference documentation formatting of XMLEditor. 2011-09-05 13:12:29 +02:00
Oliver Gierke
c6045de7ad DATAJPA-80, DATAJPA-91 - Updated reference documentation.
Mention PersistenceExceptionTranslator being activated when using the JPA namespace. Documented custom namespace attributes special to the JPA namespace.
2011-09-05 13:12:14 +02:00
Oliver Gierke
ca52ec29be DATAJPA-81 - SimpleJpaRepository.exists(…) now projects to the id to prevent the entire object being read and mapped. 2011-09-05 08:31:32 +02:00
Oliver Gierke
04349d25dc DATAJPA-86 - Pagination over queries using group-by works correctly.
Added handling of count methods for queries using group by. In case the count query returns multiple results we use the number of results instead of failing. If the result contains one result we use this one.

Moved hint handling to AbstractJpaQuery.
2011-09-04 16:56:50 +02:00
Oliver Gierke
170d31707c DATAJPA-96 - JpaQueryCreator now correctly resolves nested properties for all supported keywords.
Removed Part.toDotPath() references to create Expressions as they have to be atomic.
2011-09-04 14:56:39 +02:00
Oliver Gierke
7516816adb DATADOC-93 - Don't catch IllegalArgumentExceptions raised by missing domain class in JPA Metamodel.
We now don't catch an IllegalArgumentException being thrown in case a domain class is not found in the metamodel. If it occurs there's nothing we can do about it as we can't come up with an EntityInformation instance then and the persistence provider couldn't handle it anyway.
2011-09-04 14:25:27 +02:00
Oliver Gierke
b291a5f5f9 DATAJPA-98 - Formatted sources with Spring Data Eclipse formatting settings. 2011-09-02 18:11:10 +02:00
Oliver Gierke
d5651cdd86 Fixed project title. 2011-09-01 01:22:06 +02:00
Phillip Webb
27ad91fbbc DATAJPA-92 - JpaQueryCreator now inspects enum to decide how to handle ignore case scenarios. 2011-08-29 18:06:30 +02:00
Phillip Webb
aa6a7c1983 DATAJPA-94 - Repository queries consider Sort instance in a Pageable again. 2011-08-29 11:31:47 +02:00
Phil Webb
5b9e959b3e DATAJPA-92 - Added support for IgnoreCase keyword.
The query creation subsystem now supports using IgnoreCase when referencing String parameters, e.g.:

  findByUsernameIgnoreCase(String username);

Both 'IgnoreCase' and 'IgnoringCase' are supported. If you'd like to entirely ignore cases for all String property references add 'AllIgnoreCase' or 'AllIgnoringCase' to the query method.
2011-08-25 12:52:14 +02:00
Oliver Gierke
b6b386893e DATADOC-90 - Fixed potential concurrency problem for PartTree based query creation.
We now eagerly create CriteriaQuery and it's ParameterExpressions in QueryPreparer's constructor. Lazily doing so could let to exceptions accessing the ParameterExpressions in race conditions.
2011-08-23 09:04:20 +02:00
Oliver Gierke
0144be5b16 DATADOC-90 - Refactored PartTreeJpaQuery to create new JpaQueryCreator on every query recreation.
JpaQueryCreator is stateful as we create a list of ParameterExpressions and iterate over them. So we have to re-instantiate the JpaQueryCreator to not create an exception on the second attempt.
2011-08-21 14:33:55 +02:00
Oliver Gierke
160b738a4d DATACMNS-62 - Adapt changes in Spring Data Commons. 2011-08-21 14:33:00 +02:00
Phil Webb
480901a4ba DATAJPA-88 - Minor improvements to documentation. 2011-08-16 17:40:58 +02:00
Oliver Gierke
62ed80f389 Reverted version of javax.annotation to 0.0.0 in template.mf. 2011-08-12 14:59:16 +02:00