Comments (7)
Oliver Drotbohm commented
Actually Parameters
already does parameter name discovery using a LocalVariableTableParameterNameDiscoverer
so that should work as is right now. It just seems to be a matter of documentation though ;)
from spring-data-jpa.
Stevo Slavić commented
Yes, it's there, but doesn't work for me - parameterNamesCache is always empty map. It seems debug information is not available for interfaces
from spring-data-jpa.
Stevo Slavić commented
As stated in VM spec here and here
??The LocalVariableTable
attribute is an optional variable-length attribute of a Code
(§4.7.3) attribute.??
??The Code
attribute is a variable-length attribute used in the attributes table of method_info structures. A Code
attribute contains the Java virtual machine instructions and auxiliary information for a single method, instance initialization method (§3.9), or class or interface initialization method (§3.9). Every Java virtual machine implementation must recognize Code
attributes. If the method is either native or abstract, its method_info structure must not have a Code
attribute.??
Since all interface methods are implicitly abstract, JVM ??must not have?? LocalVariableTable
for interface methods.
So, this can not be implemented. Maybe in Java 8+ or maybe using something like ParaNamer but that would introduce additional dependency and I'm not sure if it would work..
from spring-data-jpa.
Stevo Slavić commented
Combining custom annotation processor (based on this it seems annotation processor can access parameter names for interface method) and custom implementation of ParameterNameDiscoverer
could do the trick
from spring-data-jpa.
Stevo Slavić commented
Problem is that Parameters
can not be configured to use custom ParameterNameDiscoverer
different from LocalVariableTableParameterNameDiscoverer
. Also there seems to be no support for just extending Spring Data JPA with custom query lookup strategy. Option that remains is to implement custom repository factory
from spring-data-jpa.
Oliver Drotbohm commented
I've just pushed a fix for DATACMNS-356, which lets our Parameters
value object use Spring 4's DefaultParameterNameDiscoverer
if present. That one uses the new JDK 8 reflection API so that parameter names are resolvable for interface methods if you run the code with -parameters
option.
I'll keep this ticket around here to set up a CI build job to run against a recent JDK 8 (b100 required) and see what the consequences are. It's likely that some of the integration tests fail as they expect to work with positional parameter binding and might be trapped into by-name binding as we find parameter names all of a sudden
from spring-data-jpa.
Oliver Drotbohm commented
This is effectively in place with the constraints mentioned in a former comment. When running on Spring 4 and Java 8 with the -parameters
flag enabled for compile (should be activated by default), this should work out of the box. Marking as resolved against 1.5 as this was the version Spring Data Commons (1.6) started to integrate with Spring 4 parameter name discovery
from spring-data-jpa.
Related Issues (20)
- JPA projection cannot project OffsetDateTime from timestampz HOT 3
- Release 3.1.12 (2023.0.12)
- Release 3.2.6 (2023.1.6)
- Release 3.3 GA (2024.0.0)
- Derived Method Unneccessarily Joins for filter HOT 1
- Spring Data JPA Query with Class Constructor: org.hibernate.query.SemanticException: Cannot compare ... HOT 4
- Using native Hibernate multitenancy with Spring Data JPA breaks on application boot. HOT 7
- JpaSpecificationExecutor distinct find by with limit HOT 4
- Spring Data JPA generates incorrect JPQL query for sorted pagination request with UNION clause HOT 1
- Column "X" must appear in the GROUP BY clause or be used in an aggregate function HOT 3
- Unable to determine SQL type name for column 'option_type' of table 'account_options' because there is no type mapping for org.hibernate.type.SqlTypes code: 2000 (JAVA_OBJECT) HOT 1
- Missing implicite entityManager.flush() before storedprocedure call and Spring-Data Repository HOT 2
- Bug: Missing implicite entityManager.flush() before storedprocedure call and Spring-Data Repository HOT 3
- Error executing DDL HOT 3
- After upgrade to 3.2.4, when use @Query to query native sql will bootstrap fail, as the jsqlparser version too lower. Below is the error message. HOT 1
- Upgrade to Hibernate 6.5.0
- Upgrade to JSqlParser 4.9
- SimpleJpaRepository.delete(Specification<T> spec) throws NullPointerException [Kotlin] HOT 3
- Align EnableJpaRepositories with changes in data-commons.
- Native query is not working when an entity attribute entity attribute is annotated with @NotFound HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-jpa.