问题
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