Enhancement #162
Make derived queries work for subclasses of entity
| Status: | Closed | Start: | 11/17/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 100% |
||
| Category: | Core DAO | Spent time: | 1.00 hour | |
| Target version: | 1.1 |
Description
If you have an inherited structure of domain classes (e.g. a class A extends B) you usually don't need an extra GenericDao for class A since GenericDao<B> can do most of the work you need.
Right now the derived query feature (findByFoo leads to an autogenerated query like SELECT ... WHERE foo = ?) seems not to work if you query for fields that are only present in subclasses.
BDao.findByAexclusiveProperty(..) does not work since Hades inspects the domain class of the DAO (in this case B) and checks if it has the property before building the query.
Instead of inspecting B (the domain class of the dao) the return type of the method should be inspected for the property (and should be used in FROM of the query too, of course)
Associated revisions
- fixes #162 - correct query creation for entity subclasses
- added test case to recap the issue
- added
getReturnedDomainClasstoClassUtilsto return the actual target result type (blending collections correctly) - use the new method to determine whether a field is valid
- use the new method inside the domain class lookup
History
Updated by Oliver Gierke 9 months ago
- Subject changed from Make guessed Queries work for Subclasses of Entity to Make derived queries work for subclasses of entity
Updated by Oliver Gierke 9 months ago
- Project changed from Minos to Hades
- Category deleted (
Core)
Updated by Oliver Gierke 9 months ago
- Category set to Core DAO
- Target version set to 1.1
Updated by Oliver Gierke 9 months ago
- Status changed from New to In progress
Updated by Oliver Gierke 9 months ago
- File mylyn-context.zip added
Updated by Oliver Gierke 9 months ago
- Status changed from In progress to Fixed
- % Done changed from 0 to 100
Applied in changeset r7963.
Updated by Oliver Gierke 8 months ago
- Status changed from Fixed to Closed