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 Jan 24, 2019
1 parent ee07599 commit 8a82dfa
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 8a82dfa

Please sign in to comment.