0

似乎我有类似的问题,比如Informix 的一个 Hibernate Query 问题,或者至少我有同样的例外。我使用休眠 3.6.6、jboss 6.1 和 informix10。事实上,当使用 jboss 5 时,在迁移之前一切正常。另外我想提一下我DELIMIDENT的网址中没有参数。

我的问题出现在具有相同引用类型的两个嵌入字段的类上(为清楚起见:名称如下,发件人和 cerrier)。两个字段都使用@AttributeOverride@AssociationOverride覆盖正确的列名称和带有注释的类的关联@embeddable。最后一个也@OneToOne与其他实体有关系。我尝试检查该字段的哪个问题,因此如果我删除“发件人”字段,一切都会开始正常工作。这是代码的一部分:

@Embeddable
public class ProductsAgent{ @Column(name = "name") private String name; @Column(name = "statute") private String statute; @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "products_agent_address_id") private Address address; }
@Entity
class Registration76v{
@Embedded
@AssociationOverride(name = "address", joinColumns = @JoinColumn(name = "sender_address_id", table = "registration76v"))
@AttributeOverrides(value = { @AttributeOverride(name = "name", column = @Column(name = "sender_name", table = "registration76v")), @AttributeOverride(name = "statute", column = @Column(name = "sender_statute", table = "registration76v")) })
private ProductsAgent1 sender = new ProductsAgent1();
@Embedded
@AssociationOverride(name = "address", joinColumns = @JoinColumn(name = "carrier_address_id", table = "registration76v"))
@AttributeOverrides(value = { @AttributeOverride(name = "name", column = @Column(name = "carrier_name", table = "registration76v")), @AttributeOverride(name = "statute", column = @Column(name = "carrier_statute", table = "registration76v")) })
private ProductsAgent carrier = new ProductsAgent();
}

这是日志的一部分:

16:20:38,212 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: -79738, SQLState: IX000
16:20:38,212 ERROR [org.hibernate.util.JDBCExceptionReporter] org.hibernate.util.JDBCExceptionReporter] No such column name
16:20:38,215 INFO [org.hibernate.event.def.DefaultLoadEventListener] Error performing load command: org.hibernate.exception.GenericJDBCException: could not load an entity:
16:20:38,215 INFO [org.hibernate.event.def.DefaultLoadEventListener] Error performing load command: org.hibernate.exception.GenericJDBCException: could not load an entity:

不知何故,我的同事发现问题来自错误生成的代码这里 sql. 并且更具体地使用生成的别名,sender_address_id稍后搜索给定列的别名。所以,如果有人能给我一个如何解决这个问题的建议,我真的很感激。提前致谢。

4

0 回答 0