spring-projects / spring-projects/spring-data-rest

Provide a pom to allow maven builds [DATAREST-142]

Open
#530 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Thomas Darimont opened DATAREST-142 and commented

Github Author: sparmboy
Github Last-Updated: 2013-03-07T18:57:51Z
This issue was automatically imported from github

Bit of a long one this so bare with me.

We're currently using spring-data-rest 1.0.0.RELEASE

In our corporate environment, we have issues with using gradle via a proxy. See the following issue:

http://forums.gradle.org/gradle/topics/proxy_error-1r4f6

There doesnt appear to be a resolution to this, therefore we cant build spring-data-rest from source.

We're looking to build 1.1.0.M1 due the issues with Hibernate method level annotations as noted here:

https://github.com/SpringSource/spring-data-rest/issues/33
https://github.com/SpringSource/spring-data-rest/pull/56

The pull issue 56 mentions that fixes to the spring-data-commons and spring-data-jpa:

https://jira.springsource.org/browse/DATACMNS-269
https://jira.springsource.org/browse/DATAJPA-283

should fix this. To quote olivergierke:

"We've introduced the necessary changes in Spring Data Commons and JPA. The method annotations should now be discovered automatically without any need for changes in Spring Data REST."

However, when upgrading to these versions, there's still an issue with spring-data-rest 1.0.0.RELEASE, looking at the JpaEntityMetadata class:

https://github.com/SpringSource/spring-data-rest/blob/1.0.0.RELEASE/spring-data-rest-repository/src/main/java/org/springframework/data/rest/repository/jpa/JpaEntityMetadata.java

From line 42:
<code>
for(Attribute attr : entityType.getAttributes()) {
boolean exported = true;
Field field = ReflectionUtils.findField(type, attr.getJavaMember().getName());
if(null == field) {
continue;
}
</code>
The line <code>attr.getJavaMember().getName()</code> returns the getter method as a member rather than the field (i.e. if my entity attribute is "name" this returns "getName").

The resultant call to ReflectionUtils.findField will always return null, as it is looking for a method name rather than a field name.

Because I cant build spring-data-rest 1.1.0.M1, and a build is not available in any public repos yet, my only option is to do an ugly hack to the ReflectionUtils in the springframework-core to check for methods as well as fields.

I'm open to any other work arounds or suggestions


Reference URL: https://api.github.com/repos/SpringSource/spring-data-rest/issues/81

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.