使用ebean查询SQL表

时间:2018-07-06 11:25:35

标签: sql playframework ebean

我正在学习游戏框架,我正在尝试使用ebean来查询名为heading2的现有sql表,然后以html显示结果。这给我一个SQLException:关键字'null'错误附近的语法不正确。任何建议将不胜感激

  package models;

    import io.ebean.Finder;
    import io.ebean.Model;
    import io.ebean.annotation.Sql;
    import play.data.validation.Constraints;

    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.Table;

    import java.math.BigDecimal;

    @Entity
    @Sql
    @Table(name="Heading2")

    public class Heading extends Model {


        @Id

        @Column(name="JobKeyID")
        public Integer JobKeyId;
        @Column(name="phoneNo1")
        public Integer phoneNo1;
        public String Email1;
        public String Email2;



        public static Finder<Integer, Heading> find = new Finder<>(Heading.class);



    }



public Result index(){
        List<Heading> jobs = Heading.find.all();
        return ok(index.render(jobs)) ;


@(jobs : List[Heading])

@Layout("All Books") {
    <h1> All Books</h1>
    @for(heading <- jobs) {
        <a class="btn btn-link" href="@routes.BooksController.show(heading.JobKeyId)">@heading.phoneNo1</a>
        <p> Price : @heading.Email1</p>
        <p> Author : @heading.Email2</p>
    }

}

0 个答案:

没有答案