-->
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.  [ 2 posts ] 
Author Message
 Post subject: Executing self-defined SQL query for inserting data
PostPosted: Tue Aug 16, 2005 8:16 am 
Newbie

Joined: Mon Aug 15, 2005 8:03 am
Posts: 14
Location: Germany
Hi,

how can I execute a self-defined SQL/HQL query for inserting data into tables.

The classes HibernateTemplate and Session privides methods for retrieving and saving objects.

Saving objects inserts data into the table defined in htm file. I want to have a "conditional insert". It means, depends on the value of an attribute I wanna write object in table T1 or T2.

Is it possible? I couldn't find any way to execute self-defined SQL/HQL.

Thanks in advance,
Reza


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 10:41 am 
Newbie

Joined: Sun Aug 14, 2005 2:43 pm
Posts: 2
Location: Tyrol, Austria
Hmm aren't you supposed to post in German in this forum? :-)

Anyway...

One possibility would be the following
Code:
Connection c = session.connection() // get JDBC Connection
Statement st = c.createStatement();
st.execute("INSERT ....");


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

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.