Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate - Can't delete from database!

 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • 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 ]
 
Vinnie Jenks
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably just forgot to commit the transaction...everyone does it the first time.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...or flushed/closed the Session.
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Who's commit method?
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session doesn't have a commit method... can you please clarify? I'd really appreciate it...

Thank you.
 
Paul Clapham
Sheriff
Posts: 21566
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic