postgresql hibernate Exception on insert

General Tech Learning Aids/Tools 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

Hi I'm running a java project using hibernate with postgresql 9.2, when i try to insert it will display:

Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:179)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at main.java.DataBase.Crawler_DataBase.insert(Crawler_DataBase.java:34)
at crawler.WebCrawler.<init>(WebCrawler.java:52)
at crawler.WebCrawler.main(WebCrawler.java:64)
Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into documententity (address, page_content, id) values ('http://en.wikipedia.org/wiki/Main_Page', 'Wikipedia, the free encyclopedia Main Page From Wikipedia, the free encyclopedia Jump to: navigation, search Welcome to Wikipedia, the free encyclopedia that anyone can edit. 4,148,874 articles in English Arts Biography Geography History Mathematics Science Society Technology All portals From today''s featured article Typhoon Rusa, the 10th typhoon of the 2002 Pacific typhoon season, was the most powerful to strike South Korea in 43 years. It developed on August 22 from the monsoon trough in the northwestern Pacific Ocean, then moved to the northwest, intensifying into a powerful typhoon. On August 26, the storm moved across the Amami Islands of Japan, causing two fatalities. Across Japan, the typhoon dropped torrential rainfall peaking at 902 mm (35.5 in) in Tokushima Prefecture. After weakening slightly, Rusa made landfall on Goheung, South Korea with winds of 140 km/h (85 mph). It weakened while moving through the country, dropping heavy rainfall that peaked at 897.5 mm (35.33 in) in Gangneung. A 24 hour total of 880 mm (35 in) in the city broke the record for the highest daily precipitation in the country. Over 17,000 houses were damaged, and large areas of crop fields were flooded. In South Korea, Rusa killed at least 233 people. The typhoon also dropped heavy rainfall in neighboring North Korea, leaving 26,000 people homeless and killing three. Rusa also destroyed large areas of crops in the country already affected by ongoing famine conditions. (Full article...) Recently featured: 1968 Thule Air Base B-52 crash â€“ First inauguration of Barack Obama â€“ U2 3D Archive – By email – More featured articles... Did you know... From Wikipedia''s newest content: ... that Bobbi Sue Luther (pictured) claimed that her costume in the Star Trek: Enterprise episode "Borderland" was skimpier than her normal outfits as a lingerie and bikini model? ... that volcanologist Harry Glicken was saved from the 1980 eruption of Mount St. Helens due to a scheduling conflict, only to die in the eruption of Mount Unzen in 1991? ... that Mosconi was the first Italian restaurant in the Benelux nations to receive a Michelin star? ... that though Balasaraswati was called "a revolutionary Bharata Natyam dancer", she was only filmed at the age of 58 in Bala, a documentary made by Satyajit Ray? ... that Harry Redford, the cattle duffer and drover upon whom the character Captain Starlight was based, drove the first mob of cattle to and later managed Brunette Downs Station? ... that the Russian ship of the line Gangut was credited with sinking two Ottoman frigates, a fire ship, and destroying a shore battery during the Battle of Navarino in 1827? ... that although the cream-spot ladybird is sometimes called the "eighteen-spot ladybird", the species name indicates it has fourteen spots? Archive – Start a new article – Nominate an article In the news After hundreds of workers are taken hostage in an attack at a gas facility near In Aménas, Algeria, a raid by Algerian forces results in dozens of fatalities. Boeing 787 aircraft (pictured) are grounded worldwide over concerns about the safety of their lithium-ion batteries. Sri Lankan Chief Justice Shirani Bandaranayake is dismissed by President Mahinda Rajapaksa following her contested impeachment. In the Central African Republic, the government signs a ceasefire agreement with rebels, ending a month of conflict and establishing a new coalition government. France commits troops to aid government forces in the current Northern Mali conflict. Sakine Cansız, one of the co-founders of the Kurdistan Workers'' Party, and two other Kurdish activists are shot dead in Paris. Recent deaths: TaihÅ? KÅ?ki – Stan Musial – Pauline Phillips Syrian civil war – Wikinews â€“ More current events... On this day... January 22: Reunion Day in Ukraine (1919) 1879 – Anglo-Zulu War: Zulu forces of King Cetshwayo (pictured) fought to a decisive victory at the Battle of Isandlwana. 1957 – New York City police arrested George Metesky, better known as the "Mad Bomber", for planting over 30 bombs over 16 years throughout the city. 1971 – The Singapore Declaration, one of the two most important documents to the uncodified constitution of the Commonwealth of Nations, was issued. 1984 – Apple Computer introduced the Macintosh computer during Super Bowl XVIII with its groundbreaking "1984" television commercial. 2006 – Aymaran Evo Morales was inaugurated as President of Bolivia, the country''s first democratically elected, fully Amerindian leader. More anniversaries: January 21 – January 22 – January 23 Archive – By email – List of historical anniversaries It is now January 22, 2013 (UTC) – Refresh this page Today''s featured picture The comma butterfly (Polygonia c-album) is found in temperate areas of Europe and Asia and is named after a white ''C'' shape on the underside of the wings resembling a comma. The wings have a distinctive ragged edge, apparently a cryptic form as the butterfly resembles a fallen leaf. Photo: Quartl Recently featured: Tawny Frogmouth – U.S. federal government in 1862 – St. Michael''s Cathedral, Izhevsk, Russia Archive &acirc
profilepic.png
manpreet 2 years ago

the stack trace says, "I've got a SQLGrammarException. it's caused by a BatchUpdateException, and this one is caused by ...". you should dig out the inner Exception, and finding out the problem would be much easier. here is my suggestion:

try {
    ...// your code
} catch (SQLGrammarException e) {
    for (Throwable ex = e; ex != null; ex = e.getCause())
        ex.printStackTrace();
}

this would print much more stack trace. paste the full stack trace here, that would help.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.