I am trying to upgrade an old project from Ebean 3.2.5 to 6.18.1. I have gotten the webapp to run with the upgraded Ebean libraries now, and some of it appears to be working properly, but I've run into some problems:
java.lang.NullPointerException
at com.avaje.ebeaninternal.server.properties.EnhanceBeanPropertyInfo$Getter.get(EnhanceBeanPropertyInfo.java:67)
at com.avaje.ebeaninternal.server.deploy.BeanProperty.getValue(BeanProperty.java:724)
at com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocMany.addBeanToCollectionWithCreate(BeanPropertyAssocMany.java:186) [detailBean is an ItemStore object, parentBean is null]
at com.avaje.ebeaninternal.server.query.SqlTreeNodeManyRoot.load(SqlTreeNodeManyRoot.java:27) [parentBean is an Item object, detailBean is an ItemStore, contextParent is null]
at com.avaje.ebeaninternal.server.query.SqlTreeNodeBean.load(SqlTreeNodeBean.java:298)
at com.avaje.ebeaninternal.server.query.CQuery.readNextBean(CQuery.java:437)
at com.avaje.ebeaninternal.server.query.CQuery.hasNext(CQuery.java:512)
at com.avaje.ebeaninternal.server.query.CQuery.readCollection(CQuery.java:543)
at com.avaje.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:302)
The code it's trying to run is:
String query = "find item join itemStores join itemStores.itemPrices where item.id=:id and itemStores.id is not null and available = true";
return Ebean.createQuery(Item.class, query).setParameter("id", item.getId()).setDistinct(true).findList();The relationship looks like this:
In ItemStore.java:
@ManyToOne(targetEntity = Item.class, fetch = FetchType.EAGER)
private Item itemPackage;In Item.java:
@OneToMany(targetEntity = ItemStore.class, fetch = FetchType.EAGER, mappedBy = "itemPackage", cascade = CascadeType.ALL)
private List<ItemStore> itemStores = new ArrayList<ItemStore>();Both entities are annotated with @Entity and extend BaseEntity, which starts off:
@MappedSuperclass
public abstract class BaseEntity implements Serializable{
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
protected Long id;
@Version
protected Integer version;Another part of the system runs
Query<Foo> q = Ebean.createQuery(Foo.class, query.toString());//query is something like "find foo where ......"
List<Foo> objects = q.findList();and when I iterate right away through the list the query returns and print out the id field, they're all null. But the id field is not null in other parts of the system.
I scanned the release notes for breaking changes that looked relevant but didn't see anything. Any ideas?
Thanks,
Christie