Skip to content

Commit

Permalink
[Blazebit#728] Fix NPE during entity type id resolving for deltaspike…
Browse files Browse the repository at this point in the history
… repository method using the plain entity type
  • Loading branch information
beikov committed Feb 19, 2019
1 parent 3e230f1 commit acb433b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ protected String entityName() {

@Override
protected String idAttribute() {
Class<?> entityClass = context.getEntityViewManager().getMetamodel().view(viewClass()).getEntityClass();
Class<V> viewClass = viewClass();
Class<?> entityClass;
if (viewClass == null) {
entityClass = entityClass();
} else {
entityClass = context.getEntityViewManager().getMetamodel().view(viewClass).getEntityClass();
}
EntityType<?> entityType = context.getEntityManager().getMetamodel().entity(entityClass);
return JpaMetamodelUtils.getSingleIdAttribute(entityType).getName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ protected String entityName() {

@Override
protected String idAttribute() {
Class<?> entityClass = context.getEntityViewManager().getMetamodel().view(viewClass()).getEntityClass();
Class<V> viewClass = viewClass();
Class<?> entityClass;
if (viewClass == null) {
entityClass = entityClass();
} else {
entityClass = context.getEntityViewManager().getMetamodel().view(viewClass).getEntityClass();
}
EntityType<?> entityType = context.getEntityManager().getMetamodel().entity(entityClass);
return JpaMetamodelUtils.getSingleIdAttribute(entityType).getName();
}
Expand Down

0 comments on commit acb433b

Please sign in to comment.