1

WebSphere v8 を実行しており、Java EE 6 環境で JPA パーシスタンスを使用しています。

特定のエンティティを処理するコードを実行しようとすると、次の例外が発生します。

javax.ejb.EJBTransactionRolledbackException: ネストされた例外: javax.ejb.EJBTransactionRolledbackException: ネストされた例外: javax.ejb.EJBException: ネストされた例外を参照してください。ネストされた例外は次のとおりです: org.apache.openjpa.persistence.ArgumentException: タイプ「クラス au.com.combined.domain.changeroutine.ChangeRoutineConsumedPK」は拡張されていません。

ただし、この記事では、私のクラスは実行時に既に拡張されている必要があると述べています。ChangeRoutineConsumedPK は埋め込み可能なクラスです。誰かが私のクラスを見て、私が間違っていることを教えてもらえますか? ありがとうございました。

ChangeRoutineConsumed:

@Entity
@Table(name = ChangeRoutineConsumed.TABLE_NAME)
public class ChangeRoutineConsumed extends BaseBusinessObject {

    public static final String TABLE_NAME = "COCHANGEROUTINECONSUMED";

    @EmbeddedId
    private ChangeRoutineConsumedPK id;

    protected ChangeRoutineConsumed() {
        super();
    }

    public ChangeRoutineConsumed(@Min(1) long changeRoutineId, @NotNull String consumedBy){
        this(new ChangeRoutineConsumedPK(changeRoutineId, consumedBy));
    }

    public ChangeRoutineConsumed(@NotNull ChangeRoutineConsumedPK id){
        super();
        setId(id);
    }
    ...
    public int hashCode(){...};
    public boolean equals(Object obj){...}
}

ChangeRoutineConsumedPK:

@Embeddable
public class ChangeRoutineConsumedPK {

    @Column
    private long changeRoutineId;
    @Column
    private String consumedBy;

    public ChangeRoutineConsumedPK(){}

    public ChangeRoutineConsumedPK(long changeRoutineId, String consumedBy) {
        setChangeRoutineId(changeRoutineId);
        setConsumedBy(consumedBy);
    }
    ...

    public int hashCode() {...}
    public boolean equals(Object obj) {...}
}
4

2 に答える 2

0

メインクラスから実行している場合は、実行時に以下のパラメーターを渡します java -javaagent:/openjpa.jar com.xyz.Main

Eclipse を使用している場合は、実行構成 > 引数 > VM 引数で上記の値を指定します。

于 2016-10-05T10:40:35.393 に答える