• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Hibernate - Can't delete from database!

 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using the following code to delete a "Project" with the id of 10:



In the logs:


When I check the database, I find that it's still there!

Any one know what I'm doing wrong? Any help would be endlessly appreciated... Thank you.
-Daniel

Oh! By the way, I'm using Posgresql if that matters.
[ March 13, 2006: Message edited by: Daniel Prene ]
 
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You probably just forgot to commit the transaction...everyone does it the first time.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...or flushed/closed the Session.
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the suggustions, but it still isn't working. I'll give my new code and the complete hibernate log:

How I'm deleteing it:


How I'm closing:


The full log:


[ March 13, 2006: Message edited by: Daniel Prene ]

[editied to fix formatting - Paul Sturrock]
[ March 13, 2006: Message edited by: Paul Sturrock ]
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone have a clue about what's going on here? Do you need more information? Any help would be endlessly appreciated. Thank you.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You still haven't commited.

call the commit method.

Mark
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Who's commit method?
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Session doesn't have a commit method... can you please clarify? I'd really appreciate it...

Thank you.
 
Sheriff
Posts: 28365
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got this code from the examples at the beginning of the Hibernate reference documentation (section 2.2.6).
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
I got this code from the examples at the beginning of the Hibernate reference documentation (section 2.2.6).



Exactly.

Daniel, after you get your session object, get a Transaction, then do your deltee code, then call commit on the Transaction object.

Mark
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all the help! You people are the best! Javaranch's saloon truely is the best forum of all time.
 
I'm full of tinier men! And a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic