0

It seems that the naming conventions between Xtend and Spring Data are incompatible.

For example:

// User.xtend
class User {
    @Property
    var Long id;
 }

 interface UserRepository extends JpaRepository<User> {
     public User findById(Long id)
 }

The @Property annotation renames id to _id, which causes Spring Data to fail, claiming No property id found

Is there a way to either:

  • Suppress Xtend's renaming of the field
  • "Teach" Spring Data about the naming convention (Looking for a field? Add an underscore)
  • Instruct Spring Data to use property-access, rather than field-access for the property resolution?

Any of these would solve this issue, I believe.

Marty Pitt
  • 28,822
  • 36
  • 122
  • 195

1 Answers1

1

Since 2.7.3 the @Property annotation has been superceded by @Accessors, which no longer prepends the fields with an underscore.

Before 2.7.3 you have to build your own @Property annotation which doesn't prepend an underscore to the field's name.

See http://www.eclipse.org/xtend/documentation.html#activeAnnotations

(updated)

Sven Efftinge
  • 3,065
  • 17
  • 17
  • I just want to point out that the `@Property` annotation has been deprecated and replaced by `@Accessors`. I also found this nice article about best practices for writing active annotations. http://mnmlst-dvlpr.blogspot.de/2013/06/active-annotation-best-practices.html – Viliam Simko Feb 02 '15 at 12:40