1

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 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Thankyou for your replay... but in previously i'm executing same structure of query and value object annotaions also in that time not giving any error why? now only giving error? i think my query is problem or i miss annotaion in values object class...
Try this @JoinTable(name="SKILLSET_COURSE",joinColumns={@JoinColumn(name="SKILLSET_ID")},inverseJoinColumns={@JoinColumn(name="COURSE_ID")})
Or change to FetchType.LAZY so you don't have to load orphans.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.