Good evening,
I started with Hibernate today and did tutorials for the most of the day :-).
But now I can't find a solution for my problem, so I hope you don't mind me asking here:
I have two Tables
Document(
DocumentID, DocumentName, UserID)
Version(
id, VersionID, DocumentID, uploadedAt, DocumentText)
The background behinds this is that a document can have several versions (it can be updated!)
So when I try to get all different Versions of one Document I'm doing this SQL Query: ""SELECT * FROM Version WHERE documentID = " + documentID"
How can I get the Ouput? If I just would like to have one Object from the Version-Table I'd do:
Code:
Version version = session.get(Version.class, documentID);
But it seems that I cant use this function for getting several Versions, that's why I tried it with several SQLQuries (mixed through, this is just one of my attempts):
Code:
List list = session.createSQLQuery("SELECT * FROM Version WHERE documentID = " + documentID).list();
Later I tried to cast it to the type "Version", but exception stopped me ;)
Can anyone of you help me? I'm in a bit of time trouble, so every help is very appreciated!
Thanks a lot!