-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: delete without knowing the types of args
PostPosted: Thu Feb 19, 2004 1:49 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 8:33 am
Posts: 29
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").


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 1:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
1) No.

2) The internal interfaces in Hibernate represent "roles". Their purpose is to control and document dependencies, not necessarily to achieve polymorphism. In the case of SessionImplementor, it is also to allow for the possibility that the structure of the impl package may change, without requiring a change to the Type interface.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 2:03 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 8:33 am
Posts: 29
> 1) No.

Damn...

> 2) The internal interfaces in Hibernate represent "roles".

Could you point out some docs on this subjects?
Thanks for the super-fast answer!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.