gpt4 book ai didi

java - '...jdoDetachedState' gwt 项目中的未知列 'field list'

转载 作者:行者123 更新时间:2023-11-29 03:02:51 24 4
gpt4 key购买 nike

我有奇怪的问题。当我在没有 gwt 的情况下运行我的项目时,只是 hibernate - 一切正常,但是当我在 gwt 中插入代码时,这个异常就出现了。

PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 1054, SQLState: 42S22
PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Unknown column 'employee0_.jdoDetachedState' in 'field list'

这是我做的

List<Employee> list = session.createQuery("FROM Employee").list();

我的查询看起来像:

 Hibernate: 
select
employee0_.id as id1_1_,
employee0_.born as born2_1_,
employee0_.department as departme3_1_,
employee0_.first_name as first_na4_1_,
employee0_.jdoDetachedState as jdoDetac5_1_,
employee0_.post as post8_1_,
employee0_.salary as salary6_1_,
employee0_.second_name as second_n7_1_
from
employee employee0_

还有我类(class)的样子

@Entity
@Table(name="employee")
public class Employee implements Serializable{

@Id
public Integer id;

@Column(nullable=false)
public String first_name;

@Column(nullable=false)
public String second_name;

@OneToOne
@JoinColumn(name = "post")
public Position post;

@Column(nullable=false)
public String born;

@Column(nullable=false)
public Integer salary;

public String department;

public Employee(){}

... public getters and setters
}

其他查询有效,但这个不行。我找到了 https://stackoverflow.com/questions/16319853/unexpected-jdodetachedstate-column-when-using-hibernate-in-gwt-project但无法理解它如何提供帮助。

最佳答案

我遇到了同样的问题,我在 this web-site 找到了解决方案添加这些行:

@Transient 
protected Object[] jdoDetachedState;

这对我很有帮助。也许,这对任何人都有帮助。

关于java - '...jdoDetachedState' gwt 项目中的未知列 'field list',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20489658/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com