I would need something like Query.setParameter(int position, Object val)
for a Session.delete, but I can't find any method that "guesses the Hibernate type from the class of the given object" for the delete().
So I took a look at the code, and turned out that AbstractQueryImpl uses a SessionImplementor class, which has a lot of useful methods (for example you can call session.getFactory().getPersister(clazz)).
1) Is there a way to call session.delete if I don't know the Types of my args (without cast the session to the SessionImplementor class and use
its methods) ?
2) It seems to me that each "implementation" of interfaces of Hibernate is
coupled to a specific implementation of another one (example: AbstractQueryImpl uses a SessionImplementor class).
In this way, if you write another SessionImplementor class you won't be
able to use it in your AbstractQueryImpl .
What are interfaces good for if you don't use it?
(please don't take the second question as an accusation. I'm not a "great" programmer and I'm not fluent in English, so I couldn't find more
appriopriate words, but the meaning is not "you don't know how to program", the actual meaning is "please could you explain to me the logic").
|