-->
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: session.delete(string) not working as would seem natural...
PostPosted: Thu Nov 11, 2004 6:58 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 11:06 am
Posts: 21
Location: Denmark
Hibernate version:
2.1.6
Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:
MySQL 4
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Using

session.delete("from IdentificationImpl where search=?", search, Hibernate.entity(Search.class));

does not work.. in includes "search" instead of "Search_ID" (ie. property name instead of column name) in the generated SQL ("from Identification identifica0_ where (search=? )")

However, this works:

session.delete("from IdentificationImpl where Search_ID=?", search.getId(), Hibernate.INTEGER);

the search property on Identification is mapped as a many-to-one relationship over to the Search class..

As far as I can see, the first version should work too, since it's the natural way to write that code..

_________________
Hibernate rocks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 11, 2004 2:10 pm 
Newbie

Joined: Fri Aug 29, 2003 4:36 am
Posts: 16
Location: Belgium
hooverphonique,

try this query:

from IdentificationImpl as impl where impl.search=?

(when asking questions, it might be handy to provide mapping files and some actual code as the big red message says)

Bart.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 12, 2004 5:50 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 11:06 am
Posts: 21
Location: Denmark
Bart Sawyer wrote:
from IdentificationImpl as impl where impl.search=?


that actually made the difference, thx.. (no idea why i didnt think of that myself ;-)

_________________
Hibernate rocks!


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.