多くの検索と試行の後、私は立ち往生しています...私は2つのクラス、1つはExpectedSecurityReturn、もう1つはForecastReturnTypeです。 ForecastReturnTypeはExpectedSecurityReturnのメンバーですが、データを永続化するときは挿入しないでください。私は "不十分な特権"を取得し続けますが、JDBCとJPAの削除で正常に動作するので、ユーザがテーブルexpected_security_returnに対する削除/挿入権限を持っていることがわかります。したがって、私はそれが私のクラスと関係していると思います。トランザクションから挿入を実行するときのJPA 2.0の不十分な特権
@Table(name = "EXPECTED_SECURITY_RETURNS")
@Entity
@IdClass(ExpectedSecurityReturn.ExpectedSecurityReturnPK.class)
public class ExpectedSecurityReturn {
@Id
@Column(name = "REP_SEC_ID")
private Integer repSecId;
@Id
@Column(name = "AS_OF_DATE")
private Date date;
@Id
@ManyToOne(optional = false)
@JoinColumn(name = "RETURN_TYPE_ID", referencedColumnName = "RETURN_TYPE_ID", insertable=false)
private ForecastReturnType returnType;
@Column(name="CURR_TOUSD_RET") // local currency to usd
private Double currencyToUsdReturn;
}
ForecastReturnTypeを含んで主キークラス、:
// ------------------------------
// PK
// ------------------------------
public static class ExpectedSecurityReturnPK implements Serializable {
private static final long serialVersionUID = 1325372032981567439L;
public ExpectedSecurityReturnPK() {
}
public ExpectedSecurityReturnPK(final Integer repSecId,
final Date asOfDate, ForecastReturnType returnType) {
if (repSecId == null)
throw new IllegalArgumentException("null rep sec id");
if (asOfDate == null)
throw new IllegalArgumentException("null asOfDate");
if (returnType == null)
throw new IllegalArgumentException("null returnType");
this.repSecId = repSecId;
this.date = new Date(asOfDate.getTime());
}
@Override
public boolean equals(final Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
final ExpectedSecurityReturnPK that = (ExpectedSecurityReturnPK) o;
if (repSecId != that.repSecId)
return false;
if (!date.equals(that.date))
return false;
if (!returnType.equals(that.returnType))
return false;
return true;
}
@Override
public int hashCode() {
int result = repSecId;
result = 31 * result + date.hashCode();
result = 31 * result + returnType.getForecastTypeId();
return result;
}
private int repSecId;
private Date date;
private ForecastReturnType returnType;
}
とForecastReturnType:
@Table(name="EXPECTED_SEC_RET_TYPE_DECODE")
@Entity
public class ForecastReturnType {
@Id
@Column(name="RETURN_TYPE_ID")
private int forecastTypeId;
@Column(name="SHORT_NAME")
private String shortName;
@Column(name="LONG_NAME")
private String longName;
@OneToMany(fetch=FetchType.LAZY, mappedBy="returnType")
Collection<ExpectedSecurityReturn> expectedSecurityReturns;
}
は、誰も私が私が間違っているのかを把握助けてもらえますか?私は成功せずに多くのことを試みた...私は、ユーザーが特権を持っていないことを知っているので、犯人はExpectedSecurityReturn.returnTypeだと思う。
基本的には、ExpectedSecurityReturnインスタンスを挿入/保持する必要があります。
JPA実装のログを調べて、どのSQLが呼び出されているのか、そして例外の詳細(およびそのスタックトレース) – DataNucleus
Seconds、PostgreSQLを使用している場合、postgresql.confを頻繁に変更できます/ var/pgsqlにあります)、サーバでのロギングを有効にし、ロギングセクションを探します。 MySQLを使用している場合は、my.cnf(多くの場合/ etc)にログを追加してすべてのクエリを記録することができます.Oracleを使用している場合は、V $ SQLで参照する必要があります。私はあなたがすべてのクエリをログに記録できるかどうかを知るためにMSSQLをよく知っていませんが、SQL Studioを通してデータベースロックの履歴を取得できると思います。 – PlexQ
結果のSQLは – user899757