-->
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.  [ 1 post ] 
Author Message
 Post subject: HELP: Stored Procedure: Simple "insert into table"
PostPosted: Thu Oct 11, 2007 3:56 pm 
Newbie

Joined: Thu Oct 11, 2007 3:33 pm
Posts: 1
Hello guys,

at first I have to say: I'm completly new in Hibernate, so please be patient :)

I'm using a Hibernate Session inside a EJB 3.0 Container. This Hibernate session is calling a procedure which simply insert some data into a table with following structure:


Code:
ID (primary key)
val1 (primary key)
val2 (primary key)
val 3
val 4



I'm calling the stored procedure out of my DAO like this:


Pseudo:
Code:
Session session = super.getSession();
String query = "call myProdcedure(String)";
session.createSQLquery(query);



My stored procedure is parsing the given String and trys to insert the values into the table.


Sample values:

Quote:
"200002","20061001281","Production-Storage-Customer","100"
"200002","20061001283","Dry-Expansion","100"
"200002","20061001283","Fined-Tube","46"
"200002","20061001283","Tube-Wall","10"
"200002","20061001283","Two-Phase","6"
"200002","20061001285","General-Block","100"
"200002","20061001285","Multi-Server","20




Now hibernate is throwing a exception like:


Quote:
"200002","20061001283","Dry-Expansion","100" duplicate entry for key1



The table is completly empty. I checked It several times.
The funny thing is, that Hibernate is accepting the first row without any problems.
It seems that hibernate is not recognizing that the 3 primary key belong together .


I tried to execute the procedure directly in my MySQL Query Browser with sucess. It's working fine and It's inserting the data just like I want.


I guess that I'm calling the procedure _not_ the right way. I've read someting about mapping the procedure in the net but It really confused me couze all examples was read-only functions and I'm JUST writing. I don't need a return-value either....


Hope anybody can help me.

I can post tomorrow morning more details like my mapping,DAO,procedure etc. but If anyone has any hint, I would be very thankfull.


Thank you _very much_ in advance

Your truly

MrDiplomaThesisPanic ;)

_________________
___________


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.