jsf - jpa bulk insert not inserting properly -


i developing jsf jpa project in problem bulk insert list size more 6000 means should insert more 6000 records in table inserts 215 records.

my code here

    factory = persistence.createentitymanagerfactory(persistence_unit_name);             entitymanager em = factory.createentitymanager();             try {                 em.gettransaction().begin();                 (int = 0; < sgmllist.size(); i++) {                     // getting object list using loop                     sgml sgml = sgmllist.get(i);                     em.persist(sgml);                  } em.gettransaction().commit();                 facescontext.getcurrentinstance().addmessage(null,                         new facesmessage("sgml imported successfully"));             } catch (exception ex) {              } {                 if (em != null) {                     em.close();                 }             } 

and persistence xml is

<?xml version="1.0" encoding="utf-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">     <persistence-unit name="cation" transaction-type="resource_local">         <class>com.cation.bean.users</class>         <class>com.cation.bean.batchinfo</class>         <class>com.cation.bean.sgml</class>         <properties>             <property name="javax.persistence.jdbc.url" value="jdbc:mysql://192.168.1.4:3306/cation"/>             <property name="javax.persistence.jdbc.user" value="rix"/>             <property name="javax.persistence.jdbc.password" value="rix123"/>             <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.driver"/>         </properties>     </persistence-unit> </persistence> 

i've tried code when persist object in list

if (i % 200 == 0) {                     em.flush();                     em.clear();                 } 

but same issue arises. can solve issue plz.

what error get? handling errors , ignoring them, remove catch error.


Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -