I want that if table not exist then it will create table and the insert can be done.
I have written the following code.
But is showing error
Here my problem is that these command is not working same time. I am first creating a table and then doing inserting and i have to change the xml file after creating the table. I want that customer will not have to worry that is there table exist or not.
Now my question that is there any way that i could will able to create table if there table not exist and able to do insert operation same time in same xml file.
Well, first of all you can only provide one value for the property "hibernate.hbm2ddl.auto". It is after all a property and properties can only have a single value. So probably whatever is processing that XML file of which you posted a fragment uses the last value it finds, namely "insert". As far as I can see this isn't even a valid value for the property, but my Hibernate experience is out of date; can you show us a document which suggests that you should use "insert"?
When I was using Hibernate I just used "create" for that property and Hibernate would create the tables and permit inserts right away. (There's little point in allowing somebody to create a table and then preventing them from inserting records into it, empty tables are pretty useless.)
Then if you are having your entity class with annotation @Table("tablename") and as per exception,
there is a possibility that you are using some fieldname which might be reserved keyword. Can you show your Entity?