0

从休眠 4.0.1Final 升级到 4.2.3Final 时我有这个异常(实际上它发生在 4.1.6 的所有版本):

16:46:19,946 ERROR [stderr] (ajp--0.0.0.0-8009-1) javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
16:46:19,948 ERROR [stderr] (ajp--0.0.0.0-8009-1) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
16:46:19,949 ERROR [stderr] (ajp--0.0.0.0-8009-1) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
16:46:19,959 ERROR [stderr] (ajp--0.0.0.0-8009-1) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:275)

......

Caused by: java.sql.SQLException: ORA-00904: "PROCESSWIT0_"."SUBSCR_ID": invalid identifier

这以前工作过。我认为问题的发生是因为我们使用了继承:

@Entity
@Table(name="PROCESS_WITH_ACTION")
public abstract class ProcessWithAction extends SimpleProcess {...}

@MappedSuperclass
public class SimpleProcess extends BusinessProcess {...}

@Entity
@Table(name = "PROCESS")
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class BusinessProcess extends Identifiable {...}

@MappedSuperclass
public abstract class Identifiable implements Serializable, IValidatable {
    @ManyToOne(optional=false, fetch = FetchType.LAZY)
    @JoinColumn(name="SUBSCR_ID", insertable=false, updatable=false, nullable=false)
    private Subscriber subscriber;
    ...
}

因此,当我使用 getResultList() 查询 ProcessWithAction 列表时,会发生异常。我也尝试将继承策略更改为 SINGLE_TABLE 和 TABLE_PER_CLASS,但它们都不像以前那样工作(版本 4.0.1Final)。

我没有任何想法来解决它。你能给我一些建议吗?

谢谢

4

0 回答 0