从hibernate 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)。
我没有任何想法来解决它。能不能给我一些建议。
由于