Skip to content

Commit

Permalink
解决使用JPA时两个可能为null的属性,发布2.2.2版本,fixed #mybatis-mapper/mapper#92
Browse files Browse the repository at this point in the history
  • Loading branch information
abel533 committed Dec 5, 2023
1 parent 193a669 commit a07066c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>io.mybatis</groupId>
<artifactId>mybatis-provider</artifactId>
<version>2.2.1</version>
<version>2.2.2</version>

<name>MyBatis Provider</name>
<description>MyBatis Provider 扩展</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ public void customize(EntityTable entity, MappedStatement ms, ProviderContext co
MetaObject metaObject = ms.getConfiguration().newMetaObject(ms);
metaObject.setValue("keyGenerator", Jdbc3KeyGenerator.INSTANCE);
metaObject.setValue("keyProperties", new String[]{id.property()});
} else if (!id.afterSql().isEmpty()) {
} else if (id.afterSql() != null && !id.afterSql().isEmpty()) {
KeyGenerator keyGenerator = handleSelectKeyGenerator(ms, id, id.afterSql(), false);
MetaObject metaObject = ms.getConfiguration().newMetaObject(ms);
metaObject.setValue("keyGenerator", keyGenerator);
metaObject.setValue("keyProperties", new String[]{id.property()});
} else if (id.genId() != GenId.NULL.class) {
} else if (id.genId() != null && id.genId() != GenId.NULL.class) {
Class<? extends GenId> genIdClass = id.genId();
boolean executeBefore = id.genIdExecuteBefore();
GenId<?> genId = null;
Expand Down

0 comments on commit a07066c

Please sign in to comment.