| Author |
Problem with hibernate
|
Tobias Tangfelt
Greenhorn
Joined: May 11, 2011
Posts: 9
|
|
I am new to hibernate and I am trying to to make inserts with storere procedures on my MySQL database. I have no problem to get information from it, the problem become when I am trying to insert data to it.
Here is my code in the hbm.xml file (It is only the part where I am trying to implement my store procedure that are going to insert values in database):
Here is a part of the Java code:
The store procedure is working fine.
I got following error message when I am trying to execute:
"Exception in thread "AWT-EventQueue-0" org.hibernate.TransactionException: Transaction not successfully started"
Does anyone have any suggestion?
|
 |
vani venkat
Ranch Hand
Joined: Nov 21, 2006
Posts: 142
|
|
hi,
not sure what the problem is but did you try using this instead of openSession?
|
SCJP 1.4, SCWCD 1.5
|
 |
Tobias Tangfelt
Greenhorn
Joined: May 11, 2011
Posts: 9
|
|
I actually solved my problem with INSERT.
But I have problem with UPDATE and INSERT.
This is my hbm.xml file:
This is my delete method:
This is my update method:
All the stored procedure is working, and I have try the exact sam thing without the stored procedure and it´s working. And my INSERT operation also working.
But when I can´t get it to work, and I have no idea why.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
I have to ask: why are you using stored procedures and Hibernate together? Do the stored procedures do something Hibernate can't?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2343
|
|
|
... and do you commit inside your stored procedure?
|
OCUP UML fundamental
ITIL foundation
|
 |
Tobias Tangfelt
Greenhorn
Joined: May 11, 2011
Posts: 9
|
|
I use stored procedure because I am reading a course there we now got a task where we are trying to use stored procedure in Hibernate.
I haven´t done commit in my store procedure but i have it in my Java code.
|
 |
 |
|
|
subject: Problem with hibernate
|
|
|