御助言をお願いします。
以下のように実装されている Exception に対し XxxException(Throwable , int) でインスタンスを生成した時、
EJBを呼び出しているクライアントで getCode() をすると、設定した int 値を返すのですが、getCause() は null を返すのです。
EJB の中でこの Exception を catch した後に getCause() した時は Exception を取得できます。

public class XxxException extends Exception {

  private Exception detail;
  private int code = NULL;

  public XxxException() {}

  public XxxException(Exception e) {
    this.detail = e;
  }

  public XxxException(Exception e, int code) {
    this.detail = e;
    this.code = code;
  }

  public int getCode() {
    return code;
  }

  public Exception getCause() {
    return detail;
  }
}