[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6780) Wrong Query timeout calculation
Donnchadh O Donnabhain (JIRA)
noreply at atlassian.com
Tue Nov 29 10:20:20 EST 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44459#comment-44459 ]
Donnchadh O Donnabhain commented on HHH-6780:
---------------------------------------------
I've tested our code against the fix applied to master and we're no longer seeing any problems related to the transaction timeout.
> Wrong Query timeout calculation
> --------------------------------
>
> Key: HHH-6780
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6780
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 4.0.0.CR4, 4.0.0.CR5
> Environment: Hibernate 4.0.0.RC5, Spring 3.1.RC1
> Reporter: Ruben Garcia
> Assignee: Steve Ebersole
> Labels: hibernate
> Fix For: 4.0.0.next
>
> Time Spent: 1h 16m
>
> {code:title=org.hibernate.engine.jdbc.internal.StatementPreparerImpl.StatementPreparationTemplate#setStatementTimeout}
> private void setStatementTimeout(PreparedStatement preparedStatement) throws SQLException {
> if ( transactionTimeOut > 0 ) {
> int timeout = (int) ( transactionTimeOut - ( System.currentTimeMillis() / 1000 ) );
> if ( timeout <= 0 ) {
> throw new TransactionException( "transaction timeout expired" );
> } else {
> preparedStatement.setQueryTimeout( timeout );
> }
> }
> }
> {code}
> Test Code:
> Session session = openSession();
> Transaction transaction = session.getTransaction();
> transaction .setTimeout(20);
> This calculation will be always negative:
> int timeout = (int) ( transactionTimeOut - ( System.currentTimeMillis() / 1000 ) );
> resulting TransactionException( "transaction timeout expired" ) will be throw.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list