我得到了代码
public static List <Post> getPostForTopic(String topicName) {
List <Post> list = find.where().eq("topic_name",topicName).findList();
return list;
}
SQL 演进
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table post (
text varchar(255))
;
create table topic (
topic_name varchar(255) not null,
constraint pk_topic primary key (topic_name))
;
create sequence topic_seq;
# --- !Downs
SET REFERENTIAL_INTEGRITY FALSE;
drop table if exists post;
drop table if exists topic;
SET REFERENTIAL_INTEGRITY TRUE;
drop sequence if exists topic_seq;
当我运行它时,我有执行异常:
[PersistenceException: Query threw SQLException:Столбец "TOPIC_NAME" не найден Column "TOPIC_NAME" not found; SQL statement: select t0.text c0 from post t0 where topic_name = ? [42122-158] Bind values:[null] Query was: select t0.text c0 from post t0 where topic_name = ? ]
我和当我在我的 h2 数据库控制台中键入查询时,例如“Select * from topic”,我得到的结果是没有表“TOPIC”。请帮我找出错误