Transactions Problem in JPA

Hi,
In Our Application i want to use Bean ManagedTransactions instead of ContainerManagedTransactions(I am using Oracle TopLink JPA ) . For this purpose there is two transaction types are available that are ResourceLocalTranactions and JTA Transactions .
Which one is advantageous when i use Bean Managed Transactions . What are the requirements for that .

Actually my requirement is to combined different methods in a one transaction . If any method in a transaction is failed it is required to rollback preceded methods .
For this purpose i write one getTransaction object method in my SessionBean (JPA).
I call that method in Backing bean with that i get UserTransaction object in the backing bean from session bean . After that i perform transaction operations like commit rollback begin operations in my backing bean (Combining different methods in one transaction) .
Plz give me a advice is it correct way to approach . For this i used Container Managed Transaction and JTA as transaction type .

Similar Messages

  • Transaction problems

    If anyone can help point me in the right direction of what I should be looking for in my configuration files for the following transaction problem. It looks like the delete is being committed one entity at a time instead of at the ened of the transaction.
    I'm using OC4J, eclipselink and Spring.
    I have two entities that I am trying to delete. They have a OneToOne relationship which in the underlying database (Oracle) has a deferred foreign key integrity constraint. I believe that this means that if the intities are delted in the same transaction everything should work, but if they are deleted in seperate transactions then the constraint should kick in and disallow the delete. I am using code similar to below to attempt to delete in one transaction. I am using Spring to inject an EntityManager and to control the transaction handling.
    @Transactional(readOnly=true)
    public class ProductServiceImpl implements ProductService{ 
      @PersistenceContext(type = PersistenceContextType.TRANSACTION)
      private EntityManager emp;
      @Transactional(readOnly=false, propagation=Propagation.REQUIRES_NEW)
      public void deleteProduct(Product prod){
          Object managedEntity = em.find(product.getClass(), prod.getId);
          em.remove(managedEntity);
    }Spring configuration xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
      <jee:jndi-lookup id="myEmf" jndi-name="persistence/JPA"/>
      <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
      <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="myEmf"/>
      </bean>
      <tx:annotation-driven transaction-manager="txManager"/>
      <bean id="ProductService" class="ProductServiceImpl"/>
    </beans>On calling the delete I get the following error message
    org.springframework.transaction.TransactionSystemException -
        Could not commit JPA transaction; nested exception is
        javax.persistence.RollbackException: Exception [EclipseLink-4002]
            (Eclipse Persistence Services - 1.0 (Build SNAPSHOT - 20080508)):
        org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
        java.sql.SQLException: ORA-02091: transaction rolled back ORA-02292:
        integrity constraint (RVEL_FK) violated - child record found Error Code: 2091 Call:
        DELETE FROM RVEL_REVENUE_ELEMENT WHERE (ID = ?) bind => [6594]
        Query: DeleteObjectQuery(RevenueElement@1eafdce)I have also tried doing all this programatically, using a jndi lookup as follows
    EntityManager em = null;
    try{
      Context ctxt = new InitialContext();
      emf = (EntityManagerFactory)ctxt.lookup("jpaTest/ServerJPA");
      em = emf.createEntityManager();
      EntityTransaction et = em.getTransaction();
      try{
        et.begin();
        em.remove(managedEntity);
        et.commit();
      } finally{
        if(et != null && et.isActive()){
          et.rollback();
    } catch(NamingException nme) {
    } finally{
      if(em != null && em.isOpen()){
        em.close();
    } When debugging the error is thrown on the line
    em.remove(managedEntity);before the transaction commit is called.

    Thanks for the reply.
    The managed entity being deleted in the call to the delete method has one to many relationship with one of the entities in the one to one relationship which then has a reference to the second entity. These references are annotated with cascade ALL.
    A --> B --> C. The error is referring to entity C and its relationship back to B. The error is being thrown before the transaction is being committed.
    After doing a bit more research I believe that it is caused by the lack of the following property in my persistence.xml.
    <property name="eclipselink.target-server" value="OC4J_10_1_3"/>But if I put this property in then I get the errorException creating EntityManagerFactory using PersistenceProvider class org.eclipse.persistence.jpa.PersistenceProvider for persistence unit ServerJPA.

  • A Major Transaction Problem!

    "A" is a record which has already been inserted into a table(TBL).
    "insert(Y)" is a method that inserts a given record -Y- into TBL.
    "foo(X)" is a method that takes a record as a parameter and queries it on a view(VIEW). This view is a
    huge select statement that selects from TBL.
    Here is the problem:
    insert(B);
    foo( A ); /* returns true */
    but
    insert(B); /* B does not exist in TBL */
    foo(B); /* returns false and catches an exception that "A" is not found! */
    insert(Y) method is a CMP EJB method but foo(X) uses JDBC to access DBMS.
    so what can cause this transaction problem?
    thanks in advance,
    -selcuk

    Hi,
    Maybe foo is running in a different transaction than insert?
    Some possible causes:
    -you are starting a new transaction for foo, either via the UserTransaction or via REQUIRES_NEW
    -you are using a regular JDBC driver for foo instead of an XADataSource.
    Did you try to set foo's transaction attribute to REQUIRED?
    Best,
    Guy
    http://www.atomikos.com

  • Problem deploying JPA project

    When deploying an ear containing a war with a persitence archive in its WEB-INF/lib, I get a deploy error. The error in the opmn log seems to indicate a problem with parsing some xml file, but I can't seem to find a problem with the persitence.xml. This seems to work correctly using the embedded version of OC4J included with Jdevelper but fails when deploying to a clustered App server instance on linux.
    The application server version is 10.1.3.1 which matches the version of Jdev I'm using.
    thanks in advance.
    The persistence archive contains a persistence.xml under its META-INF with these contents
    <?xml version="1.0" encoding="windows-1252" ?>
    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="Model" transaction-type="JTA">
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <jta-data-source>jdbc/web</jta-data-source>
    <properties>
    <property name="toplink.session-name" value="Model"/>
    <property name="toplink.logging.level" value="FINE"/>
    <property name="toplink.logging.timestamp" value="true"/>
    <property name="toplink.logging.session" value="true"/>
    <property name="toplink.logging.thread" value="true"/>
    <property name="toplink.logging.exceptions" value="true"/>
    <property name="toplink.target-database" value="Oracle"/>
    </properties>
    </persistence-unit>
    </persistence>
    Deploy Error
    Operation failed with error:
    [fcmanagement:FCManagement] - Exception creating EntityManagerFactory using PersistenceProvider class oracle.toplink.essentials.PersistenceProvider for persistence unit Model.
    In the opmn log I see this stack trace
    <Line 1, Column 1>: XML-20108: (Fatal Error) Start of root element expected.
    07/06/20 15:37:58 oracle.oc4j.admin.internal.DeployerException: [fcmanagement:FCManagement] - Exception creating EntityManagerFactory using PersistenceProvider class oracle.toplink.essentials.PersistenceProvider for persistence unit Model.
    07/06/20 15:37:58 at com.evermind.server.ejb.exception.DeploymentException.exceptionCreatingEntityManagerFactory(DeploymentException.java:130)
    07/06/20 15:37:58 at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.createContainerEntityManagerFactory(PersistenceUnitManagerImpl.java:197)
    07/06/20 15:37:58 at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.initializePersistenceUnit(PersistenceUnitManagerImpl.java:159)
    07/06/20 15:37:58 at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.initialize(PersistenceUnitManagerImpl.java:86)
    07/06/20 15:37:58 at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:733)
    07/06/20 15:37:58 at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:414)
    07/06/20 15:37:58 at com.evermind.server.Application.getHttpApplication(Application.java:545)
    07/06/20 15:37:58 at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1990)
    07/06/20 15:37:58 at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:1909)
    07/06/20 15:37:58 at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:1606)
    07/06/20 15:37:58 at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:238)
    07/06/20 15:37:58 at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:99)
    07/06/20 15:37:58 at oracle.oc4j.admin.internal.ApplicationDeployer.bindWebApp(ApplicationDeployer.java:547)
    07/06/20 15:37:58 at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:202)
    07/06/20 15:37:58 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    07/06/20 15:37:58 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    07/06/20 15:37:58 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    07/06/20 15:37:58 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    07/06/20 15:37:58 at java.lang.Thread.run(Thread.java:595)
    07/06/20 15:37:58 WARNING: DeployerRunnable.run [fcmanagement:FCManagement] - Exception creating EntityManagerFactory using PersistenceProvider class oracle.toplink.essentials.PersistenceProvider for persistence unit Model.oracle.oc4j.admin.internal.DeployerException: [fcmanagement:FCManagement] - Exception creating EntityManagerFactory using PersistenceProvider class oracle.toplink.essentials.PersistenceProvider for persistence unit Model.
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:126)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)

    I tried repackaging the ear. Instead of including the persistence archive in the web-inf/lib of the war, I created an EJB jar with the jpa project in it.
    The application.xml now deploys that as an ejb module along with the war.
    The deploy error is a little different now, it specifies a missing class, Missing class: oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.
    I'm assuming that this class is in the toplink-essentials.jar. Should the toplink-essential.jar be packaged in the ear?
    Again this is being deployed to a 10.1.3.1 Application server.
    thanks
    Joel
    Here is to full error message
    [inapp03.inapp03/fastconnecttst] 07/06/21 11:54:47 Notification ==>Operation failed with error:
    Missing class: oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
    Dependent class: com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl
    Loader: oc4j:10.1.3
    Code-Source: /usr01/app/oracle/product/10.1.3/OracleAS_1/j2ee/home/lib/oc4j-internal.jar
    Configuration: <code-source> in META-INF/boot.xml in /usr01/app/oracle/product/10.1.3/OracleAS_1/j2ee/home/oc4j.jar
    This load was initiated at fcmanagement.root:0.0.0 using the Class.forName() method.
    The missing class is not available from any code-source or loader in the system.
    [Summary] There are total 2 instances in the operation.
    [Summary] Operation failed on inapp04.inapp04/fastconnecttst
    [Summary] Operation failed on inapp03.inapp03/fastconnecttst
    [Summary] Operation on cluster FAILED since 2 instanced failed!
    Deploy error: Deploy error: Operation failed with error:
    Missing class: oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
    Dependent class: com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl
    Loader: oc4j:10.1.3
    Code-Source: /usr01/app/oracle/product/10.1.3/OracleAS_1/j2ee/home/lib/oc4j-internal.jar
    Configuration: <code-source> in META-INF/boot.xml in /usr01/app/oracle/product/10.1.3/OracleAS_1/j2ee/home/oc4j.jar
    This load was initiated at fcmanagement.root:0.0.0 using the Class.forName() method.
    The missing class is not available from any code-source or loader in the system.

  • Problem with JPA Implementations and SQL BIGINT in primary keys

    I have a general Question about the mapping of the SQL datatype BIGINT. I discovered, that there are some different behaviour depending on the JPA implementation. I tested with TopLink Essentials (working) and with Hibernate (not working).
    Here is the case:
    Table definition:
    /*==============================================================*/
    /* Table: CmdQueueIn */
    /*==============================================================*/
    create table MTRACKER.CmdQueueIn
    CmdQueueInId bigint not null global autoincrement,
    Type int,
    Cmd varchar(2048),
    CmdState int,
    MLUser bigint not null,
    ExecutionTime timestamp,
    FinishTime timestamp,
    ExecutionServer varchar(64),
    ScheduleString varchar(64),
    RetryCount int,
    ResultMessage varchar(256),
    RecordState int not null default 1,
    CDate timestamp not null default current timestamp,
    MDate timestamp not null default current timestamp,
    constraint PK_CMDQUEUEIN primary key (CmdQueueInId)
    The java class for this table has the following annotation for the primary key field:
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "CmdQueueInId", nullable = false)
    private BigInteger cmdQueueInId;
    When using hibernate 3.2.1 as JPA provider I get the following exception:
    avax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
    at $Proxy16.persist(Unknown Source)
    at com.trixpert.dao.CmdQueueInDAO.save(CmdQueueInDAO.java:46)
    at com.trixpert.test.dao.CmdQueueInDAOTest.testCreateNewCmd(CmdQueueInDAOTest.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at
    Caused by: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
    at org.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:59)
    at org.hibernate.id.IdentifierGeneratorFactory.getGeneratedIdentity(IdentifierGeneratorFactory.java:35)
    at org.hibernate.id.IdentityGenerator$BasicDelegate.getResult(IdentityGenerator.java:157)
    at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:57)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2108)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2588)
    at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
    at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
    at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
    at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
    at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
    at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
    at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
    at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
    at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
    at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
    ... 34 more
    This means, that their ID generator does not support java.math.BigInteger as datatype.
    But the code works if I take TopLink essentials as JPA Provider.
    Looking at the spec shows the following:
    In chapter 2.1.4 "If generated primary keys are used, only integral types will be portable." Integral datatypes are byte, short, int, long and char. This would mean, that the Hibernate implementation fits the spec but there seem to be a problem in general with BIGINT datatypes.
    I use a SYBASE database. There it is possible to declare a UNSIGNED BIGINT. The range of numbers is therefore 0 - 2^64 - 1. Since in Java a long is always signed it would mean its range is from -2^63 -1 to 2^63 -1. So a mapping of BIGINT to java.lang.long could result in an overflow.
    The interesting thing is, that I used NetBeans to reverse engineer an existing database schema. It generated for all Primary Keys of Type BIGINT automatically a java.math.BigInteger. But for other fields (not being keys) it mapped BIGINTs to java.lang.long.
    It looks like there are some problems with either the spec itself or the implementation of it. While TopLink seems to handle the problem correctly, Hibernate doesn't. But Hibernate seems to fulfill the spec.
    Is anybody familiar with the Spec reading this and can elaborate a little about this situation?
    Many thanks for your input and feedback.
    Tom

    Not sure if I clearly understand your issue, would be good if you can explain it a bit more clearly.
    "I select a value from LOV and this value don't refresh in the view"
    If you mean ViewObject, check if autoSubmit property is set to true.
    Amit

  • Stored procedure in a transaction problem

    hello to everybody
    I have an application under weblogic8.1 sp3.
    I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
    ORA-02089: COMMIT is not allowed in a subordinate session
    Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...

    giorgio giustiniani wrote:
    hello to everybody
    I have an application under weblogic8.1 sp3.
    I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
    ORA-02089: COMMIT is not allowed in a subordinate session
    Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...It sounds like you have transactional syntax embedded in your
    procedure. You can't do that and still include it in an XA
    transaction.
    Joe

  • How to prevent users from creating transactional problems?

    Dear Sirs...
    Using JDeveloper 10.1.2 and ADF UIX technology. If i created a web application that contains many pages. Assume the application contains pages A,B,C,D.
    The end user should access the pages A then B then C then D to get the transaction executed and commited correctly.
    the problem is:
    1- if a user navigates from A to B to C then he press the Back button to A then he commits the transaction, the data would be stored in correctly.
    2- if page C requires some preparations in page B (initalization of session variables) and the user enters page A then he changes the URL to C, then this would cause inproper execution of application and so the data would be stored incorrectly.
    so how can i prevent the user from pressing the back button of the browser (which i do not think is possible) or how can i prevent him from making any errors by inproper page navigation?
    thanks for any help in advance and best regards

    I really don't know if this is the correct way of doing it, but we prevent navigation directly to any page within our application if the HTTP Referer header is null. If it's null, we redirect to a page that says the user should use the navigation buttons provided and not enter the page via bookmarks, history, or direct navigation via a typed in URL.

  • Add a New Field to Selection Screen of VL10 Transactions problem

    Hello,
    i have tried to add a selection field in the VL10G. I have used the docu from Gaurav Jagya (Thanks to Gaurav) an followed the steps. Here you can find the docu: Link: [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e07c282f-e2b4-2c10-e4b3-a314fc17b6a1]
    In the Step 2 , Point 4 i declare the Select option ST_MTART and use it later in Step 5  in the form USEREXIT_SELECT_OPTIONS_TRANSF.
    Step 2.
    4. Write the declaration of new select-option inside include ZV50RSEL_MTART.
    DATA: V_MTART TYPE MARA-MTART.
    SELECT-OPTIONS: ST_MTART for V_MTART.
    Step 5. Transfer values from selection screen to range.
    For this step, again an access key is required to modify include V50R_USEREXIT_TRANSF.
    1. Open include V50R_USEREXIT_TRANSF in change mode. It will ask for an access key. Enter the same and proceed.
    2. Write following line of code inside form USEREXIT_SELECT_OPTIONS_TRANSF:
    CX_SELECT_OPTIONS-MTART = ST_MTART[].
    When i start the VL10G it works fine, but when i start another VL10* transaction i get a dump. Example VL10:
    Runtime Errors         SYNTAX_ERROR
    Date and Time          20.04.2010 13:54:00
    Short text
         Syntax error in program "RVV50R10C ".
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLV50R_PRE" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
         The following syntax error occurred in program "RVV50R10C " in include
          "V50R_USEREXIT_TRANSF " in
         line 18:
         "field "ST_MTART unknown. .."
    It dumped, because the form V50R_USEREXIT_TRANSF is used in EVERY VL10* transaction and the select-option is declared ONLY in my Z-include.
    Is the someone out there, who has solved the problem? Is the an error in the docu or am i wrong?
    Thanks!
    Andreas

    Has there been any further information on this issue in this or any other threads. I am encountering the same issue as identified by Andreas.
    Thanks,
    Brian

  • Transaction problem in ejb

    Hi
    I have a problem related to CMP entity beans.
    I am using Oracle 9i and weblogic 6.1
    Here is the description of the problem.
    The transaction attribute of all the beans is set to 'Required'.
    I have a PersonBean (CMP) in Person.jar mapping to Person table along with other
    beans.
    I have a MemberBean(CMP) in Member.jar file mapping to Member table along with
    many other beans.
    There is a one to many relation ship between person and member tables in Oracle
    9i database :
    Id in the person table is the P_Key and Person_Id in Member table is the related
    foreign key.
    No relationship was made between Person and Member beans as there were in two
    different jar files with different deployment descriptors.
    I have a stateless session bean PersonService bean.
    There is a method in PersonService bean called createPerson(String name);
    This method creates Person in the database using Person p = PersonHome.create(),
    long personId = p.getId()..returns the primary key of the person.
    PersonService calls createMember(long personId) now.
    which will try to create a Member record in the database using the personId.
    Now the Member bean fails to create and the transaction is rolled back with a
    foreign_key violation exception.
    because it cannot locate the Person EJB Primary key entry in the underlying table.
    But the EJB cache is still inserted properly with Person EJB (findByPrimaryKey
    works).
    I feel that Member bean is not able to participate in the same transaction of
    the Person bean inspite of keeping the transaction attribute to 'Required'.
    When I keep the transaction of Person bean to 'RequiresNew', then the transation
    of createPerson is getting committed and Member is starting a New transaction
    and it gets created.
    But I donot want like this.
    I want all the beans to be participating in the same transaction.
    According to Oracle / Weblogic documentation the default database isolation mode
    Read_Committed should allow participants in transaction to see uncommitted data
    while participants outside the transaction see only committed data. I have tried
    other dataabase isolation modes (such as Read_Uncommitted, "Serializable") these
    appear to either create other problems or not have an affect.
    Any solution to this problem is highly appreciated.
    Thanks
    Lavanya

    Previously our code was running on Weblogic where
    methodA() -> Transaction Attribute -> Supports
    methodB() -> Transaction Attribute -> Required
    But in JBOSS in order to run the same thing we have to do
    methodA() -> Transaction Attribute -> Required
    methodB() -> Transaction Attribute -> Required
    Any Pointers??

  • Transaction problem with jconn5.2

    jconn5.2 and iASsp2
    I am using Bean Managed Transaction in my application, start the first
    transaction is fine, but once the application going to start another
    transaction, errors occoured:
    "the transaction onwer is not in current thread".

    Hi,
    I've had the very same problem with RAD.
    Try to set the Transaction attribute to SUPPORTS. With SUPPORTS the EJB method will use the same transaction as the caller.
    package hu.bme.ett.raktar.facade;
    import hu.bme.ett.raktar.ejbs.Raktar;
    import hu.bme.ett.raktar.ejbs.controller.RaktarManager;
    import javax.ejb.Stateless;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    @Stateless
    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    public class RaktarListazas implements RaktarListazasLocal {
         RaktarManager rm = new RaktarManager();
         * Default constructor.
        public RaktarListazas() {
            // TODO Auto-generated constructor stub
        public Raktar getRaktar(long raktId) {
             return rm.findRaktarByRaktId(raktId);
        public void createRaktar(long raktId) {
             Raktar r = new Raktar();
             r.setRaktId(raktId);
             r.setRaktAzonosito("Y1RAK-01" + raktId);
             r.setMegnevezes("Elso raktaram");
             try {
                   rm.createRaktar(r);
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Cheers,
    Viktor

  • EJBQL query problem in JPA

    I am developing an Enterprise application that uses JPA and toplink as the persistence provider. It uses MYSQL 5.1.
    The query used in the Entity class is :
    @NamedQueries({@NamedQuery(name = "AirtravelsDynamic.findAllEconomyFlights", query = "select NEW com.inter.transfer.Response(rf.flightno,d.economyseats,rf.ecofare,rf.arrtime,rf.depttime) from AirtravelsDynamic d LEFT JOIN d.refId rf where rf.source=?1 and rf.destination=?2 and d.availdate between ?3 and ?4") })
    This application is giving the following exception:
    Exception Description: Error compiling the query [AirtravelsDynamic.findAllEconomyFlights: select NEW com.inter.transfer.Response(rf.flightno,d.economyseats,rf.ecofare,rf.arrtime,rf.depttime) from AirtravelsDynamic d LEFT JOIN d.refId rf where rf.source=?1 and rf.destination=?2 and d.availdate between ?3 and ?4], line 1, column 40: invalid navigation expression [rf.flightno], cannot navigate expression [rf] of type [int] inside a query.
    Local Exception Stack:
    Exception [TOPLINK-8029] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EJBQLException
    Exception Description: Error compiling the query [AirtravelsDynamic.findAllEconomyFlights: select NEW com.inter.transfer.Response(rf.flightno,d.economyseats,rf.ecofare,rf.arrtime,rf.depttime) from AirtravelsDynamic d LEFT JOIN d.refId rf where rf.source=?1 and rf.destination=?2 and d.availdate between ?3 and ?4], line 1, column 40: invalid navigation expression [rf.flightno], cannot navigate expression [rf] of type [int] inside a query.
    at oracle.toplink.essentials.exceptions.EJBQLException.invalidNavigation(EJBQLException.java:430)
    at oracle.toplink.essentials.internal.parsing.DotNode.checkNavigation(DotNode.java:141)
    at oracle.toplink.essentials.internal.parsing.DotNode.validate(DotNode.java:97)
    at oracle.toplink.essentials.internal.parsing.ConstructorNode.validate(ConstructorNode.java:97)
    at oracle.toplink.essentials.internal.parsing.SelectNode.validate(SelectNode.java:329)
    at oracle.toplink.essentials.internal.parsing.ParseTree.validate(ParseTree.java:229)
    at oracle.toplink.essentials.internal.parsing.ParseTree.validate(ParseTree.java:211)
    at oracle.toplink.essentials.internal.parsing.ParseTree.validate(ParseTree.java:201)
    at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateReadQueryInternal(EJBQLParseTree.java:134)
    at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateQuery(EJBQLParseTree.java:108)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:219)
    at oracle.toplink.essentials.queryframework.EJBQLPlaceHolderQuery.processEjbQLQuery(EJBQLPlaceHolderQuery.java:111)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.processEJBQLQueries(AbstractSession.java:2059)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.processEJBQLQueries(AbstractSession.java:2046)
    at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:724)
    at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:604)
    at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
    at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
    at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
    Any help is appreciated.
    Thanks in advance.

    What are you trying to do exactly? The way you've used LEFT JOIN is not correct if d.refId is an integer. LEFT JOIN is used to retrieve a set of entities where that set may not exist. It doesn't look like refId is a set of anything, just an integer.
    It looks like maybe you intended to have a foreign key relationship between AirtravelsDynamic and some other entity. In that case you probably want to model your AirtravelsDynamic entity as having a many-to-one relationship with the entity (let's call it ref.)
    The relationship would look something like:
    @Entity
    public class AirtravelsDynamic
       @ManyToOne
       @JoinColumn(name="refId")
       private Ref ref;
    }Then your query would read:
    SELECT new com.inter.transfer.Response(d.ref.flightno, d.economyseats,
                                           d.ref.ecofare, d.ref.arrtime,
                                           d.ref.depttime)
      FROM AirtravelsDynamic d
    WHERE d.ref.source = :refSource
       AND d.ref.destination = :refDest
       AND d.availDate between :lowDate and :highDateIf I'm misunderstanding your intent, let me know and I'll try to help you resolve the problem.

  • Problem with JPA @Embeddable class field in  @Embedded

    I have a Embeddable class and Embadded in all of my JPA Entities, the version(in DBUniqueId) field is mandatory for some JPA Entities and for others it should not be present.
    My DBUser.java JPA Entity shouldn't have version field(DBUser table doesn't have one) and so I didn't include it in @AttributeOverrides of DBUser.java. when I try to run the JPA query it results in exception
    Query:
    List<DBUser> userList = (List<DBUser>)entityManager.createQuery(SELECT u FROM DBUser u WHERE u.userId.root=?1 AND u.userId.extension=?2).setParameter(1,"root1").setParameter(2,"ext1").getResultList ();
    And The Exception is:
    ---- Begin backtrace for Nested Throwables
    java.sql.SQLException: ORA-00904: "T0"."VERSION": invalid identifier
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
    How do I inform to JPA Entity to ignore only the version field of the Embeddable in my JPA Entity @Embedded place.
    So the above query can successful. Thank You!
    Please guide me to solve this problem.
    @Embeddable
    @MappedSuperclass
    public class DBUniqueId implements Serializable {
    * serialVersionUID.
    private static final long serialVersionUID = 8903598739796209331L;
    * root.
    private String root;
    * extension.
    private String extension;
    * version.
    private String version;
         //Getters & Setters
    @Entity
    @Table(name = "MyTable", schema = "MySchema")
    public class DBUser implements Serializable {
    * unique user id.
    private DBUniqueId uniqueUserId;
    * Get the unique user id.
    * @return <code>DBUniqueId</code> - unique person id
    @Embedded
    @AttributeOverrides( {
    @AttributeOverride(name = "root", column = @Column(name = "LUSR02_ID_ROOT", nullable = true, length = 50)),
    @AttributeOverride(name = "extension", column = @Column(name = "LUSR02_ID_EXT", nullable = true, length = 50))
    public DBUniqueId getUserId () {
    return uniqueUserId;
    * set user unique id.
    * @param uniqueId - unique id of the person
    public void setUserId (final DBUniqueId uniqueId) {
    this.uniqueUserId = uniqueId;
    }

    Sudeep Naidu wrote:
    Hello gimbal2,
    Thanks for your response...
    In my project I have created a class with name DBVersionUniqueId but my lead said no to it.
    Only DBUniqueId should be used and make it work with or with out version fields.
    I tried experimenting around, but didn't succeed.
    Please Suggest some solution to make it work with DBUniqueId class.
    Thank You.No, let your lead write the code. He/she seems to be the expert. I certainly have no clue how to do it and honestly I also cannot find any reason why it should be possible. Let me put what is required in other words:
    - you have an entity with three properties, all of which are not transient. This means these properties map to three columns in the database according to the JPA specs.
    - you have a table with only two properties
    - you must and you shall use the object with three properties but at the same time one of the fields must all of a sudden be ignored by the persistence provider
    It makes no sense to want to do that.
    Correct answer: create a new object with only the two fields so the database and the object model match exactly
    Wrong answer: try to create workarounds that in six months time nobody is going to understand why the hell it was done that way

  • DB Transaction problem in 9.0.2i

    The problem is in Oracle 9iAS version 9.0.2.
    Windows 2000
    Oracle 8.1.7i R3 DB
    When I shutdown (manualy) the server in the midle of some DB transaction, some of data are commited in the database. Everything is OK when the my application throws some Exception in the midle of transactin, no data are commited in the DB (DB rollback the transaction).
    So, the server that is manualy stoped commit started transaction no matter that transaction is not finished yet.
    This problem consist in both EntityEjb updating and JDBC updating DB.
    Thanks in advance
    Dusan Petrovic

    9.0.2.0.1 is certified with XP Pro only (not Home edition), if you check on Metalink.

  • Global transaction problem with JDriver/Oracle and Oracle XA

    We are haveing serious problems with Container Managed Transactions on Bea 6.1
    and Oracle with EJB having set "Required" for all methods. We have tried in vain
    to make it work with JDriver as well as OracleXAClient. Both fail at sometime
    during the execution throwing "Not called in cotext of global transaction" (with
    JDriver) OR "XAER_PROTO : Routine was invoked in an
    inproper context start() failed on resource 'OracleXAPool'" (this one with oracle
    XA).
    1.) Weblogic JDriver-XA:
    DatabaseMetaData metaData = dataSource.getJDBCConnection.getMetaData();
    ResultSet resultSet = metaData.getTables(null, null, tableName.toUpperCase(),
    new String[]{"TABLE"});
    This fails immmediately saying that it was not called from global transaction.
    Interesting thing is that with OracleXA, it doesnt say this exception at this
    check point.
    2) Oracle XA
    Okie, we couldnot read through the CLOB using it so for reading CLOB, we used
    direct jdbc connection and then did away with it. Now all next sql queries were
    executed against oracle pool using XA data source with OracleXAClient. But at
    some point we again ran into the problem "XAER_PROTO : Routine was invoked in
    an
    inproper context start() failed on resource 'OracleXAPool'"
    3 Oracle Thin Driver
    everything always works with it.

    AFAIR this issue was resoved by moving tx opreations out from non-tx
    methods.
    Regards,
    Slava
    "Apurb Kumar" <[email protected]> wrote in message
    news:[email protected]...
    Jawad,
    It would be nice if you can post the full stack trace error message. Didyou try moving to
    the latest service pack (sp2) for WLS6.1.
    Thanks,
    Jawad Mahmood wrote:
    Yes we had correctly set TXDataSource and let it to point to the right
    connection
    pool each time and it worked well with oracle thin driver but not whenwe switched
    the pool to JDriver or OracleXAClient. Note that we could aways confirmthat pool
    was successfully created alongwith we could retrieve connection from itvia TXDatSource,
    things gave problem after we attempted to do what i had mentioned in mylast posting.
    >>
    Also with JBoss 2.4.4 things work pretty well. So couldnt be our codeproblem.
    "Slava Imeshev" <[email protected]> wrote:
    Jawad,
    Did you set up TxDataSource?
    Regards,
    Slava Imeshev
    "Jawad Mahmood" <[email protected]> wrote in message
    news:[email protected]...
    We are haveing serious problems with Container Managed Transactionson
    Bea 6.1
    and Oracle with EJB having set "Required" for all methods. We havetried
    in vain
    to make it work with JDriver as well as OracleXAClient. Both fail atsometime
    during the execution throwing "Not called in cotext of global
    transaction"
    (with
    JDriver) OR "XAER_PROTO : Routine was invoked in an
    inproper context start() failed on resource 'OracleXAPool'" (this onewith
    oracle
    XA).
    1.) Weblogic JDriver-XA:
    DatabaseMetaData _metaData =
    _dataSource.getJDBCConnection.getMetaData();
    ResultSet resultSet = metaData.getTables(null, null,tableName.toUpperCase(),
    new String[]{"TABLE"});
    This fails immmediately saying that it was not called from globaltransaction.
    Interesting thing is that with OracleXA, it doesnt say this exceptionat
    this
    check point.
    2) Oracle XA
    Okie, we couldnot read through the CLOB using it so for reading CLOB,we
    used
    direct jdbc connection and then did away with it. Now all next sqlqueries
    were
    executed against oracle pool using XA data source with
    OracleXAClient.
    But
    at
    some point we again ran into the problem "XAER_PROTO : Routine wasinvoked
    in
    an
    inproper context start() failed on resource 'OracleXAPool'"
    3 Oracle Thin Driver
    everything always works with it.
    Apurb Kumar

  • CNE5 transaction problem in Upgrade ECC5.0

    I have problem in the  transaction CNE5 . this transaction is working in 4.6b but its showing dump in ECC5.0. saying ABAP errror.we r upgrading from 4.6b to ECC5.o
    Can u plz help me
    Thanks

    its saying
    12.11.2005     07:30:41     bissap1     120     C     CREATE_OBJECT_CLASS_NOT_FOUND     CX_SY_CREATE_OBJECT_ERROR          CL_EXIT_MASTER================CP     1

Maybe you are looking for

  • Error on startup - where do we send these things??

    JniPortal for C:\Program Files\Oracle\JDeveloper 3.2\java1.2\jre\bin\OJVM\jvm.dll reported java.lang.NullPointerException java.lang.ExceptionInInitializerError: java.lang.NullPointerException void borland.jbuilder.wizard.treatastext.TreatAsTextWizard

  • How to restrict records in Infoset query

    Hi Friends,   I have created an Infoset & a query based on this infoset. I would like to restrict certain records being displayed, based on field value, say if field A = 'Blank' I do not want to see this record on the Bex report. Please let me know i

  • ORA-01591: lock held by in-doubt distributed transaction

    I am using oracle wcf adapter to connect to oracle to insert. I am getting the ORA-01591: lock held by in-doubt distributed transaction. Any ideas as to what could be the resolution. I have followed the below mentioned steps. but that's not a permane

  • ABAP Code for Key Figure selection in Report

    Hello Experts, I am working on one of the development request that requires following logic to be implemented at query execution. There will one KF column and based on valid combination of characteristics value from the cube, Key Figure value from th

  • Integration Component installation - Java JDK 5.0

    Hi Could someone point me exactly to the correct version of Java that needs to be installed on a Server 2008 (64 bit).  The one mention in the notes does not seem to be available now and I am not sure what to install as an alternative. Thanks Ian