[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-6780) Wrong Query timeout calculation
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Nov 28 18:41:19 EST 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole resolved HHH-6780.
---------------------------------
Resolution: Fixed
Fix Version/s: 4.0.0.next
> 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