Reputation: 6181
Sorry if this is very basic as a question....but I can't my head around the HQL syntax from the examples I have seen....
I have parent class ('File') which has a one-to-many relationship with a child class ('segment').
I have an instance loaded of the 'File' Parent class : I have a secondary key ('segment_number') ready - I just want to fetch single 'Segment' instance from the DB. (I don't want hibernate to fetch the whole Set of child Segments back, as this class contains a CLOB field.
What is the HQL for this ?
Upvotes: 0
Views: 750
Reputation: 120198
something like
String hql = "from Segment where segment_number = :segment_number and file = :file";
Query query = session.createQuery(hql).
setParameter('segment_number', segment_number).
setParameter('file', file, File.class);
List result = query.list()
Upvotes: 2