こんにちは私はpostgresql9.2でhibernateを使用してJavaプロジェクトを実行していますが、挿入しようとすると次のように表示されます。
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 – More featured pictures... Other areas of Wikipedia Community portal – Bulletin board, projects, resources and activities covering a wide range of Wikipedia areas. Help desk – Ask questions about using Wikipedia. Local embassy – For Wikipedia-related communication in languages other than English. Reference desk – Serving as virtual librarians, Wikipedia volunteers tackle your questions on a wide range of subjects. Site news – Announcements, updates, articles and press releases on Wikipedia and the Wikimedia Foundation. Village pump – For discussions about Wikipedia itself, including areas for technical issues and policies. Wikipedia''s sister projects Wikipedia is hosted by the Wikimedia Foundation, a non-profit organization that also hosts a range of other projects: Commons Free media repository MediaWiki Free software development Meta-Wiki Wikimedia project coordination Wikibooks Free textbooks and manuals Wikidata Free knowledge base Wikinews Free-content news Wikiquote Collection of quotations Wikisource Free-content library Wikispecies Directory of species Wikiversity Free learning materials and activities Wikivoyage Open travel guide Wiktionary Dictionary and thesaurus Wikipedia languages This Wikipedia is written in English. Started in 2001 (2001), it currently contains 4,148,874 articles. Many other Wikipedias are available; some of the largest are listed below. More than 750,000 articles: Deutsch · Español · Français · Italiano · Nederlands · 日本語 · Polski · Português · РуÑ?Ñ?кий More than 150,000 articles: العربية · Bahasa Indonesia · Bahasa Melayu · Català · ÄŒesky · Dansk · Esperanto · Ù?ارسی · í•œêµì–´ · Lietuvių · Magyar · Norsk (bokmÃ¥l)‎ · Română · SlovenÄ?ina · СрпÑ?ки / srpski · Suomi · Svenska · Tiếng Việt · Türkçe · УкраїнÑ?ька · ä¸æ–‡ More than 50,000 articles: БългарÑ?ки · Eesti · Ελληνικά · English (simple) · Euskara · Galego · עברית · Hrvatski · Norsk (nynorsk)‎ · SlovenÅ¡Ä?ina · Srpskohrvatski / Ñ?рпÑ?кохрватÑ?ки · தமிழà¯? · ไทย Complete list of Wikipedias Retrieved from "http://en.wikipedia.org/w/index.php?title=Main_Page&oldid=533561242" Hidden categories: Article Feedback Blacklist Navigation menu Personal tools Create account Log in Namespaces Main Page Talk Variants Views Read View source View history Actions Search Navigation Main page Contents Featured content Current events Random article Donate to Wikipedia Interaction Help About Wikipedia Community portal Recent changes Contact Wikipedia Toolbox What links here Related changes Upload file Special pages Permanent link Page information Cite this page Print/export Create a book Download as PDF Printable version Languages Simple English العربية Bahasa Indonesia Bahasa Melayu БългарÑ?ки Català Česky Dansk Deutsch Eesti Ελληνικά Español Esperanto Euskara Ù?ارسی Français Galego í•œêµì–´ עברית Hrvatski Italiano Lietuvių Magyar Nederlands 日本語 Norsk (bokmÃ¥l)‎ Norsk (nynorsk)‎ Polski Português Română РуÑ?Ñ?кий SlovenÄ?ina SlovenÅ¡Ä?ina СрпÑ?ки / srpski Srpskohrvatski / Ñ?рпÑ?кохрватÑ?ки Suomi Svenska ไทย Tiếng Việt Türkçe УкраїнÑ?ька ä¸æ–‡ This page was last modified on 17 January 2013 at 18:13. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. See Terms of Use for details. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization. Contact us Privacy policy About Wikipedia Disclaimers Mobile view', '7') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2619)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:405)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2752)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 8 more
私の設定ファイル hibernate.cfg.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:postgresql://localhost:5432/mir</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="connection.username">postgres</property>
<property name="connection.password">root</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="current_session_context_class">thread</property>
<property name="hibernate.show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<!-- mapping files -->
<mapping resource="DataBase/DocumentEntity.hbm.xml"/>
</session-factory>
</hibernate-configuration>
マッピングファイル DocumentEntity.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="main.java.DataBase.DocumentEntity" table="documententity">
<id name="id" column="id">
<generator class="native" />
</id>
<property name="address" type="string" not-null="true" unique="true" >
</property>
<property name="content" type="string">
<column name="page_content" sql-type="longtext"/>
</property>
</class>
</hibernate-mapping>
javaクラス DocumentEntity.java:
public class DocumentEntity
{
private long id;
String address;
String content;
public void setId(long id) {
this.id = id;
}
public long getId() {
return id;
}
public void setAddress(String address) {
this.address = address;
}
public String getAddress() {
return address;
}
public void setContent(String content) {
this.content = content;
}
public String getContent() {
return content;
}
コードを挿入:
public void insert(List<DocumentEntity> documentEntities)
{
Session session=util.HibernateUtil.getSessionFactory().openSession();
Transaction tx=session.beginTransaction();
for(DocumentEntity documentEntity:documentEntities){
session.save(documentEntity);
}
session.flush();
tx.commit();
session.close();
}
アップデート:
try {
...// your code
} catch (SQLGrammarException e) {
for (Throwable ex = e; ex != null; ex = e.getCause())
ex.printStackTrace();
}
この例外は、終了するまで表示されます
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 921 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 unlike the living golden club Orontium aquaticum pictured the extinct species Orontium mackii may not have needed wetlands to grow that Miran Pastourma has been serving Pastourma in Athens for over 90 years that the characters of Che r Cycle a 2009 Bengali drama included Che Guevara Aleida March Fidel Castro and Raul Castro that James Hogun a general in the Continental Army asked to be held as a POW after the Siege of Charleston in order to prevent the British from recruiting soldiers among the enlisted Patriot POWs that a Roman era temple in al Sanamayn originally dedicated to the pagan god Tyche in the 2nd century CE and later converted into a mosque is one of the best preserved edifices in Syria that the Star Trek Enterprise episode Affliction explains why Klingons look different in the original series compared to the movies and later series that the Viscount Vane s offer of a reward in the newspapers for information about his eloped wife was compared to a search for some favourite spaniel bitch 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 â More featured pictures.. Other areas of Wikipedia Community portal â Bulletin board projects resources and activities covering a wide range of Wikipedia areas Help desk â Ask questions about using Wikipedia Local embassy â For Wikipedia related communication in languages other than English Reference desk â Serving as virtual librarians Wikipedia volunteers tackle your questions on a wide range of subjects Site news â Announcements updates articles and press releases on Wikipedia and the Wikimedia Foundation Village pump â For discussions about Wikipedia itself including areas for technical issues and policies Wikipedia s sister projects Wikipedia is hosted by the Wikimedia Foundation a non profit organization that also hosts a range of other projects Commons Free media repository MediaWiki Free software development Meta Wiki Wikimedia project coordination Wikibooks Free textbooks and manuals Wikidata Free knowledge base Wikinews Free content news Wikiquote Collection of quotations Wikisource Free content library Wikispecies Directory of species Wikiversity Free learning materials and activities Wikivoyage Open travel guide Wiktionary Dictionary and thesaurus Wikipedia languages This Wikipedia is written in English Started in 2001 2001 it currently contains 4 148 921 articles Many other Wikipedias are available some of the largest are listed below More than 750 000 articles Deutsch  Espaà ol  Franà ais  Italiano  Nederlands  æ æœ èªž  Polski  Português Â Ð ÑƒÑ Ñ ÐºÐ Ð More than 150 000 articles Ø Ù Ø Ø Ø ÙŠØ Â Bahasa Indonesia  Bahasa Melayu  Català  Česky  Dansk  Esperanto Â Ù Ø Ø Ø ÛŒ Â í œêµ ì  LietuviÅ Â Magyar  Norsk bokmà l â Ž  Romà nă  SlovenÄ ina Â Ð Ñ Ð Ñ ÐºÐ srpski  Suomi  Svenska  TiẠng Viá t  Tà rkà e Â Ð ÐºÑ Ð Ñ Ð Ñ ÑŒÐºÐ Â ä æ More than 50 000 articles Ð ÑŠÐ Ð Ð Ñ Ñ ÐºÐ Â Eesti  ΠΠΠΠΠΠκΠ English simple  Euskara  Galego  ª  Hrvatski  Norsk nynorsk â Ž  SlovenÅ Ä ina  Srpskohrvatski Ñ Ñ Ð Ñ ÐºÐ Ñ Ñ Ð Ð Ñ Ñ ÐºÐ Â à à à à à  à à à Complete list of Wikipedias Retrieved from http en.wikipedia.org w index.php title Main Page oldid 533561242 Hidden categories Article Feedback Blacklist Navigation menu Personal tools Create account Log in Namespaces Main Page Talk Variants Views Read View source View history Actions Search Navigation Main page Contents Featured content Current events Random article Donate to Wikipedia Interaction Help About Wikipedia Community portal Recent changes Contact Wikipedia Toolbox What links here Related changes Upload file Special pages Permanent link Page information Cite this page Print export Create a book Download as PDF Printable version Languages Simple English Ø Ù Ø Ø Ø ÙŠØ Bahasa Indonesia Bahasa Melayu Ð ÑŠÐ Ð Ð Ñ Ñ ÐºÐ Català Česky Dansk Deutsch Eesti ΠΠΠΠΠΠκΠEspaà ol Esperanto Euskara Ù Ø Ø Ø ÛŒ Franà ais Galego í œêµ ì ª Hrvatski Italiano LietuviÅ Magyar Nederlands æ æœ èªž Norsk bokmà l â Ž Norsk nynorsk â Ž Polski Português Romà nă Ð ÑƒÑ Ñ ÐºÐ Ð SlovenÄ ina SlovenÅ Ä ina Ð Ñ Ð Ñ ÐºÐ srpski Srpskohrvatski Ñ Ñ Ð Ñ ÐºÐ Ñ Ñ Ð Ð Ñ Ñ ÐºÐ Suomi Svenska à à à TiẠng Viá t Tà rkà e Ð ÐºÑ Ð Ñ Ð Ñ ÑŒÐºÐ ä æ This page was last modified on 17 January 2013 at 18 13 Text is available under the Creative Commons Attribution ShareAlike License additional terms may apply See Terms of Use for details Wikipedia is a registered trademark of the Wikimedia Foundation Inc a non profit organization Contact us Privacy policy About Wikipedia Disclaimers Mobile view ', '18') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2619)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:405)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2752)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
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:32)
at crawler.WebCrawler.<init>(WebCrawler.java:52)
at crawler.WebCrawler.main(WebCrawler.java:65)