aspose file tools
The moose likes Object Relational Mapping and the fly likes How to Insert values through HQL Insert :-( Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "How to Insert values through HQL Insert :-(" Watch "How to Insert values through HQL Insert :-(" New topic
Author

How to Insert values through HQL Insert :-(

Vijay Bhaskar
Greenhorn

Joined: Apr 10, 2007
Posts: 6
HI Everybody,
Can any one of you help me,How to insert values in HQL Insert
Here i am providing sample code...and i am hard coding the values and insert the values in the table.Can anyone please change my code
so tht i can insert the values through HQL Insert(Provide the HQL in my code)




Thanks & Regards,
Bhaskar

[Edited to use code tags - Paul Sturrock ]
[ June 19, 2007: Message edited by: Paul Sturrock ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Why do you want to do this using HQL? What happens when you run the code you posted above?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Vijay Bhaskar
Greenhorn

Joined: Apr 10, 2007
Posts: 6
My task is to insert the data through HibernateQueryLanguage thats why i requested for you people to help me.Can you please do that for me
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

OK. Well the reason I ask why you want to do it in HQL, is because HQL only supports insert from another table, so:

would be how you do it.

Looking at your code above however there is no other table to select from.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 16622

Originally posted by Vijay Bhaskar:
My task is to insert the data through HibernateQueryLanguage thats why i requested for you people to help me.Can you please do that for me


Please keep it nice. If read in the tone I think it is read it is being a bit bossy and not nice.

It also sounds to me if you have a task like this then it isn't a job related task, because the original code would be the way to do it, using the save() or persist() method. It sounds like a classroom or job interview task, which we don't give answers away for those.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
 
subject: How to Insert values through HQL Insert :-(
 
Threads others viewed
HI I got the null pointer exception using session factory
Unable to delete
got NullpointerExceptiom form this code
Trouble in using joins in hibernate
NullPointerException at the SessionFactory create line.
MyEclipse, The Clear Choice