great thx for your posts, they are so useful for me,
you are right snau2005, oci driver is more faster then thin driver but not very
good for my issue,
ok thx for your code about stored procedures, i will try it, if i could not
fing any other way,
i don't want stoberd procedures and bech inserts becouse in this way i won't
have transaction management on my hand,
and at last i tried to use Thread on server side, i created 10 threads and each
of them tried to persist 1000 object into database, and i tried to flush after
50 records,
i wrote my thread class into server side and use it into stateless session
bean, and set entittymanager class into Thread class and into run method i
tryed to persist
| public class ThreadMy extends Thread {
| EntityManager entityManager;
| List<UsageObject> usagesObjs;
| public ThreadMy(EntityManager entityManager,
| List<UsageObject> usagesObjs) {
| this.usagesObjs = usagesObjs;
| this.entityManager = entityManager;
| this.setPriority(Thread.MAX_PRIORITY);
| this.start();
| }
|
| public void run() {
| try {
| int count = 0;
| for (int i = 0; i < usagesObjs.size(); i++) {
| UsageObject usageObject = usagesObjs.get(i);
| entityManager.persist(usageObject);
| if (i / 50 >= 0) {
| entityManager.flush();
| count = 0;
| }
| count++;
| }
|
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
and into my stateless sessionbean i have created 10 Threads
but i got an error like this
| 18:11:35,684 ERROR [STDERR] javax.persistence.TransactionRequiredException:
EntityManager must be access within a transaction
| 18:11:35,685 ERROR [STDERR] at
org.jboss.ejb3.entity.ManagedEntityManagerFactory.verifyInTx(ManagedEntityManagerFactory.java:149)
| 18:11:35,685 ERROR [STDERR] at
org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:174)
| 18:11:35,685 ERROR [STDERR] at
com.magti.client.test.ThreadMy.run(ThreadMy.java:81)
|
|
entityManager.persist(usageObject); // this is ThreadMy.java:81
how i can fix it ?
can anybody tell me ?
ok and another thing, thank you also for your post oskar.carlstedt
i am not an administrator of the network and systems into my company, i don't
know servers very well, am a programmer.
you thing it is more useful to use windows servers instead of solaris servers ?
i thik if operation system is well configured, i think solaris is enough for my
program and for this task.
it is not right way that i requst my company to bye this servers which you tell
me (Compac D180 or Dell Server) for my program,
and what you say about best insert performance, i 100 % agree with you,
i want good design and high performance together :) ;), maybe it is impossible,
but i want try all ways, after all maybe is use comma separated files and
stored procedures,
PS ..
of course i turn off auto commit into my java program,
Regards,
Paata.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039300#4039300
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039300
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user