0

I use Spring Data JPA 1.8.0.RELEASE

entity Attachment has a property named relate_id,

I add a method findByRelate_id(String rid) in Repository,

but I got a exception:

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property relate found for type Attachment!

I realy need my field name is relate_id, not change to relateId, And I dont hope write @Query(...) by myself.

How to slove it?

lionyu
  • 593
  • 3
  • 5
  • 14

1 Answers1

1

Try adding another _ to escape it, since it is a reserved character in Spring Data.

findByRelate__id(String rid)

Check out this similar post.

Community
  • 1
  • 1
Predrag Maric
  • 23,938
  • 5
  • 52
  • 68