Hibernate 休眠对象列表

Hibernate 休眠对象列表,hibernate,Hibernate,当我尝试获取对象列表时,会出现以下异常: Hibernate: select this_.newsId as newsId2_0_, this_.newsBrief as newsBrief2_0_, this_.newsContent as newsCont3_2_0_, this_.newsDate as newsDate2_0_, this_.newsTitle as newsTitle2_0_, this_.selected as selected2_0_ from NEWS thi

当我尝试获取对象列表时,会出现以下异常:

  Hibernate: select this_.newsId as newsId2_0_, this_.newsBrief as newsBrief2_0_, this_.newsContent as newsCont3_2_0_, this_.newsDate as newsDate2_0_, this_.newsTitle as newsTitle2_0_, this_.selected as selected2_0_ from NEWS this_
    Nov 15, 2013 11:04:58 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet [action] in context with path [/strts-spring-hbnt-nomaven] threw exception [org.hibernate.exception.SQLGrammarException: could not execute query] with root cause
    java.sql.SQLSyntaxErrorException: ORA-00904: "THIS_"."SELECTED": invalid identifier
ddl

新闻类:

@Entity
@Table(name="NEWS")
public class News {

    private boolean selected=false;
    @Id 
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "news_seq_gen")
    @SequenceGenerator(name = "news_seq_gen", sequenceName = "news_seq")
    private int newsId;

    @Column(name="newsTitle", nullable = false, length = 100)
    private String newsTitle;
    @Column(name="newsDate", nullable = false)
    private Date newsDate;
    @Column(name="newsBrief", nullable = false, length = 500)
    private String newsBrief;
    @Column(name="newsContent", nullable = false, length = 2048)
    private String newsContent;
        //getters and setters 
}
查询:

return sessionFactory.getCurrentSession().createQuery("from News as News").list();
为什么hibernate会在列名中添加数字?问题出在哪里?
任何建议都将受到赞赏

通过在类属性上放置
@Id
来使用字段访问模式。这使hibernate将所有字段都视为表列。据我所知,您的DDL,
News.selected
是一个临时属性


试着把
@Transient
注释放在
选中的

是的,它有帮助:D thnx
return sessionFactory.getCurrentSession().createQuery("from News as News").list();