I had an interview yesterday – which I thought went quite well, except for 2 questions below (interview was around 30 minutes I think), which it seems were significant to the interviewer.
Disclaimer: I didn’t get the job – so there’s obviously some bias in what I have to say. If anything, just add these questions to your list of things to look out for when looking for a Java WebApp job. I did not have a full job description when I went in (it was not provided), all I knew was it involved Hibernate, and that they were a team following an Agile methodology.
The Questions of Doom were:
- What’s a Hibernate Session?
- In a WSDL, what’s the difference between port and binding?
Question 1, something I probably should’ve been able to give a quick answer for. I started with the Session being a non-threadsafe object, which allows you to do CRUD operations with entities. The interviewer brought up the relationship between a Session and a database connection, and this is where I fumbled – eventually saying that a session uses one connection. It’s tricky because a Hibernate Session performs many functions (the docs say so too – “The Session is also many other things”!! I wonder if that violates the SRP 😛 – though it’s probably more a logical Facade). When you learn it mostly on project where most things are set up when you get there, you tend to skip exact details, so reading about it formally: it’s a unit of work, it also maintains the persistence cache – a map of objects in the persistence context to ensure identity, it is a handle to load and store objects, it’s a list of SQL statements to be executed, and finally it obtains a connection from a connection pool. Many things eh. I knew all of this from experience, I just could not put it elegantly into words. I also obviously knew having too many sessions open at the same time could exhaust your connections!
I also now know that you can reconnect a session – but the API deprecates the no-param reconnect() method, and you have to supply a connection reconnect(Connection)… any ideas on what the use case for this generally is? Extended sessions? Hmm…
Question 2, now I have done a fair bit of Web Services work, debugged quite a few issues too – but I’ve generally been a downstream client, so we get WSDLs from the upstream services, run a tool like Axis over it, voila a nicer Java view of the whole thing, so I didn’t have to tweak or look at the WSDL much – hence my knowledge of WSDLs themselves is fairly informal – I do know it’s basically a contract/webservice interface document and defines types, messages, and operations. When I did have to mess with WSDLs – it had to do with the operations and I/O parameters – the actual messages being passed around. So this question took me under 10 minutes to find resources for and get a fairly clear idea about the difference – a portType is like a module of available functions, and their parameters. A binding links these operations (and defines message formats) to a transport (which is usually just SOAP over HTTP anyway!). While I appreciate that it shows a crucial concept that WSDL separates messages from the transport – it’s hardly something that takes days to understand, certainly not rocket science (actually talking about SOAP itself, it very well could be).
In this interview, if I were to apply meaning to the whole incident, I would be left feeling a bit discontented – but I won’t do that because I know my abilities better than that – I so uberly-rock *cough* :P. In the end I just did not meet their expectations, but it is their expectations, and that is all. As for me, I’ll prepare better for notions or concepts that I take for granted because I use them everyday – must be like a fish-in-the-water-not-knowing-about-the-water-syndrome (that’s a long syndrome name…).