オブジェクトのリストを取得しようとすると、次の例外が発生します:
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
--------------------------------------------------------
-- DDL for Table NEWS
--------------------------------------------------------
CREATE TABLE "SYSTEM"."NEWS"
( "NEWSID" NUMBER,
"NEWSTITLE" VARCHAR2(100 BYTE),
"NEWSBRIEF" VARCHAR2(500 BYTE),
"NEWSCONTENT" VARCHAR2(2048 BYTE),
"NEWSDATE" DATE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM" ;
--------------------------------------------------------
-- DDL for Index NEWS_PK
--------------------------------------------------------
CREATE UNIQUE INDEX "SYSTEM"."NEWS_PK" ON "SYSTEM"."NEWS" ("NEWSID")
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM" ;
--------------------------------------------------------
-- Constraints for Table NEWS
--------------------------------------------------------
ALTER TABLE "SYSTEM"."NEWS" ADD CONSTRAINT "NEWS_PK" PRIMARY KEY ("NEWSID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM" ENABLE;
ALTER TABLE "SYSTEM"."NEWS" MODIFY ("NEWSDATE" NOT NULL ENABLE);
ALTER TABLE "SYSTEM"."NEWS" MODIFY ("NEWSCONTENT" NOT NULL ENABLE);
ALTER TABLE "SYSTEM"."NEWS" MODIFY ("NEWSBRIEF" NOT NULL ENABLE);
ALTER TABLE "SYSTEM"."NEWS" MODIFY ("NEWSTITLE" NOT NULL ENABLE);
ALTER TABLE "SYSTEM"."NEWS" MODIFY ("NEWSID" NOT NULL ENABLE);
ニュースクラス:
@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();
休止状態が列名に番号を追加するのはなぜですか? 問題はどこにありますか?任意の提案をいただければ幸いです。