[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[eclipselink-users] Fwd: null value ONCASCADE=PERSIST and XA Resources
|
- From: John Arevalo <johnarevalo@xxxxxxxxx>
- Date: Thu, 13 Aug 2009 13:49:29 -0500
- Delivered-to: eclipselink-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=NQBekw4WEj1gzJdFmitMYgj4ftixi3k3P8hjRsdoZbQ=; b=wojHJundgqdyuMEeEOCTAENqac03oaj7Unc0hTrRZkHR5jMxg9Z2TW0kcF6guVL3hM obJ21odrLJ9juPFdRjHWD3yeV7CF4cjIu7z9ulwA4uYgJqJTsGqhgTYe6VVFFWFyn3nj B+EnL4JBQ6YOVycXRD63pS6txxGqbIiHias+s=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=D2JGV3nZekJLOh0dsRtU03r9JfwI+PmCxmISPBHdn/wPaCgh49afeIadjCSrkzKB3Y Pazu5ai3rTROi4kVzOjo6MWvhNSwHOV7P3lNczCrza8gRkr+H+bSPUwJ/RNaQvOjgjKh QkI0S8WenM597YYj8nYYCAyMkiv8oEBsDkGEE=
Hi list, I'm facing 2 problems with JPA
1) I have an OneToMany relationship between Invoice and ProductItem,
when i try to create a new invoice:
Invoice invoice = new Invoice();
ArrayList<ProductItem> items = new ArrayList<ProductItem>();
for(/*any iteration*/) {
item = new ProductItem();
item.setQuantity(myQuantity);
items.add(item);
}
invoice.setProductItems(items);
invoiceFacade.create(invoice);
throws an SQLException because native query is: INSERT INTO
PRODUCT_ITEM(QUANTITY, INVOICE_ID) VALUES(3, null);
should i persist invoice before add items to it? in that piece of code
i can manage transaction in create(Invoice) method...persisting
invoice object first, I have to manage Transaction outside of EJB
method, or create another one.
2) another Exception is thrown in several "INSERT" actions. I have
Oracle PersistenceContext and DB2 PersistenceContext in EJB module,
message is:
Local transaction already has 1non-XA Resource: cannot add more resources.
reading this post [1], looks like i need XADatasource when i use
different pool resources. Really i don't have to persist objects from
DB2, so i don't need distribuited transactions, can i disable XA?
[1]http://www.theserverside.com/discussions/thread.tss?thread_id=21385#95346
Thanks for your replies,
Best regards.
--
John Arévalo
GNU/Linux User #443701
http://counter.li.org/