-->
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.  [ 4 posts ] 
Author Message
 Post subject: Problem mit Insert Statement und Strings
PostPosted: Thu Oct 20, 2005 7:38 am 
Newbie

Joined: Thu Oct 13, 2005 10:25 am
Posts: 19
Location: Germany, Hamburg
Hibernate version: 3

Database: Postgresql, JDBC 3 Driver

Hallo, ich habe ein Problem mit einem erzeugten SQL Statement. Erzeugt wird:
insert into foo.bar (surname, name, sex, city, street, house_number, postcode, state, phone, mobile, fax, email, birthday, birthmonth, birthyear, salutation, foto1, foto2, foto3, regdate, id) values (Tester, Testy, m, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, test@test.com, 0, 0, 0, NULL, 0, 0, 0, NULL, 9)

Diese Statement kann natürlich nicht funktionieren, da die values für die String Felder nicht mit Anführungszeichen umschlossen sind. Sollte dies nicht aber der JDBC Treiber selebr regeln? Oder wie muss das gehandhabt werden?

Gruß,
Jan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 7:56 am 
Regular
Regular

Joined: Sat Sep 03, 2005 9:07 am
Posts: 87
Location: Graz, AUSTRIA
Wie generierst du das SQL-Statement?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 11:10 am 
Newbie

Joined: Thu Oct 13, 2005 10:25 am
Posts: 19
Location: Germany, Hamburg
Naja, das wird ja automatisch generiert.

Die ursprüngliche Methode ist:
public void save(Object obj) throws ORException {
Session session = openSession();
Transaction transaction = null;

try {
transaction = session.beginTransaction();

session.saveOrUpdate(obj);

transaction.commit();
} catch (HibernateException e) {
rollback(transaction);
convertToORException(ErrorCodes.QUERY_ERROR, e);
} finally {
closeSession(session);
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 11:16 am 
Newbie

Joined: Thu Oct 13, 2005 10:25 am
Posts: 19
Location: Germany, Hamburg
Ok, hat sich erledigt. Es lag an einem bestimmten Datentypen, den ich verwenden wollte.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.