You're not getting back a Module from that method call. If you look at the JavaDoc APIs you'll notice that session.createQuery( String query ) returns a Query Object (I'm surprised you're not getting a ClassCastException). If you look at the Query JavaDoc you can use a few things to get a result:
.list() will return the results in a list (or an empty list if no results found)
.uniqueResult() will return a single instance (or a exception if more than one is found or null if none is found)
.iterate() will return the results as an iterator
For example:
Code:
Module module = (Module)session.createQuery("from Module mod where mod.moduleID = 1").uniqueResult();
Hope this helps,
B
____________________________________
Please rate me if you found my post useful.