[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Fwd: null value ONCASCADE=PERSIST and XA Resources
|
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/