Commit Graph

136 Commits

Author SHA1 Message Date
Oliver Gierke
d5300ed1bc DATACMNS-43 - Corrected exception message in PreferredConstructorDiscoverer to mention PersistenceConstructor. 2011-06-07 11:50:28 -07:00
Oliver Gierke
364a84ffb8 DATACMNS-42 - MappingBeanHelper now considers all Numbers to be simple types.
Fixed bug in isSimpleType(…) along the lines.
2011-06-06 14:44:28 -07:00
Oliver Gierke
12d5c0ddb9 Polished JavaDoc. 2011-06-06 11:07:21 -07:00
Oliver Gierke
70da7b00f8 DATACMNS-41 - Refactored DefaultRepositoryInformation to take custom implementation class into account as well. 2011-06-01 00:29:52 +01:00
Oliver Gierke
399bc5e6bf Made DefaultRepositoryInformation public. 2011-05-31 22:34:59 +01:00
Oliver Gierke
0ea1921a96 Updated reference documentation regarding repository declaration.
Polished Javadoc of Repository to mention possibility of selectively exposing CRUD methods.
2011-05-24 12:33:18 +02:00
Oliver Gierke
dab13128f4 Introduced BeanWrapper helper object to reduce static access through MappingBeanHelper.
Creating bean instances, getting and setting properties on a bean was done by using static methods on MappingBeanHelper so far. This required certain Spring components (ConversionService) being held statically as well. Beyond that various Spring components had set these static values which might cause strange behavior if multiple instances of these Spring components are created. Thus we now have a BeanWrapper that takes the formerly statically held instances and uses those for bean creation and property access.

Moved SpEL awareness of a mapping into SpELAwareParameterValueProvider to hide it behind an ParameterValueProvider instance.
2011-05-24 12:31:59 +02:00
Oliver Gierke
be5d43900c Moved QueryDslPredicateExecutor into Spring Data Commons. 2011-05-23 12:21:01 +02:00
Oliver Gierke
637daac97b DATACMNS-40 - Renamed @RepositoryProxy to @RepositoryDefinition. 2011-05-23 11:50:11 +02:00
Oliver Gierke
1583aea2b7 DATADOC-145 - Removed obsolete methods from MappingBeanHelper.
Fixed inverted isAssignableFrom(…) check as well.
2011-05-22 14:44:05 +02:00
Thomas Risberg
cbf8218cc0 added UserCredentials class to support DATADOC-142 2011-05-20 12:40:10 -04:00
Oliver Gierke
7a110d593e DATACMNS-38 - Prevent StackOverflow on self referencing objects.
Various improvements and additional test cases for the TypeInformation abstraction. Introduced ParameterizedTypeInformation in-between class to take the parent into account when calculating equals(…) and hashCode(). We're also shortcutting TypeInformation creation if the parent's underlying type equals the one we shall create a new TypeInformation for.

Slightly modified the parsing algorithm when adding PersistentEntity objects. We now eagerly add them to the cache to prevent endless recursive adding.
2011-05-17 20:15:52 +01:00
Oliver Gierke
66c77820c4 DATACMNS-37 - Added unit tests for annotation based repository usage. 2011-05-17 20:15:38 +01:00
Oliver Gierke
1761255c2d DATACMNS-37 - Enabled annotation based repository declaration model.
Introduced an @RepositoryProxy annotation that can be used as alternative to extending Repository. Added necessary RepositoryMetadata implementation to introspect the annotation rather than the generic types. Enabled bean definition parsers to pick up annotation based repositories as well.
2011-05-14 08:37:38 +02:00
Oliver Gierke
22f3e5cd1c Added test case to check whether declaring a CRUD method in a repository interface extending Repository is delegated to the backing bean. 2011-05-13 10:03:48 +02:00
Oliver Gierke
138191fd19 DATACMNS-34 - Fixed exception message to include class name and point to argument constructors, not no-arg ones. 2011-05-13 10:02:58 +02:00
Oliver Gierke
24394b4f1d DATACMNS-29 - Extracted Repository marker interface from CrudRepository.
This change allows creating repository proxies without exposing CRUD methods at the same time. This essentially enables query-method-only repository interfaces.
2011-05-12 13:17:55 +02:00
Oliver Gierke
d8c5bca4bd DATACMNS-36 - Improved transaction handling configuration support.
Added custom TransactionAttributeSource that favors interface transaction configuration over the implementation configuration. This allows us configuring repository implementations with @Transactional but allow overriding this configuration at the user's repository level as well.
2011-05-12 12:13:49 +02:00
Oliver Gierke
88bad20ab3 DATACMNS-29 - Added getRepositoryInterface() implementation to RepositoryConfig.
We now assume scanning for all sub-interfaces of Repository by default now. Thus concrete modules can pretty much drop the implementation of this method in their concrete config implementations in case they support picking up user's repository interfaces that extend Repository only.

From a users perspective this drops the requirement to extend a persistence technology specific interface (MongoRepository, JpaRepository and the like).
2011-05-12 11:35:16 +02:00
Oliver Gierke
891144b543 DATACMNS-35 - Added delete(ID id) method to Repository interface. 2011-05-11 18:37:15 +02:00
Oliver Gierke
06872f23f5 Set fields and getter accessible before reading value in MappingBeanHelper. 2011-05-11 18:36:44 +02:00
Oliver Gierke
6f92b010d3 DATAJPA-59 - Added unit test for QueryMethod. 2011-05-11 13:27:51 +02:00
Jon Brisbin
e67e35ac8d Reformatting source code to use tabs instead of spaces. 2011-05-10 10:50:32 -05:00
Oliver Gierke
870d156adb DATACMNS-34 - Improved algorithm to lookup preferred constructor.
Algorithm is now was follows:

1. If there's no explicit constructor use the default constructor.
2. If there's a single explicit constructor, use this one.
3. If there's multiple explicit constructors and one has been annotated with @PersistenceConstructor use the annotated one.
4. If there's multiple explicit constructors and none annotated use the no-arg one or throw an exception to resolve the ambiguity.

Test cases for that algorithm are located in PreferredConstructorDiscovererUnitTests. Refactored PreferredConstructor and Parameter classes a little to make them immutable value objects. Introduced ability to lookup parameter TypeInformation for constructors on TypeInformation interface.

Extended generics in mapping subsystem to allow defining a concrete subtype of PersistentProperty as well. Removed some generics related compiler warnings as well.
2011-05-10 10:15:46 +02:00
Oliver Gierke
ff51b134f9 DATADOC-43 Added Near and Within as part types to support spatial repository queries. 2011-05-03 15:12:22 +02:00
Oliver Gierke
54ada02ae8 DATADOC-109 - Refactored mapping subsystem.
Refactored BasicMappingContext into AbstractMappingContext that now only contains the general algorithm to build PersistentEntity and PersistentProperty instances. The algorithm delegates to two template methods that are responsible for instantiating concrete implementations of those classes.

Extracted an AnnotationBasedPersistentProperty that now contains all annotation references so that AbstractPersistentEntity does not take annotations into account in the first places. BasicPersistentEntity now does PreferredConstructor lookup as well.

Removed unnecessary methods from MappingCOntext and PersistentEntity interface. Added a verify() method to BasicPersistentEntity that AbstractMappingContext calls to verify validity of the entity. This will be used by the Mongo module for example to make sure @Document annotated entities have an @Id property.

Refactored getValueAnnotation() to getSpelExpression() to not imply we're using annotations in every case.

Added shortcut in TypeDiscoverer.createInfo(…) to prevent endless loop in case a type has a field of it's very same type.

TypeDiscoverer now returns the plain compound type for arrays now, which means you get String for String[], String[][] and so on. Opened up signature of AbstractMappingContext.setInitialEntitySet(…) to allow effortless programatic invocation.
2011-04-28 21:34:08 +02:00
Oliver Gierke
d0569e0cb4 DATACMNS-33 - Changed return type of Repository.count() to primitive long. 2011-04-21 09:54:15 +02:00
Oliver Gierke
b6845e7310 DATACMNS-32 - Refactored Querydsl support code from JPA and Mongo module into core. 2011-04-20 20:38:20 +02:00
Oliver Gierke
3f22104c7c DATACMNS-30 - Made implementations of Page, Pageable and Sort serializable. 2011-04-20 17:18:57 +02:00
J. Brisbin
9ff83e6542 DATADOC-98 - Fixes for multi-dimensional arrays and lists 2011-04-19 12:49:43 -05:00
Jon Brisbin
caa72bdfd1 DATADOC-98 - Deal with multi-dimensional arrays as property types. 2011-04-18 12:18:16 -05:00
Jon Brisbin
cbf9b6801e DATADOC-98 - Deal with multi-dimensional arrays as property types. 2011-04-18 09:48:03 -05:00
Oliver Gierke
680a74c8e1 DATAJPA-45 - ClassUtils.getReturnedDomainClass works for parameterized component types of Collections and Page. 2011-04-08 22:05:25 +02:00
Thomas Risberg
a0813b4c85 changing to use source 1.5; removed some @Override on interface methods; cleaned up unused imports 2011-04-08 10:41:11 -04:00
Michael Hunger
0358cac9a5 merged changes in AbstractConstructorEntityInstantiator 2011-04-08 12:53:40 +02:00
David Montag
35537aba8a Made failure message customizable. 2011-04-07 13:08:54 -07:00
Michael Hunger
986566f64e Merge branch 'master' of github.com:SpringSource/spring-data-commons 2011-04-07 13:16:07 +02:00
J. Brisbin
71f08efa53 Merge branch 'master' of github.com:SpringSource/spring-data-commons 2011-04-05 14:56:50 -05:00
J. Brisbin
fec5bae808 Added MappingContextAware interface and BeanPostProcessor for same 2011-04-05 14:56:30 -05:00
Oliver Gierke
33013f8712 DATAJPA-44 - Domain class lookup in QueryMethod falls back to the repository domain class for methods not returning a domain class. 2011-04-05 10:57:23 +02:00
Oliver Gierke
895f0a4025 DATACMNS-24 - Separated RepositoryMetadata from RepositoryInformation.
Extracted basic information from RepositoryInformation into RepositoryMetadata to limit the amount of API being exposed to RepositoryFactorySupport implementations. getRepositoryBaseClass(…) can thus now take a RepositoryMetadata.
2011-04-05 08:04:10 +02:00
Thomas Risberg
1220ff98d0 removed slf4j dependency 2011-04-04 17:46:46 -04:00
Michael Hunger
2cbb372de5 added constructor bypassing instantiation 2011-04-01 19:46:07 +02:00
J. Brisbin
c6ad0f99fe Merge branch 'master' of github.com:SpringSource/spring-data-commons 2011-04-01 11:29:14 -05:00
J. Brisbin
3f746ebf4f Added array primitives to simple types 2011-04-01 11:28:54 -05:00
Oliver Gierke
4b51c5fd1f DATACMNS-23 - Made PageImpl safe to take an empty collection.
Added hasContent() method to Page interface.
2011-04-01 08:34:39 +02:00
Oliver Gierke
c4d81a28f1 DATACMNS-25 - Refactored RepositoryFactorySupport.getQueryLookupStrategy(…)
Method is not abstract anymore but rather returns null by default. Adapted QueryExecutionMethodInterceptor to handle the null case appropriately by simply skipping the query lookup. It also throws an exception if the repository has query methods defined nonetheless to prevent exceptions at runtime.
2011-03-31 21:46:33 +02:00
Oliver Gierke
9931e885c0 Expose type of a query parser Property. 2011-03-31 18:24:03 +02:00
Oliver Gierke
6bb0923c14 DATACMNS-26 - Persistent constructor now detects non-public constructor. 2011-03-29 19:19:23 +02:00
Oliver Gierke
c05bedce17 Fixed bug in Property. 2011-03-28 20:32:12 +02:00