I got this exception last week when I was writing a task service to perform a task that involves retrieving data from a database. I found the SQL statements that it try to run from the The log files. They worked fine and gave correct results when I run it from SQL Server Management Studio.Then I googled the exception and found following details are helpful.
Most of the time this exception occur because of a timeout.
You can fix it by increasing the value of transactiontimeout property in conf/jboss-server.xml.
more info: http://ttlnews.blogspot.com/2012/04/jboss-exception-transaction-is-not.html
Another possible scenario is that there is a Null Pointer Exception in the flaw of your application. This caused the transaction to end and re-enter a loop when the transaction was not active.
more info: http://thejavablog.wordpress.com/2010/04/05/transaction-is-not-active-txtransactionimple-ac-basicaction
Last week I needed to add the clear button functionality for a form. The form was implemented using a JFrame.It includes radio buttons, check boxes and text boxes.
When the form first loads the button should be disabled. For that we can use
clearButton.setEnabled(false);
When user type something in textboxes or enter a value in radiobutton or check box, it should be enabled. To detect these events we can use ItemListener and CaretListener.
you can find working example here
Last week I was doing some work which needed to import values from CSV file to database. But I got this Data truncation in the middle of the task. When I did a search I found out following details.
Cause: One of the values in CSV file is larger than the allocated size for it in DB.
Solution: I wrote following code to find the maximum length of the values in CSV file.Then increased the allocated size for it in DB.
Code:
result is a double array(String[][]) which contain the values of CSV file.
int count=0;
for(int i=0;ifor(int k=0;k int count1 = result[k][i].length();
if(count1>count){count=count1;System.out.println(i+" "+count);}
}
}
System.out.println(count);