0

Hibernate でオブジェクトを保存するためにクエリを実行すると - 生成されたクエリが間違っています - 以下は hibernate で生成されたクエリです -

select sintranhis_.SINID, sintranhis_.SINDDT as SINDDT3_, sintranhis_.SINDES as SINDES3_, sintranhis_.SINTIME as SINTIME3_, sintranhis_.SINTNO as SINTNO3_ from ERPDSS3.SINTRAN_HISTORY  sintranhis_ where sintranhis_.SINID=?

以下は SINTRAN_HISTORY クラスです -

public class SottranHistory extends Persistent_Model implements java.io.Serializable {


     private SottranHistoryId id;
     private Stpmast stpmast;
     private String sotdes;
     private BigDecimal sottno;
     private Date sotddt;
     private Timestamp sottime;

    public SottranHistory() {
    }


    public SottranHistory(SottranHistoryId id, Stpmast stpmast) {
        this.id = id;
        this.stpmast = stpmast;
    }
    public SottranHistory(SottranHistoryId id, Stpmast stpmast, String sotdes, BigDecimal sottno, Date sotddt, Timestamp sottime) {
       this.id = id;
       this.stpmast = stpmast;
       this.sotdes = sotdes;
       this.sottno = sottno;
       this.sotddt = sotddt;
       this.sottime = sottime;
    }

     @EmbeddedId


    @AttributeOverrides( {
        @AttributeOverride(name="sottyp", column=@Column(name="SOTTYP", nullable=false, length=12) ), 
        @AttributeOverride(name="sotid", column=@Column(name="SOTID", nullable=false, precision=6, scale=0) ) } )
    public SottranHistoryId getId() {
        return this.id;
    }

    public void setId(SottranHistoryId id) {
        this.id = id;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="SOTTYP", nullable=false, insertable=false, updatable=false)
    public Stpmast getStpmast() {
        return this.stpmast;
    }

    public void setStpmast(Stpmast stpmast) {
        this.stpmast = stpmast;
    }


    @Column(name="SOTDES", length=70)
    public String getSotdes() {
        return this.sotdes;
    }

    public void setSotdes(String sotdes) {
        this.sotdes = sotdes;
    }


    @Column(name="SOTTNO", precision=22, scale=0)
    public BigDecimal getSottno() {
        return this.sottno;
    }

    public void setSottno(BigDecimal sottno) {
        this.sottno = sottno;
    }

    @Temporal(TemporalType.DATE)
    @Column(name="SOTDDT ", length=7)
    public Date getSotddt() {
        return this.sotddt;
    }

    public void setSotddt(Date sotddt) {
        this.sotddt = sotddt;
    }

    @Column(name="SOTTIME")
    public Timestamp getSottime() {
        return this.sottime;
    }

    public void setSottime(Timestamp sottime) {
        this.sottime = sottime;
    }
}

エラーはたまたま -

SEVERE: ORA-00904: "SINTRANHIS_"."SINID": invalid identifier

Jul 25, 2012 11:25:36 AM com.dchan.codelion.models.Persistent_Model attachDirty
SEVERE: attach failed
org.hibernate.exception.SQLGrammarException: could not retrieve snapshot: [com.dchan.codelion.models.SintranHistory#1]
4

1 に答える 1

0

最後に、列名にスペースがあることがわかりました。それを修正した後、すべてが機能しています

于 2012-07-25T06:04:32.297 に答える