-->
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: Simple insert HSQL doesn't work
PostPosted: Tue Jul 08, 2008 3:57 pm 
Beginner
Beginner

Joined: Fri Nov 11, 2005 4:35 pm
Posts: 23
Hi,

I try to simply insert a record with HSQL

INSERT INTO FieldLog (className, objectId, previousState, currentState, cuser) VALUES ('zz',5,'a','b','P')

I get an error like:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: VALUES near line 1

Thanks in advance,
Pieter


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 08, 2008 4:58 pm 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
First, you try to speak about HQL, not HSQL?, didn't you?

Second: your statement
Quote:
NSERT INTO FieldLog (className, objectId, previousState, currentState, cuser) VALUES ('zz',5,'a','b','P')

is NOT HQL, but SQL.

Third: I never did nor heard about inserting with the usage of HQL!

Advice: Read the docs (before trying some code)!

_________________
Carlo
-----------------------------------------------------------
please don't forget to rate if this post helped you


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 08, 2008 11:05 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Here's a little tutorial to help you out with Hibernate and HQL queries:


Understanding Hibernate Query Language HQL: A Simple and Easy Tutorial

Good luck!

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: Simple insert HSQL doesn't work
PostPosted: Sat May 09, 2009 4:53 am 
Newbie

Joined: Sat May 09, 2009 4:44 am
Posts: 2
OR session.createSQLQuery("insert into table () values ()")


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.