[DAO-16] [Seasar-user:3915] PK のみ存在するテーブルへの Insert で例外が発生する Created: 2006-06-21 Updated: 2006-06-21 Resolved: 2006-06-21 |
|
Status: | Resolved |
Project: | S2Dao |
Component/s: | s2dao |
Affects Version/s: | 1.0.35 |
Fix Version/s: | 1.0.36 |
Type: | Bug | Priority: | Major |
Reporter: | manhole | Assignee: | manhole |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Environment: |
s2dao 1.0.35 |
Description |
s2daoのバージョンアップ(1.0.34 → 1.0.35)検証を行って org.seasar.framework.exception.SRuntimeException: [EDAO0014]not nullであるカラムがありません at org.seasar.dao.impl.InsertAutoDynamicCommand.createInsertPropertyTypes(InsertAutoDynamicCommand.java:119) at org.seasar.dao.impl.InsertAutoDynamicCommand.execute(InsertAutoDynamicCommand.java:52) at org.seasar.dao.interceptors.S2DaoInterceptor.invoke(S2DaoInterceptor.java:53) 状況としてはPKのみ存在するテーブルへInsertを行った時に発 内の ・1.0.35の場合 if (pt.isPrimaryKey()) { if (!identifierGenerator.isSelfGenerate()) { continue; } } else if (pt.getPropertyDesc().getValue(bean) == null) { ← ※※ここ※※ final String propertyName = pt.getPropertyName(); if (!propertyName.equalsIgnoreCase(timestampPropertyName) && !propertyName.equalsIgnoreCase(versionNoPropertyName)) { continue; } } else { notNullColumns++; } ・1.0.34の場合 if (pt.isPrimaryKey() && !identifierGenerator.isSelfGenerate()) { continue; } if (pt.getPropertyDesc().getValue(bean) == null) { ← ※※ここ※※ final String propertyName = pt.getPropertyName(); if (!propertyName.equalsIgnoreCase(timestampPropertyName) && !propertyName.equals(versionNoPropertyName)) { continue; } } else { notNullColumns++; } 以下がソースの抜粋になります。 CREATE TABLE humo ( hoge1 INTEGER NOT NULL ,hoge2 INTEGER NOT NULL ,PRIMARY KEY(hoge1, hoge2) ); @Bean(table = "humo") public class Humo { private Integer hoge1_; private Integer hoge2_; @Column("hoge1") public void setHoge1(Integer hoge1) { hoge1_ = hoge1; } public Integer getHoge1() { return hoge1_; } @Column("hoge2") public void setHoge2(Integer hoge2) { hoge2_ = hoge2; } public Integer getHoge2() { return hoge2_; } } @S2Dao(bean = Humo.class) public interface HumoDao { int insert(Humo humo); } public class HumoDaoTest extends S2DaoTestCase { private HumoDao humoDao_; public void testInsertTx() throws Exception { Humo humo = new Humo(); humo.setHoge1(10); humo.setHoge2(11); humoDao_.insert(humo); } } |
Comments |
Comment by manhole [ 2006-06-21 ] |
アプリケーション側でPKの値をセットする場合(identifierGenerator.isSelfGenerate()である場合)にも |