AKAI TSUKI

System development or Technical something

S2DaoとPostgresqlで困った。

S2Dao-CodeGenPostgresqlのテーブルから生成した
コードを使ってテーブルにinsertしてみた。

but

ERROR: リレーション"sample_info"は存在しません

というエラーメッセージが出力されて、
テーブルにinsertできないじゃないかーーー!

原因は・・・

Postgresqlが大文字と小文字を区別しているらしく、
大文字と小文字を区別する場合は、SQLでテーブル名やカラム名をダブルコーテーションで囲む必要があるとのこと。

うむむ・・・

対処としては、
生成されたEntityクラスの

	/**
	 * CHECK_NUMBERを返します。
	 * @return CHECK_NUMBER
	 */
	@org.seasar.dao.annotation.tiger.Id(value=org.seasar.dao.annotation.tiger.IdType.ASSIGNED)
	@org.seasar.dao.annotation.tiger.Column("\"CHECK_NUMBER\"")
	public String getCheckNumber() {
		return checkNumber;
	}

という感じで、

 @org.seasar.dao.annotation.tiger.Column("\"CHECK_NUMBER\"")

のCHECK_NUMBERをダブルコーテーションで囲んでみました。

結果は、以下のような感じでログを出力してくれて
OKとなったようです。

System start
DEBUG 2011-02-13 01:30:42,367 [main] S2Containerを作成します。path=jp/person/akai/tsuki/samplechecker/dicon/alldao.dicon
DEBUG 2011-02-13 01:30:42,470 [main] S2Containerを作成します。path=dao.dicon
DEBUG 2011-02-13 01:30:42,486 [main] S2Containerを作成します。path=j2ee.dicon
DEBUG 2011-02-13 01:30:42,704 [main] S2Containerを作成しました。path=j2ee.dicon
DEBUG 2011-02-13 01:30:42,778 [main] S2Containerを作成しました。path=dao.dicon
DEBUG 2011-02-13 01:30:42,779 [main] S2Containerを作成します。path=aop.dicon
DEBUG 2011-02-13 01:30:42,829 [main] S2Containerを作成しました。path=aop.dicon
DEBUG 2011-02-13 01:30:42,843 [main] S2Containerを作成しました。path=jp/person/akai/tsuki/samplechecker/dicon/alldao.dicon
WARN  2011-02-13 01:30:42,864 [main] org.seasar.extension.tx.RequiredInterceptorのプロパティ(transactionControl)が見つからないので設定をスキップします
WARN  2011-02-13 01:30:42,865 [main] org.seasar.extension.tx.RequiresNewInterceptorのプロパティ(transactionControl)が見つからないので設定をスキップします
WARN  2011-02-13 01:30:42,865 [main] org.seasar.extension.tx.MandatoryInterceptorのプロパティ(transactionControl)が見つからないので設定をスキップします
WARN  2011-02-13 01:30:42,865 [main] org.seasar.extension.tx.NotSupportedInterceptorのプロパティ(transactionControl)が見つからないので設定をスキップします
System stop
DEBUG 2011-02-13 01:30:43,194 [main] BEGIN jp.person.akai.tsuki.samplechecker.dao.SampleInfoDao#insert([/checkNumber=12345679/sendTime=100/recvTime=0/resendTime=200/resendCounter=5])
DEBUG 2011-02-13 01:30:43,458 [main] 物理的なコネクションを取得しました
DEBUG 2011-02-13 01:30:43,458 [main] 論理的なコネクションを取得しました。tx=null
DEBUG 2011-02-13 01:30:43,482 [main] 論理的なコネクションを閉じました。tx=null
DEBUG 2011-02-13 01:30:43,484 [main] 論理的なコネクションを取得しました。tx=null
DEBUG 2011-02-13 01:30:43,557 [main] 論理的なコネクションを閉じました。tx=null
DEBUG 2011-02-13 01:30:43,636 [main] 論理的なコネクションを取得しました。tx=null
DEBUG 2011-02-13 01:30:43,637 [main] 論理的なコネクションを閉じました。tx=null
DEBUG 2011-02-13 01:30:43,647 [main] 論理的なコネクションを取得しました。tx=null
DEBUG 2011-02-13 01:30:43,652 [main] INSERT INTO "SAMPLE_INFO" ("CHECK_NUMBER", "RESEND_TIME", "SEND_TIME", "RECV_TIME", "RESEND_COUNTER") VALUES ('12345679', 200, 100, 0, 5)
DEBUG 2011-02-13 01:30:43,701 [main] 論理的なコネクションを閉じました。tx=null
DEBUG 2011-02-13 01:30:43,701 [main] END jp.person.akai.tsuki.samplechecker.dao.SampleInfoDao#insert([/checkNumber=12345679/sendTime=100/recvTime=0/resendTime=200/resendCounter=5]) : 1

    public void doInsert()
    {
        SampleInfo entity = new SampleInfo();
        entity.setCheckNumber("12345679");
        entity.setResendTime(200L);
        entity.setSendTime(100L);
        entity.setRecvTime(0L);
        entity.setResendCounter(5);
        
        this.dao_.insert(entity);
        
    }