This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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"
not sure what the problem is but did you try using this instead of openSession?
SCJP 1.4, SCWCD 1.5
Joined: May 11, 2011
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.
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.