Joined: Thu Nov 11, 2010 5:45 am Posts: 4
|
I'm new to hibernate and JPA...In my project i'm using @OneToMany , @ManyToOne and also @ManyToMany relationships..There are properly annotated and also working correctly..Now problem is raising while i try to delete the associated objects..
Before deleting any object i nullify the reference of that object in all tables..i implement this using searchString of id in all objects..i feel it's better to search via intermediate table mainly in ManyToMany relationships...
i use objects as follows.. Left Object:
@ManyToMany(mappedBy = "leftManies") private Set<RightMany> rightManies = new HashSet<RightMany>();
RightObject: @ManyToMany @JoinTable(name = "LeftRight") private Set<LeftMany> leftManies = new HashSet<LeftMany>();
And in query i use... String hql = "select LeftRight"; Query query = session.createQuery(hql); in console the table is correctly creating in the name of LeftRight...but i unable to access that table.This query is not working..
Any idea to access intermediate table...?
Thanks in advance..
|
|