spring-data-jpa: java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [XXX] on this ManagedType [DATAJPA-890]

Andrei Navrotski opened DATAJPA-890 and commented

In our project we have such JPA entity: @Entity @Table(name = “orders”) public class Order {

@EmbeddedId
private OrderPrimaryKey id;

@Column(name = "last_modified_time")
private Date lastModifiedTime;

@Transient
private final Set<Item> items = new HashSet<>();

public Order() {
    // TODO Auto-generated constructor stub
}

public PrimaryKey getPrimaryKey() {
    return id;
}

public Date getLastModifiedTime() {
    return lastModifiedTime;
}

@Override
public List<EntitiesConnection> getConnections() {
...
here is some logic, and this class doesn't have "connections" field.
}

Everything works fine with spring-data-jpa v. 1.9.4.RELEASE. But after upgrading to spring-data-jpa v. 1.10.1.RELEASE, spring fails to load application context with exception: Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [connections] on this ManagedType [com.acme.Order]

It seems that not only fields, but methods also are fetched as JPA entities. Class annotation @Access(AccessType.FIELD) not helps. Annotating method getConnections() with @Transient not helps also


Affects: 1.10.1 (Hopper SR1)

2 votes, 12 watchers

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

Catherine Tran commented

I am having the exact same issue with spring boot version 2.2.5.RELEASE