Hi,
I fail to see the benefit of any of these "solutions".
I believe that the biggest determinant of the performance of insert
is doing all of the inserts in one transaction, and secondly,
batching the SQL by the persistence provider.
It would be interesting to compare the performance of using the
native SQL to do insert versus the em.persist(instance) operation.
There should be an insignificant performance difference. If there is
a big difference, there is a question for the persistence provider...
Craig
On Jul 17, 2006, at 6:08 PM, Wonseok Kim wrote:
> Hi, Dyego
>
> There is no INSERT in JPQL and there is no bulk INSERT in SQL as
> you know.
>
> Other way to insert new rows into database other than em.persist
> (entity) is native query like
>
> em.createNativeQuery("INSERT INTO table VALUES (...)").executeQuery();
>
> You need to execute native query repetitively to insert several rows.
>
> It would be better if there is some way like below, but
> unfortunately there is no such support in current JPA.
>
> Queries queries = em.createNativeQueries();
> queries.add("INSERT INTO table VALUES (xxx)");
> queries.add("INSERT INTO table VALUES (xxx)");
> ...
> queries.executeQueries();
>
> - Wonseok
>
> On 7/18/06, Dyego Souza Dantas Leal <dyego.leal_at_gmail.com> wrote:
> Hello guys of GlassFish
>
> The JPA Spec supports bulk operations like:
>
> UPDATE
> DELETE
>
>
> But... supports INSERT ? any example ?
>
>
> ps: i want to put 2.000 objets on database and need more speed on
> insert...
> any sugestions ?
>
> the em.save(obj) is too slow to put 2.000 objects in SAME TIME.
>
>
> Tnks in advance !
>
> --
>
>
>
> ----------------------------------------------------------------------
> ---
> ++ Dyego Souza Dantas Leal ++ Dep. Desenvolvimento
> ----------------------------------------------------------------------
> ---
> E S C R I B A I N F O R M A T I C A
> *** http://javacoffe.blogspot.com ***
> ----------------------------------------------------------------------
> ---
> The only stupid question is the unasked one (somewhere in Linux's
> HowTo)
> Linux registred user : #230601
> -- ICQ : 1647350
> $ look into "my eyes" Phone : +55 041 2106-1212
>
> look: cannot open my eyes Fax : +55 041
> 3296-6640
> ----------------------------------------------------------------------
> ---
> Reply: dyego_at_escriba.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>
Craig Russell
Architect, Sun Java Enterprise System
http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell_at_sun.com
P.S. A good JDO? O, Gasp!
- application/pkcs7-signature attachment: smime.p7s