Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 83033 invoked from network); 26 Mar 2007 22:11:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Mar 2007 22:11:45 -0000 Received: (qmail 15753 invoked by uid 500); 26 Mar 2007 22:11:52 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 15723 invoked by uid 500); 26 Mar 2007 22:11:52 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 15714 invoked by uid 99); 26 Mar 2007 22:11:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2007 15:11:51 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of ritikamster@gmail.com designates 64.233.182.191 as permitted sender) Received: from [64.233.182.191] (HELO nf-out-0910.google.com) (64.233.182.191) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2007 15:11:39 -0700 Received: by nf-out-0910.google.com with SMTP id d4so2950634nfe for ; Mon, 26 Mar 2007 15:11:17 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=IvVW2Hi7S//BytHiqOROi86AYYajAE1XKlpbJYCuFqMBaL0UdLY7DmOV9spDO6tqZFurJJ0cwk7Gcj8gCzDeSxjgtSWBK1VpEz+msCwoXQQmDRDi1cxRlIUSQydyoMHEib/+oMazblf26ZgH3TJwsJ1ZBAiKHYiqenLZmhhlfLs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=idcmNaZYQ1ulVCXUCucpd1sVNxotvJ6INnr7aN6lcLWMWLxH80FVG7lLgiuu1KKiMj2BOVbChCjWlhlOawVOD8ZNO3GAF9d6Tne/2bJWKCWwL6wtO3rMSe9X152mx0vtwbkkPZ/TU0pjB2IgO+fX7tlhW4rGTzuie4AIgriq5ZY= Received: by 10.78.178.5 with SMTP id a5mr3227025huf.1174947077263; Mon, 26 Mar 2007 15:11:17 -0700 (PDT) Received: by 10.78.58.4 with HTTP; Mon, 26 Mar 2007 15:11:17 -0700 (PDT) Message-ID: <7a5e6f6a0703261511m73c38171sfc81f8a2c53094df@mail.gmail.com> Date: Mon, 26 Mar 2007 15:11:17 -0700 From: "Ritika Maheshwari" To: open-jpa-dev@incubator.apache.org Subject: Re: [jira] Commented: (OPENJPA-172) DSRA9250E: Operation setTransactionIsolation is not allowed during a global transaction for Shareable Connections. In-Reply-To: <20823689.1174942292214.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_21505_20636579.1174947077203" References: <16116051.1173820869218.JavaMail.jira@brutus> <20823689.1174942292214.JavaMail.jira@brutus> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_21505_20636579.1174947077203 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Kevin, Yes it is JPA that is trying to set the isolation level.Thishappens when jpa is trying to get the next id from the sequence , at that point it tries to get the connection to database and it checks if the isolation level on the connection is READ_COMMITTED or not. And apparently the isolationLevel was not read committed therefore it tries to set it read-committed.I have specified the isolation level in my persistence.xml to read-committed.Following the code it appears taht AbstractJDBCSeq.next() finally calls *protected* RefCountConnection connectInternal() *throws* SQLException { *return* *new* RefCountConnection(_ds.getConnection()); } This is in JDBCStoreManager.The _ds.getConnection call will call *public* Connection decorate(Connection conn) *throws* SQLException { // some versions of the DB2 driver seem to default to // READ_UNCOMMITTED, which will prevent locking from working // (multiple SELECT ... FOR UPDATE statements are allowed on // the same instance); if we have not overridden the // transaction isolation in the configuration, default to // TRANSACTION_READ_COMMITTED conn = *super*.decorate(conn); *if* (conf.getTransactionIsolationConstant() == -1 && conn.getTransactionIsolation() < conn.*TRANSACTION_READ_COMMITTED*) conn.setTransactionIsolation(conn.*TRANSACTION_READ_COMMITTED*); *return* conn; } in DB2Dictionary and that is when it fails.This is what I suspect from looking at the code.It is tough to debug in zos websphere environment.But we have had previous issues where using zos type 2 driver in gloabal transaction we were getting errors that cannot setAutoCommit during gloabl transaction.So this has something to do with running in global transaction.Because I begin the transaction before I new up the entityManager. ritika On 3/26/07, Kevin Sutter (JIRA) wrote: > > > [ > https://issues.apache.org/jira/browse/OPENJPA-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12484226] > > Kevin Sutter commented on OPENJPA-172: > -------------------------------------- > > Ritika, > The message you referenced... > > <0|true|0.9.6-incubating> > org.apache.openjpa.persistence.PersistenceException: DSRA9250E: Operation > setTransactionIsolation is not allowed during a global transaction for > Shareable Connections. > > ... is coming from WebSphere. WebSphere supports the concept of shareable > connections (per the JCA specification). Since these connections might be > shared between applications, WebSphere doesn't want to surprise the user of > a Shareable connection by allowing modification of properties that could > affect the operation of that connection. In this case, somebody (OpenJPA?) > is attempting to change the TransactionIsolation attribute of a Shareable > connection while a global transaction is active. WebSphere prevents this as > a safety net for our users. So, it looks like you need to understand why > the transaction isolation is attempted to be set while the transaction is > active. Either we need to hold off on changing the transaction isolation > until the tran completes, or maybe the setting is superfluous (ie. the > isolation level is not changing, but the invocation is happening > regardless). > > Hope this helps. > Kevin > > > DSRA9250E: Operation setTransactionIsolation is not allowed during a > global transaction for Shareable Connections. > > > ------------------------------------------------------------------------------------------------------------------- > > > > Key: OPENJPA-172 > > URL: https://issues.apache.org/jira/browse/OPENJPA-172 > > Project: OpenJPA > > Issue Type: Bug > > Components: jpa > > Affects Versions: 0.9.6 > > Environment: Websphere 6.1 for zos and DB2 zos V8 > > Reporter: Ritika Maheshwari > > Fix For: 0.9.7 > > > > > > My persistence.xml looks like following > > > ******************************************************************************************************* > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > version="1.0"> > > > > org.apache.openjpa.persistence.PersistenceProviderImpl > > > jdbc/ErwwDS > > ejb.jpa.test.Customer > > ejb.jpa.test.District > > ejb.jpa.test.Warehouse > > ejb.jpa.test.History > > ejb.jpa.test.Item > > ejb.jpa.test.Neworders > > ejb.jpa.test.Orderline > > ejb.jpa.test.Orders > > ejb.jpa.test.Stock > > > > > > > > > > > > > > > > value="read-committed" /> > > > > > > > > > > > > > ******************************************************************************************************************* > > The Orderline entity looks like following > > > ************************************************************************************************* > > @Entity > > @IdClass(ejb.jpa.test.OrderlineId.class) > > @SequenceGenerator(name="mysequence",sequenceName="ORDER_ID") > > public class Orderline implements Serializable{ > > > > @Id > > @GeneratedValue(strategy=GenerationType.SEQUENCE > ,generator="mysequence") > > java.lang.Integer ol_o_id = null; > > @Id > > java.lang.String ol_d_id = null; > > @Id > > java.lang.String ol_w_id = null; > > @Id > > java.lang.Short ol_number = null; > > java.lang.String ol_i_id = null; > > java.sql.Timestamp ol_delivery_d = null; > > java.lang.String ol_supply_w_id = null; > > java.lang.Short ol_quantity = null; > > java.math.BigDecimal ol_amount = null; > > java.sql.Timestamp itime = null; > > java.lang.String ol_dist_info = null; > > @ManyToOne(fetch=FetchType.LAZY) > > @JoinColumns({ > > @JoinColumn(name="ol_o_id", referencedColumnName="o_id"), > > @JoinColumn(name="ol_d_id", referencedColumnName="o_d_id"), > > @JoinColumn(name="ol_w_id", referencedColumnName="o_w_id") > > }) > > Orders orders = null; > > @ManyToOne(fetch=FetchType.LAZY) > > @JoinColumns({ > > @JoinColumn(name="ol_i_id", > referencedColumnName="s_i_id"), > > @JoinColumn(name="ol_supply_w_id", > referencedColumnName="s_w_id") > > > > }) > > Stock stock = null; > > > ************************************************************************************************************************* > > Now if I run the following client > > UserTransaction ut = null; > > ClientEJB facade = null; > > EntityManager em = null; > > try { > > Hashtable parms = new Hashtable(); > > parms.put( Context.INITIAL_CONTEXT_FACTORY, > > "com.ibm.websphere.naming.WsnInitialContextFactory > "); > > InitialContext ctx = new InitialContext(parms); > > ut = (UserTransaction) ctx.lookup > ("java:comp/UserTransaction"); > ut.begin(); > > em = getFactory().createEntityManager (); > > > > try { > > OpenJPAEntityManager kem = OpenJPAPersistence.cast(em); > > kem.getFetchPlan().setReadLockMode( > LockModeType.WRITE); > > stock = (Stock)kem.find(Stock.class,stockKey); > > kem.getFetchPlan().setReadLockMode(null); > > > > } catch (Exception fe) {} > > try { > > > > Timestamp itime = new Timestamp( > System.currentTimeMillis()); > > Orderline orderLine = new Orderline (districtId, > warehouseId, > > new > Short((short)ol_number), itemId,null, itemSupplyWarehouseId,new > Short((short)itemQuantity), amount, itime, stockDistInfo); > > em.persist(orderLine); > > em.flush(); > > > *************************************************************************************************************** > > I get the the following stack trace, which appears to happen when we try > to get the next value from Sequence > > [3/12/07 13:59:06:496 PDT] 00000020 SystemErr R > 3073 TRACE [WebContainer : 0] openjpa.jdbc.SQL - 1348751460> executing prepstmnt 2134933312 SELECT t0.s_data, t0.s_dist_01, > t0.s_dist_02, t0.s_dist_03, t0.s_dist_04, t0.s_dist_05, t0.s_dist_06, > t0.s_dist_07, t0.s_dist_08, t0.s_dist_09, t0.s_dist_10, t0.s_order_cnt, > t0.s_quantity, t0.s_remote_cnt, t0.s_ytd FROM Stock t0 WHERE t0.s_i_id = ? > AND t0.s_w_id = ? WITH RS USE AND KEEP UPDATE LOCKS [params=(String) > 000111, (String) 0001] > > [3/12/07 13:59:06:498 PDT] 00000020 SystemErr R > 3075 TRACE [WebContainer : 0] openjpa.jdbc.SQL - 1348751460> [2 ms] spent > > [3/12/07 13:59:06:720 PDT] 00000020 SystemErr R > javax.ejb.EJBException: ClientEJB: CreateException: OrderLineLocalHome > create failed in placeNewOrder() of ClientEJB; nested exception is: > <0|true|0.9.6-incubating> > org.apache.openjpa.persistence.PersistenceException: DSRA9250E: Operation > setTransactionIsolation is not allowed during a global transaction for > Shareable Connections. > > <0|true|0.9.6-incubating> > org.apache.openjpa.persistence.PersistenceException: DSRA9250E: Operation > setTransactionIsolation is not allowed during a global transaction for > Shareable Connections. > > at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException( > DBDictionary.java:3764) > > at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore( > SQLExceptions.java:94) > > at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore( > SQLExceptions.java:80) > > at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore( > SQLExceptions.java:56) > > at org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next( > AbstractJDBCSeq.java:59) > > at org.apache.openjpa.util.ImplHelper.generateValue(ImplHelper.java > :159) > > at org.apache.openjpa.util.ImplHelper.generateFieldValue( > ImplHelper.java:143) > > at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignField( > JDBCStoreManager.java:554) > > at org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java > :435) > > at org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java > :420) > > at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId( > JDBCStoreManager.java:538) > > at org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId( > DelegatingStoreManager.java:131) > > at org.apache.openjpa.kernel.StateManagerImpl.assignObjectId( > StateManagerImpl.java:471) > > at org.apache.openjpa.kernel.StateManagerImpl.preFlush( > StateManagerImpl.java:2662) > > at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:36) > > at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush( > StateManagerImpl.java:845) > > at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1865) > > at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1825) > > at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1609) > > at org.apache.openjpa.kernel.DelegatingBroker.flush( > DelegatingBroker.java:959) > > at org.apache.openjpa.persistence.EntityManagerImpl.flush( > EntityManagerImpl.java:438) > > at helpers.ClientEJB.placeNewOrder(Unknown Source) > > at erww.web.ErwwController.performServicesForNewOrder( > ErwwController.java:550) > > at erww.web.ErwwController.performTask(ErwwController.java:272) > > at erww.web.ErwwController.doGet(ErwwController.java:85) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) > > at com.ibm.ws.webcontainer.servlet.ServletWrapper.service( > ServletWrapper.java:966) > > > > Any idea why is this happening is this a bug.It appears like that while > trying to get the next value from Sequence JPA tries to get a connection and > then on the connection if the isolationLevel is not already READ_COMMITTED > it tries to set it to READ_COMMITTED and that is where it blows out > > ritika > > -- > This message is automatically generated by JIRA. > - > You can reply to this email to add a comment to the issue online. > > ------=_Part_21505_20636579.1174947077203--