Hibernate Annotation based Query executing Error?

こ雲淡風輕ζ 提交于 2019-12-08 03:13:57

问题


Actually in my Hibernate Annotation based Application have theree ValueObject classes(Bean class) these are..

public Class CourseVO{
       @Column(name="NAME")
    private String name;
    }

SKillsetVO class

public Class SkillsetVO{
@ManyToOne
@JoinColumn(name="COURSE_ID", insertable=false, updatable=false)
private CourseVO courseSID;
@ManyToMany(cascade = {CascadeType.ALL}, fetch=FetchType.EAGER)
    @JoinTable(name="SKILLSET_COURSE",joinColumns={@JoinColumn(name="SKILLSET_ID",referencedColumnName="S_ID")},inverseJoinColumns={@JoinColumn(name="S_ID")})
  private Set<CourseVO> course;}

TimetableVO class

public class TimetableVO{
@ManyToOne
    @JoinColumn(name="SKILLSET_ID", insertable=false, updatable=false)
    private SkillsetVO skillsetSID;
}

Note above code Primarikey called S_ID have contain another class called AbstractVO so my all classes are extends this AbstractVO class so no problem on Primary Key cration... Now in my Business logic i wrote a query :

select tt from TimetableVO tt join tt.skillsetSID.course c where c.name in (:courseNames)

then i'm giving :courseName like 'java' then it is giving error SKILLSET_COURSE table not exist yes it is correct i'm only creating Three table according to ValueObjects...but hibernate can do this ..Please help me to write query...


回答1:


Use hbm2ddl property to create or update. Or manually open the console and issue CREATE statement.



来源:https://stackoverflow.com/questions/13512494/hibernate-annotation-based-query-executing-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!