[Seasar-user:20343] [Kuina-Dao]DTOのプロパティを条件とする検索でOrderbySpecをDTOプロパティに含めると異常

Inamine Morihiko [E-MAIL ADDRESS DELETED]
2010年 11月 19日 (金) 16:53:40 JST


こんにちはいつもお世話になっています
稲嶺です

DTOのプロパティを条件とする検索でDTOのプロパティにOrderbySpecを追加して
DTOでソートを指定したいと思っているのですが
DTOへOrderbySpecの型を加えると異常終了となります

環境:
Eclipse Platform Version: 3.4.2
Diigu Eclipse プラグイン:1.0.0
Dolteng Eclipse プラグイン:0.41.0
Dolteng オフライン用依存ライブラリ(optional):0.41.0
kuina-dao-1.0.3.jar


ソートの指定方法が間違っているのでしょうか?

テストプログラム
-------------------------------------------------------------
package Receipt.dao;


import java.util.List;

import javax.annotation.Resource;

import org.seasar.extension.unit.S2TestCase;

import Receipt.dto.SerchReceiptDto;
import Receipt.entity.ReceiptInfo;

public class testReceiptDao extends S2TestCase {
    @Resource
    ReceiptInfoDao receDao;
    
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        include("app.dicon");
    }
    public void testFindTx() throws Exception{
        List<ReceiptInfo> receL;
        SerchReceiptDto serchReceDto = new SerchReceiptDto();
        
        serchReceDto.setReceiptNo_CONTAINS("1011");
        //serchReceDto.setOrderBy(new OrderbySpec("receiptSeq", 
OrderingSpec.DESC));
        receL = receDao.findByReceipt(serchReceDto);
        System.out.println("receL.size=[" +receL.size() +"]");
        for (ReceiptInfo rece : receL) {
            System.out.println("ReceiptInfo[ReceiptContent]=[" +rece.
getReceiptContent() +"]");
        }
    }
}
-----------------------------------------------------------------------
実行時のトレース
-----------------------------------------------------------------------
java.lang.IllegalArgumentException
    at org.seasar.kuina.dao.internal.condition.
ConditionalExpressionBuilderFactory.
getParameterMethod(ConditionalExpressionBuilderFactory.java:370)
    at org.seasar.kuina.dao.internal.condition.
ConditionalExpressionBuilderFactory.
createBuilder(ConditionalExpressionBuilderFactory.java:213)
    at org.seasar.kuina.dao.internal.builder.
AbstractDynamicQueryCommandBuilder.
createBuilder(AbstractDynamicQueryCommandBuilder.java:135)
    at org.seasar.kuina.dao.internal.builder.DtoQueryCommandBuilder.
createBuilders(DtoQueryCommandBuilder.java:83)
    at org.seasar.kuina.dao.internal.builder.DtoQueryCommandBuilder.
build(DtoQueryCommandBuilder.java:59)
    at org.seasar.kuina.dao.internal.builder.
AbstractDynamicQueryCommandBuilder.
build(AbstractDynamicQueryCommandBuilder.java:59)
    at org.seasar.kuina.dao.internal.metadata.DaoMetadataImpl.
createCommand(DaoMetadataImpl.java:114)
    at org.seasar.kuina.dao.internal.metadata.DaoMetadataImpl$
CommandHolder.get(DaoMetadataImpl.java:160)
    at org.seasar.kuina.dao.internal.metadata.DaoMetadataImpl.
execute(DaoMetadataImpl.java:92)
    at org.seasar.kuina.dao.interceptor.KuinaDaoInterceptor.
invoke(KuinaDaoInterceptor.java:59)
    at Receipt.dao.ReceiptInfoDao$$EnhancedByS2AOP$$60029d$$
MethodInvocation$$findByReceipt0.proceed(MethodInvocationClassGenerator.
java)
    at org.seasar.framework.aop.interceptors.TraceInterceptor.
invoke(TraceInterceptor.java:73)
    at Receipt.dao.ReceiptInfoDao$$EnhancedByS2AOP$$60029d$$
MethodInvocation$$findByReceipt0.proceed(MethodInvocationClassGenerator.
java)
    at Receipt.dao.ReceiptInfoDao$$EnhancedByS2AOP$$60029d.
findByReceipt(ReceiptInfoDao$$EnhancedByS2AOP$$60029d.java)
    at Receipt.dao.testReceiptDao.testFindTx(testReceiptDao.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.
invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.
invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:164)
    at org.seasar.framework.unit.S2FrameworkTestCase.
doRunTest(S2FrameworkTestCase.java:519)
    at org.seasar.extension.unit.S2TestCase.doRunTest(S2TestCase.java:
103)
    at org.seasar.framework.unit.S2FrameworkTestCase.
runBare(S2FrameworkTestCase.java:308)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:120)
    at junit.framework.TestSuite.runTest(TestSuite.java:230)
    at junit.framework.TestSuite.run(TestSuite.java:225)
    at org.junit.internal.runners.JUnit38ClassRunner.
run(JUnit38ClassRunner.java:81)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.
run(JUnit4TestReference.java:45)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.
run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
main(RemoteTestRunner.java:196)

DTO
-----------------------------------------------------
package Receipt.dto;

import java.util.Date;

import org.seasar.kuina.dao.NamedParameter;
import org.seasar.kuina.dao.OrderbySpec;

public class SerchReceiptDto {
    private OrderbySpec orderby;
    private Integer receiptSeq;
    private String receiptNo;
    private String receiptNo_CONTAINS;
    
    
    @NamedParameter
    public OrderbySpec getOrderBy(){
        return orderby;
    }
    public void setOrderBy(OrderbySpec orderBy){
        this.orderby = orderBy;
    }
    public Integer getReceiptSeq() {
        return receiptSeq;
    }

    public void setReceiptSeq(Integer receiptSeq) {
        this.receiptSeq = receiptSeq;
    }
    public String getReceiptNo() {
        return receiptNo;
    }

    public void setReceiptNo(String receiptNo) {
        this.receiptNo = receiptNo;
    }
    public String getReceiptNo_CONTAINS() {
        return receiptNo_CONTAINS;
    }

    public void setReceiptNo_CONTAINS(String receiptNo) {
        this.receiptNo_CONTAINS = receiptNo;
    }
    public Date getReceiptDate() {
        return receiptDate;
    }

    
}

-----------------------------------------------------
Entity
-------------------------------------------------------------
package Receipt.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="RECEIPT_INFO")
public class ReceiptInfo {

    @Id
    @GeneratedValue
    @Column(name = "RECEIPT_SEQ")
    private Integer receiptSeq;
    @Column(name = "RECEIPT_NO")
    private String receiptNo;
    
    public Integer getReceiptSeq() {
        return receiptSeq;
    }

    public void setReceiptSeq(Integer receiptSeq) {
        this.receiptSeq = receiptSeq;
    }
    public String getReceiptNo() {
        return receiptNo;
    }

    public void setReceiptNo(String receiptNo) {
        this.receiptNo = receiptNo;
    }
}
-------------------------------------------------------------
DAO
-------------------------------------------------------------

import java.util.List;

import Receipt.dto.SerchReceiptDto;
import Receipt.entity.ReceiptInfo;

public interface ReceiptInfoDao {

    public List<ReceiptInfo> findAll();

    public ReceiptInfo find(Integer receiptSeq);

    public void persist(ReceiptInfo info);

    public ReceiptInfo merge(ReceiptInfo info);

    public void remove(ReceiptInfo info);

    public boolean contains(ReceiptInfo info);

    public void refresh(ReceiptInfo info);

    public void readLock(ReceiptInfo info);

    public void writeLock(ReceiptInfo info);
    
    public List<ReceiptInfo> findByReceipt(SerchReceiptDto receipt);

}
-------------------------------------------------------------


Seasar-user メーリングリストの案内