Rollback when SQLException is thrown

Hi all,
If the set autocommit is false and if any statement throws SQLException then what will happen to that transaction. Will it rollback the entire transaction ?. Before returning the connection to pool do I have to set autocommit to true ? By default autocommit is true.
rgds
Antony Paul

An SQLException will not rollback your transaction. You don't have to set autocommit to true before returning the connection, but it's generally a good idea to do it. What you have to do (and you'll have to use a finally block to make sure that it happens) is to either commit or rollback the transaction.
Alin.

Similar Messages

  • PreparedStatement wrapper behavior when SQLException is thrown

    Environment:
    weblogic8.1 sp3
    IBM db2 (universal) type 4 driver
    StatementCacheSize=0
    Use case:
    The code uses a PreparedStatement to insert let's say 60000 rows in a loop.
    The method used is executeUpdate() inside the loop. Some insertion
    attempts let's say 20000 are throwing duplicate primary key exception,
    which is fine. When such exception occurs it is skipped and the code
    continues with the next iteration inside the loop.
    Problem:
    Only one PreparedStatement is used in the code. Apparently the weblogic
    wrapper around the PreparedStatement is using a new wrapped
    PreparedStatement every time that a SQLException (in our case duplicate
    primary key) occurs when calling executeUpdate(). The result is that
    after ~7000 iterations in the loop (it's depend how much resources the
    database was allocated for the current session) the database throws another
    SQLException saying that there are no more memory resources for this
    session.
    Consequence:
    Memory consumption is extremely high – the loop cannot finish.
    I am guessing here: Every iteration in the loop that throws a SQLException
    causes the wrapper to use a new PreparedStatement which means execution
    of connection.prepareStatement() again – unnecessary roundtrip to the
    database.
    Note:
    The code was tested inside the weblogic container with different
    database MySQL - same behavior.
    The code work without any problems outside of the weblogic container and
    it uses only one object of type PreparedStatement.
    Thanks,
    Assen

    Assen Sotirov wrote:
    The code executes inside a POJO. Thus we can execute it as a standalone application or in EJB Session with CMP. There are only two differences:
    1) how a Connection is obtained - directly using the JDBC driver (standalone) or getting it from a DataSource (inside weblogic)
    2) how commit/rollback is done - directly using the Connection (standalone) or declare it in xml descriptor (inside weblogic)
    Connection pool definition:
    <JDBCConnectionPool
    Name="upsnd3db"
    DriverName="com.ibm.db2.jcc.DB2Driver"
    MaxCapacity="4"
    Password="{3DES}+BLABLABLABLABLA=="
    Properties="user=BLABLA"
    StatementCacheSize="0"
    StatementCacheType="LRU"
    Targets="pcs"
    URL="jdbc:db2://BLABLABLABLABLA:BLA/BLA"/>
    Turning the jdbc loggin on produces (IBM driver has rather verbose output, so I will truncate it):
    [Connection@b0c5a] prepareStatement (insert into ...) called
    [Connection@b0c5a] prepareStatement () returned PreparedStatement@b9979b
    [PreparedStatement@b9979b] setString (1, 00037NHD1 ) called
    [PreparedStatement@b9979b] setDate (2, 2005-09-01) called
    [PreparedStatement@b9979b] setTimestamp (9, 2005-09-15 15:26:12.093) called
    [PreparedStatement@b9979b] executeUpdate () called
    com.ibm.db2.jcc.c.SqlException
    ....at com.ibm.db2.jcc.c.cl.d(cl.java:1039)
    ....at com.ibm.db2.jcc.c.cm.executeUpdate(cm.java:311)
    ....at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:115)
    BEGIN TRACE_DIAGNOSTICS
    com.ibm.db2.jcc.c.SqlException:
    DB2 SQL error:
    SQLCODE: -803,
    SQLSTATE: 23505,
    [Connection@b0c5a] prepareStatement (insert into ...) called
    [Connection@b0c5a] prepareStatement () returned PreparedStatement@9830bc
    [PreparedStatement@9830bc] setString (1, 000759BA7 ) called
    Notice that the StatementCacheSize is 0 and also a new PreparedStatement is allocated and used after the SQLException is thrown. This contradict to your statement:
    I see, and I see something in the code. I have attached a
    patch to tey (get it ahead of the weblogic.jar in the
    server classspath).
    thanks
    Joe
    I am saying that for a zero-cache setup, the serverside statement wrapper
    won't change in any loop, and neither will the DBMS driver statement it
    wraps, regardless of any exceptions during execute() calls.Thanks,
    Assen

  • Java.sql.SQLException: Cannot call rollback when using distributed transac

    Hi all,
    I am getting the below exception trace when I tried to rollback the data in WLI.I am getting the db connection Object from DBControl.
    java.sql.SQLException: Cannot call rollback when using distributed transactions
    at weblogic.jdbc.wrapper.JTAConnection.rollback(JTAConnection.java:313)
    at controls.DailyFeedFileJavaImpl.excuteBatch(DailyFeedFileJavaImpl.jcs:
    904)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
    :371)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
    3)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
    6)
    at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:381)
    at $Proxy59.excuteBatch(Unknown Source)
    at QnbDailyFeedProcess.feedFileJavaObjExcuteBatch(QnbDailyFeedProcess.jp
    d:274)
    at QnbDailyFeedProcess_wf$ImplControlSend15.invoke(QnbDailyFeedProcess_w
    f.java:146)
    at com.bea.wli.bpm.runtime.Perform.execute(Perform.java:32)
    at com.bea.wli.bpm.runtime.ProcessState.executeInternalCallback(ProcessS
    tate.java:726)
    at QnbDailyFeedProcess_wf$_ProcessState.executeInternalCallback(QnbDaily
    FeedProcess_wf.java:311)
    at com.bea.wli.bpm.runtime.ProcessState.executeInternalCallback(ProcessS
    tate.java:685)
    at com.bea.wli.bpm.runtime.ProcessState.processNodeOrchestration(Process
    State.java:681)
    at sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
    :371)
    at com.bea.wli.bpm.runtime.JpdInternalDispMethod.invoke(JpdInternalDispM
    ethod.java:87)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
    3)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
    6)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:24

    shanmuga gomathi nayagam wrote:
    Hi all,
    I am getting the below exception trace when I tried to rollback the data in WLI.I am getting the db connection Object from DBControl.
    java.sql.SQLException: Cannot call rollback when using distributed transactions
    at weblogic.jdbc.wrapper.JTAConnection.rollback(JTAConnection.java:313)Hi, Ideally, you should obtain the Transaction object and roll it back/ set it
    to rollback only.
    Joe
    at controls.DailyFeedFileJavaImpl.excuteBatch(DailyFeedFileJavaImpl.jcs:
    904)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
    :371)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
    3)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
    6)
    at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:381)
    at $Proxy59.excuteBatch(Unknown Source)
    at QnbDailyFeedProcess.feedFileJavaObjExcuteBatch(QnbDailyFeedProcess.jp
    d:274)
    at QnbDailyFeedProcess_wf$ImplControlSend15.invoke(QnbDailyFeedProcess_w
    f.java:146)
    at com.bea.wli.bpm.runtime.Perform.execute(Perform.java:32)
    at com.bea.wli.bpm.runtime.ProcessState.executeInternalCallback(ProcessS
    tate.java:726)
    at QnbDailyFeedProcess_wf$_ProcessState.executeInternalCallback(QnbDaily
    FeedProcess_wf.java:311)
    at com.bea.wli.bpm.runtime.ProcessState.executeInternalCallback(ProcessS
    tate.java:685)
    at com.bea.wli.bpm.runtime.ProcessState.processNodeOrchestration(Process
    State.java:681)
    at sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
    :371)
    at com.bea.wli.bpm.runtime.JpdInternalDispMethod.invoke(JpdInternalDispM
    ethod.java:87)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
    3)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
    6)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:24

  • BINDING.JCA-12510 JCA Resource Adapter - Cannot call rollback when using di

    Hi,
    i'm facing a simillar issue with dbadapter while trying to insert a record.
    The issue that I'm facing is: (BINDING.JCA-12563)
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception. insert failed. Descriptor name: http://InsertEmployee.TestEmp. Caused by java.sql.SQLException: Cannot call rollback when using distributed transactions. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    I faced the same issues that have been posted in this thread before but this is a new one I'm seeing.
    Following are the configurations that I'm using.
    WEBLOGIC ADMIN CONSOLE
    JDBC datasources
    General tab:
    JNDI Name: jdbc/SOADataSource
    Connection Pool tab:
    URL - jdbc:oracle:thin:@localhost:1522/XE
    Driver Class Name - oracle.jdbc.xa.client.OracleXADataSource
    Properties - user=SATRA_SOAINFRA
    oracle.net.CONNECT_TIMEOUT=10000
    Deployments
    Inside DbAdapter - Configuration
    The general tab shows blank values for 'Native lib dir' and 'JNDI name' fields. Is this normal or I need to populate values into these.
    Inside Outbound Connection Pools the javax.resource.cci.ConnectionFactory created an entry 'eis/DB/10gXE_DBCon'
    following is the settings for dataSourceName property
    dataSourceName java.lang.String jdbc/SOADataSource
    I have kept the value for xADataSourceName as blank as giving the same value of 'jdbc/SOADataSource' throws error.
    The JNDI value that I'm using while creating the database adapter from Jdev is eis/DB/10gXE_DBCon where 10gXE_DBCon is the database connection name.
    Can you please tell me what is the issue and where I'm going wrong.
    Thanks in advance,
    Satrajit

    Hi Sunil,
    I followed your advice and did the changes, that error has gone but a new error is popping up.
    BINDING.JCA-12563 Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception. insert failed. Descriptor name: [InsertEmployee.TestEmp]. Caused by java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist . ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    The name of the table i'm inserting to is test_emp and it exists in the database.
    the .jca file for dbadsapter is like
    <adapter-config name="FileToDB_DBAdp" adapter="Database Adapter" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/DB/10gXE_DBCon" UIConnectionName="10gXE_DBCon" adapterRef=""/>
    <endpoint-interaction portType="FileToDB_DBAdp_ptt" operation="insert">
    <interaction-spec className="oracle.tip.adapter.db.DBWriteInteractionSpec">
    <property name="DescriptorName" value="FileToDB_DBAdp.TestEmp"/>
    <property name="DmlType" value="insert"/>
    <property name="MappingsMetaDataURL" value="FileToDB_DBAdp-or-mappings.xml"/>
    <property name="DetectOmissions" value="true"/>
    <property name="GetActiveUnitOfWork" value="false"/>
    </interaction-spec>
    </endpoint-interaction>
    </adapter-config>
    and the .xsd file for dbadapter is
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <xs:schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/FileToDB_DBAdp" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/FileToDB_DBAdp" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="TestEmpCollection" type="TestEmpCollection"/>
    <xs:complexType name="TestEmpCollection">
    <xs:sequence>
    <xs:element name="TestEmp" type="TestEmp" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TestEmp">
    <xs:sequence>
    <xs:element name="empid" type="xs:decimal" nillable="true"/>
    <xs:element name="name" type="xs:string" minOccurs="0" nillable="true"/>
    <xs:element name="designation" minOccurs="0" nillable="true">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="50"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="salary" type="xs:decimal" minOccurs="0" nillable="true"/>
    <xs:element name="deptno" type="xs:decimal" minOccurs="0" nillable="true"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    If I change element name from 'TestEmp' to 'Test_Emp' in the .xsd file,
    I'm getting the following issue ...
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: Could not create/access the TopLink Session. This session is used to connect to the datastore. Caused by java.lang.NullPointerException. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    I'm confused why does it take the table name as TestEmp and not as Test_Emp.
    Regards,
    Satrajit

  • Detecting when exception was thrown using custom class loader

    Hello all,
    I would like to implement the solution described here - http://stackoverflow.com/questions/75218/how-can-i-detect-when-an-exceptions-been-thrown-globally-in-java - that uses custom class loader in order to detect when an Exeption thrown somewhere in the JVM hosting my app, please note that exceptions might be thrown from 3rd party jars the app is using. So, thanks to help I got from another post, I've managed to code the custom class loader. My question is how can the class loader wrap the original exception, as the methods in ClassLoader deals with classes, not instances. So where should I set the original exception?
    Thanks!
    Edited by: user9355666 on Sep 28, 2010 10:48 PM

    user9355666 wrote:
    I think I'm missing something fundumental, forgive me for being slow...
    This is what I did so far. For the exception wrapper I made a simple class extens Exception that recieve Exception in its ctor and store it. I also subclassed ClassLoader and override its loadClass(). I've registered it as the system classloader. My thinking was to check in that point that if the requested class is instance of Exception and if yes, returning my wrapper class wrapping this exception. But, since loadClass() return class, how can I set in the wrapper the original exception?
    In addition, let's say 2 different places in the code throws NPE, to my understanding the classloader will load NPE only once, so how throwing the NPE in the second time can be detected?you are missing a key point. you should creating a custom implementation of the NPE class which hooks into your detection code in its constructor. from that point forward, anytime any NPE (which is your custom class) is constructed, you can detect it.

  • Rollback when installing PSE8 on Vista

    When installing PSE8 on Vista i get an rollback in the end of process and the installation is deleted. Why?

    See this Adobe document for troubleshooting installation errors:
    http://kb2.adobe.com/cps/858/cpsid_85844.html
    Ken

  • Memory leak when exceptions are thrown?

    Hello,
    I'm doing a simple database connect with the JDBC Oracle 8.1.6 oci8 drivers on Solaris. It seems whenever I try to repeatedly connect to a database, and an exception is thrown, such as database not found, or wrong password, the program size grows and grows until it runs out of memory. I've narrowed it down to being the getConnection operation as the casue of this memory leak.
    Now, if I repeatedly connect successfully, there is no problem, it will run all day, but if there are exceptions thrown, memory leaks. Has anyone else encountered this?
    I'll paste a sample program below which shows the problem. Maybe someone can help???
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    public class connect extends Thread {
    private oracle.jdbc.driver.OracleDriver oDriver = new oracle.jdbc.driver.OracleDriver();
    private Connection connection;
    * Open a connection to the database
    private void connectToDB() {
    try {
    connection = DriverManager.getConnection ("jdbc:oracle:oci8:@test", "test", "test");
    connection.close();
    } catch (SQLException e) {
    e.printStackTrace();
    System.out.println("couldn't connect");
    public void run() {
    try {
    DriverManager.registerDriver(oDriver);
    } catch (SQLException e) {}
    while(true) {
    try {
    sleep(1000);
    connectToDB();
    } catch (InterruptedException ie) {}
    public static void main(String[] args) {
    connect conn = new connect();
    conn.start();
    null

    Try this:
    private void connectToDB() {
    try {
    connection = DriverManager.getConnection ("jdbc:oracle:oci8:@test", "test", "test");
    } catch (SQLException e) {
    e.printStackTrace();
    System.out.println("couldn't connect");
    finally {
    connection.close();
    null

  • Rollback when an error occurs

    Hi!
    I process all the xml files from a directory (insert the data into some relational tables). I use a for loop cursor to process each file at a time. When an error occurs, I have to rollback all the inserts and process the next file, but when I try to rollback the transaction, the following error is raised:
    ORA-01002: fetch out of sequence
    I know that this explanation is terrible without a line of code, but what I need to know is: is there any special treatment when I work with XML extraction? (I'm using XMLTABLE to extract the data). Because I have the same logic with text files + external tables and it works fine.
    Thanks.

    I've just found the answer at http://it.toolbox.com/wiki/index.php/Wondering_%27ORA-1002_Fetch_out_of_sequence%27
    (my cursor is not FOR UPDATE).
    And, sorry, the problem was not with XML.
    Bye...

  • Automatic commit/rollback when debugging

    Hi,
    A colleague of mine who I asked to use SQL Developer instead of TOAD for debugging, was very surprised to found his debug session to have committed at the end. TOAD doesn't. He lost a lot of time undoing the unintended changes.
    He made me remember I went to the same thing when I first used sqldev.
    Instead of automatically assuming you want to commit or rollback, this really should be asked on successful completion. Or set a preference: ask, commit, or rollback.
    Anyone who agrees, please vote on the added feature request: http://htmldb.oracle.com/pls/otn/f?p=42626:39:1493919074214847::NO::P39_ID:28041
    Thanks,
    K.

    It's not really a bug, but a nasty feature.
    You can only vote on the mentioned request to add weight for future implementation.
    Until then you can put a breakpoint before completion, and when halted there, stop execution with the red stop button.
    Have fun,
    K.

  • Custom Activity not returning Published Data when ActivityWarning() is thrown

    I'm using Visual Studio 2012 on Windows 8.1 to develop a custom
    ActivityMonitor class using the
    imperative approach with the Microsoft System Center 2012 R2 Orchestrator Integration Toolkit. The
    ActivityMonitor inherits from IActivity, has two inputs and three outputs declared in the
    Design method, and publishes three outputs in the Execute method.
    I want to use this ActivityMonitor such that the Orchestrator
    smart link only processes published data when a Warning is encountered. Therefore, after calling the
    IActivityResponse.Publish method three times (once for each output), I throw a new
    ActivityWarning exception.
    Unfortunately, after throwing the ActivityWarning exception, no published data is passed down the smart link. Since this published data is used by the next
    Activity, it is causing that Activity to fail.
    Why is my published data getting discarded, just because an ActivityWarning was thrown? How can I make this work?
    If this post was helpful, please click the little "Vote as Helpful" button :)
    Trevor Sullivan
    Trevor Sullivan's Tech Room
    Twitter Profile

    Hi Mithun Sharma
    Are you getting desired result, when you execute the RFC FM directly in SAP, with the same values, which you pass from .NET
    Regards
    Madhan Doraikannan

  • SOAP Response not return when exception is thrown

    Hi,
    Wonder if anyone had encountered the same issue as me with SOAP Response.
    Adobe LiveCycle ES2 (v9.0.0.2)
    I had a process which is triggered using SOAP Endpoint.
    Whenever there is exception in the process the SOAP Response will have an error, instead of returning the default SOAP Fault with the exception stack trace. Nothing is returned.
    I was testing using soapUI when I encountered this issue, to widen the test I used the 'Service Operation - Invoke Web Service'. An error occurred when using the build in test function.
    'Empty content of web service response was found due to unknown reason'
    This issue is definely not happening in the previous version LC v8.2.
    Feel weird that not one reported about this issue or there is something wrong with my installation/configuration?
    Ryan

    Hi,
    Even we encountered similar issue.
    Please let us know if there is a fix/work around for this problem.
    Regards,
    Srikanth

  • Steps to rollback when Logical Standby Database creation fails

    Hi,
    In case while creating a logical standby database it fails. What steps should be done on primary to rollback the earlier steps. Because while creating logical standby we do certain tasks on primary e.g.
    1) create supplemental logging.
    2) update init file.
    Regards,
    Tushar

    Hi,
    Thanks for the mail. Should I drop the supplemental logging using
    "Alter database DROP Supplemental Log data;".
    or if we need to disable, how can we do so?
    Rest is ok. Anyways I would not be using force logging.
    Droping of additional tablespace created to keep logminer tables on primary.
    Removing of log_archive_dest_2 information from primary init.
    I think the above should do.
    Regards,
    Tushar

  • Serious issues with Timer when RunTimeExceptions are thrown in TimerTask

    Hi All,
    I am facing serious issues with Timer and TimerTask.
    Runtime exceptions thrown in TimerTask kill that one thread, thus making Timer dead i.e. scheduled tasks will not run anymore. Is there any way we can overcome this with Timer or it is just not possible?
    I used try, catch blocks in TimerTask for RunTimeExceptions but no luck. Timer is not running any more once TimerTask throws any exceptions. Why it is not able to catch them? Is this known issue with Timer?
    I am using Java 1.5.0_08.
    Any guidance is appreciated.
    Thanks in advance,

    sairamvla wrote:
    Runtime exceptions thrown in TimerTask kill that one thread, thus making Timer dead i.e. scheduled tasks will not run anymore. Is there any way we can overcome this with Timer or it is just not possible?Not possible (at least, not possible just by using a Timer).
    I used try, catch blocks in TimerTask for RunTimeExceptions but no luck. Timer is not running any more once TimerTask throws any exceptions. Why it is not able to catch them? Is this known issue with Timer?It's perfectly possible for you to catch a RuntimeException, in a TimerTask or anywhere else. If you were thinking that there is a language feature or something which makes catching exceptions work differently in a TimerTask, you weren't thinking right. Your code is just wrong.

  • How do I move an upgraded version when I have thrown away the 'original' version CD?

    The first version of Photoshop I owned (and registered with Adobe) was version 6.  I then purchased an upgrade to CS and this year purchased an upgrade to CS4.  I recently tried to install CS on another computer (AFAIK the EULA allows me to install it on two machines), and when I did the install failed because CS couldn't find the older version from which I upgraded.  And unfortunately in a fit of housekeeping, I threw out a lot of old software earlier this year.  What do I do?  And will I be able to install CS4 on a new computer when I buy a new one later this year?
    Relatedly, I when I went to check my registrations on the Adobe Web site, it only shows my registered copies of CS4, LR1 and LR2.  It no longer shows my registrations of PS version 6, CS, Photoshop Elements version 1 or PSE version 2.  How can I get all of those registrations 'restored'?
    Thanks for your help.
    Regards,
    David

    davidl11 wrote:
    And will I be able to install CS4 on a new computer when I buy a new one later this year?
    The CS4 installer just requires a qualifying serial, not the original install files, so that's less of a worry.
    davidl11 wrote:
    How can I get all of those registrations 'restored'?
    They are certainly there, but may not exist in a format that allows them to be pulled live from a database. Creating a support case and requesting them by mail should bring them up.
    Mylenium

  • Problem with rollback in EJB and CMT

    Hello,
    I faced a problem in my application that I really do not understand (but I really would like to). How can I trigger a rollback of a transaction that is container-managed (CMT)? I know that any system exceptions are supposed to be handled by the container automatically and will cause a transaction rollback when they are thrown from an enterprise bean method. My Problem now is that I'm unable to make this work in my application.
    Consider a situation like this:
    The ManageEntityBean holds a simple save() method that creates an instance of EntityA and another of EntityB. Both instances store an arbitrary number (here 10). After this, the entityManger (injected from the container) is asked to make these instances persistent. EntityB is mapped with a "unique" constraint, so any attempt to store the same number twice will cause an SQL Exception.
    First time when the save() method is invoked, the instances aEntity and bEntity are made permanent in the database. Second time when the save() method is invoked, the database throws an exception because bEntity is violating the unique constraint. What I would expect now is a complete rollback of the whole transaction. Instead, only bEntity has not been made permanent, but aEntity has.
    What's wrong with this code?
    @Stateless
    public class ManageEntityBean implements ManageEntity {
         @PersistenceContext
         private EntityManager entityManager;
         @TransactionAttribute(TransactionAttributeType.REQUIRED)
         public void save() {
              try {
                   EntityA aEntity = new EntityA(10);
                   EntityB bEntity = new EntityB(10);
                    entityManager.persist(aEntity);
                    entityManager.persist(bEntity);
              } catch (Exception e) {
                   throw new EJBException(e);
    @Entity
    public class EntityA implements java.io.Serializable {
         @Id
         @GeneratedValue
         private long     id;
            @Column(name="NUMBER")
            private int   number;
         public EntityA() {}
         public EntityA(int number) {
              this.number = number;
    @Entity
    public class EntityB implements java.io.Serializable {
         @Id
         @GeneratedValue
         private long     id;
         @Column(name = "NUMBER", unique = true)
         private int          number;
         public EntityB() {}
         public EntityB(int number) {
              this.number = number;
    }I found two related topics in this forum but still I didn't find the solution yet.
    [Enterprise JavaBeans - CMT and JDBC|http://forums.sun.com/thread.jspa?forumID=13&threadID=525651]
    and
    [ Forums - A CMT Session Bean Does Not Maintain the Transaction Correctly| http://forums.sun.com/thread.jspa?forumID=13&threadID=161512]
    Maybe anyone can give me a hint. Help is very much appreciated
    Christoph

    Thank you for your input!
    The save() method is simply invoked from the test applications main() method:
    public class Test {
         public static void main(String[] args) {
              JndiUtil<ManageEntity> jndiUtil = new JndiUtil<ManageEntity>();
              ManageEntity handler = jndiUtil.lookupBeanContext("ManageEntityBean", ManageEntity.class);
              handler.save();
    }Btw. I use Hibernate as persistence provider and JBoss 4.2.2.GA as application server.
    For clarity I attach some lines of the debug logging that is produced when the test application is getting started for the second time:
    ### open Session
    17:44:00,555 DEBUG *[SessionImpl] opened session at timestamp: 5007498610909184*
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Looking for a JTA transaction to join
    17:44:00,555 DEBUG [JDBCContext] successfully registered Synchronization
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Looking for a JTA transaction to join
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Transaction already joined
    ### invoke em.persist(aEntity)
    17:44:00,555 DEBUG [AbstractSaveEventListener] executing identity-insert immediately
    17:44:00,555 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    17:44:00,555 DEBUG *[ConnectionManager] opening JDBC connection*
    17:44:00,555 DEBUG [SQL]
    /* insert de.zippus.domain.EntityA
    17:44:00,556 INFO [STDOUT] Hibernate:
    /* insert de.zippus.domain.EntityA
    17:44:00,558 DEBUG [IdentifierGeneratorFactory] Natively generated identity: 2
    17:44:00,559 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    17:44:00,559 DEBUG [ConnectionManager] aggressively releasing JDBC connection
    17:44:00,559 DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: >0)]
    ### invoke em.persist(bEntity)
    17:44:00,559 DEBUG [AbstractSaveEventListener] executing identity-insert immediately
    17:44:00,559 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    17:44:00,559 DEBUG [ConnectionManager] opening JDBC connection
    17:44:00,559 DEBUG [SQL]
    /* insert de.zippus.domain.EntityB
    17:44:00,560 INFO [STDOUT] Hibernate:
    /* insert de.zippus.domain.EntityB
    17:44:00,561 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    17:44:00,561 DEBUG [ConnectionManager] aggressively releasing JDBC connection
    17:44:00,561 DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: >0)]
    17:44:00,561 DEBUG [JDBCExceptionReporter] could not insert: [de.zippus.domain.EntityB] [* insert de.zippus.domain.EntityB */ insert into >ENTITY_B (NUMBER) values (?)]
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '10' for key 2
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
    17:44:00,563 WARN [JDBCExceptionReporter] SQL Error: 1062, SQLState: 23000
    17:44:00,563 ERROR [JDBCExceptionReporter] Duplicate entry '10' for key 2
    17:44:00,563 DEBUG [AbstractEntityManagerImpl] mark transaction for rollback
    17:44:00,563 ERROR [ManageEntityBean] Caught exception: javax.persistence.EntityExistsException: >org.hibernate.exception.ConstraintViolationException: could not insert: [de.zippus.domain.EntityB]
    17:44:00,563 ERROR [ManageEntityBean] Exception Cause: org.hibernate.exception.ConstraintViolationException: could not insert: >[de.zippus.domain.EntityB]
    17:44:00,564 DEBUG *[ManagedEntityManagerFactory] ************** closing entity managersession *************** Up to now I'm not that experienced in reading and understanding this kind of logging, but what I can see is, that there is a transaction that spans the whole unit of work and that this transaction is marked for rollback. I think that's quite a good thing, isn't it?
    But what really puzzles me here is, that both calls of em.persist() result in an opening of a jdbc connection and an immidiate execution of a database insert. Tell me if I'm wrong, but is this really the right place to happen?
    For what reason soever hibernate thinks it has to make these instances permanent, no matter if there is already a session that is taking care of this. If so, I might deal with a wrong hibernate configuration, I checked, but I can't find anything..
    What do you think?
    Thanks in advance!
    Christoph

Maybe you are looking for

  • How to get current db value in backing bean

    Hi, I'm using jdeveloper 11.1.2.3.0 I would like to know how could I access the old value of an attribute in backing bean. I know I can get it in the EntityImpl level with getPostedAttribute function, but as I see I don't have permission to access th

  • HP laserjet cm1312 MFP doesn't scan

    I have almost completed the installation of my new multifunction printer from HP and it prints and copies beautifully, but it doesn't scan. When I get to the point of the setup where I choose either USB or Network connection it doesn't show the print

  • Video file size in Zen Moz

    I recently bought a Zen Mozaic and I've stored some avi movies in it. As avi videos can take many disc space ( up to 700 MB) I tried to shrink the video size (by lowering the resolution). Although in my computer, these files have shrunken in size, wh

  • Can't I use the comment in weblogic-ejb-jar.xml?

    Hi, I am migrating to WebLogic Server 6.1 from 5.1. And for the weblogic-ejb-jar.xml, the following error occurs: ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml' line 14: An invalid XML character (Unicode: 0xb8) was found in the comment. ERROR:

  • CPU used by oracle user

    Hi, on 10 g R2, on Windows SEVER 2003 oracle user SCOTT connect from SQLPLUS and runs a large query. Is there any way to see how much CPU does he use ? Thanks.