You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Dan Adams (JIRA)" <de...@tapestry.apache.org> on 2008/03/09 00:59:46 UTC

[jira] Created: (TAPESTRY-2247) Don't commit the transaction automatically at the end of the request

Don't commit the transaction automatically at the end of the request
--------------------------------------------------------------------

                 Key: TAPESTRY-2247
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
             Project: Tapestry
          Issue Type: Bug
          Components: tapestry-hibernate
    Affects Versions: 5.0.10
            Reporter: Dan Adams


On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-2247) Transactions should roll back, not commit, at the end of each request

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAPESTRY-2247:
-------------------------------------------

    Issue Type: Bug  (was: Task)

Further evidence that automatically committing is a bug:

Clients have experienced a race condition (under MySQL and Tomcat) where the autocommit was slower than the page refresh, resulting in a display of entities with state from before the commit.  Using explicit commits ensures this won't happen, as a response won't be sent to the client until after the commit completes.

> Transactions should roll back, not commit, at the end of each request
> ---------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Howard M. Lewis Ship
>             Fix For: 5.0.12
>
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2247) Don't commit the transaction automatically at the end of the request

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580561#action_12580561 ] 

Howard M. Lewis Ship commented on TAPESTRY-2247:
------------------------------------------------

I this really an issue?  In a typical case, the commit will occur on a context that has no outstanding issues.

Ah, I see, the issue is with partial updates that are invalid.  I think we need a larger strategy for handling this; a loose coupling between Form and the hibernate support so that the transaction can be rolled back, or marked rollback-only.  Currently, the best option is to supply an onFailure() event handler to roll the transaction back.

> Don't commit the transaction automatically at the end of the request
> --------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Dan Adams
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2247) Don't commit the transaction automatically at the end of the request

Posted by "Massimo Lusetti (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576736#action_12576736 ] 

Massimo Lusetti commented on TAPESTRY-2247:
-------------------------------------------

Well i probably don't get what you're referring to as "does more harm than good" but having to explicitly call commit() on plain successfull unit of operations seems a waste of time.

Please would you like to share some more thoughts?

Thanks

> Don't commit the transaction automatically at the end of the request
> --------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Dan Adams
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Closed: (TAPESTRY-2247) Transactions should roll back, not commit, at the end of each request

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAPESTRY-2247.
------------------------------------------

       Resolution: Fixed
    Fix Version/s: 5.0.12

Ultimately, we need to add some form of @Commit annotation as well, so that user code doesn't have to directly deal with the HibernateSessionManager.

> Transactions should roll back, not commit, at the end of each request
> ---------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Task
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Howard M. Lewis Ship
>             Fix For: 5.0.12
>
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2247) Don't commit the transaction automatically at the end of the request

Posted by "Massimo Lusetti (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576937#action_12576937 ] 

Massimo Lusetti commented on TAPESTRY-2247:
-------------------------------------------

Well you certainly would to not submit (aka call session.save()) on entities till you're sure all validation and business check are in place so calling it before seems a very bad practice and should avoided.
For the second use case, as you said if the entity is persisted into the session you have to reattach it to the hibernate session during subsequent utilization, so this would force me to call also a commit too (if needed to be committed). BTW persiting entities in the session is also another bad practice.

I understand this as a way to encourage bad practices, they are probably widely used but still bad. Your propose of a configuration symbol is nice and i would probably make it even defaults to the current behaviour.

> Don't commit the transaction automatically at the end of the request
> --------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Dan Adams
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-2247) Transactions should roll back, not commit, at the end of each request

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAPESTRY-2247:
-------------------------------------------

    Issue Type: Task  (was: Bug)
       Summary: Transactions should roll back, not commit, at the end of each request  (was: Don't commit the transaction automatically at the end of the request)

> Transactions should roll back, not commit, at the end of each request
> ---------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Task
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Howard M. Lewis Ship
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Assigned: (TAPESTRY-2247) Don't commit the transaction automatically at the end of the request

Posted by "Dan Adams (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Adams reassigned TAPESTRY-2247:
-----------------------------------

    Assignee: Dan Adams

> Don't commit the transaction automatically at the end of the request
> --------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Dan Adams
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2247) Don't commit the transaction automatically at the end of the request

Posted by "Dan Adams (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576828#action_12576828 ] 

Dan Adams commented on TAPESTRY-2247:
-------------------------------------

In T4 we had commits on by default for a while and it ended up causing some weirdness in our CMS projects; if you (or anything else) made a change to an entity then the changes could be persisted without you knowing. Let's say you had an add/edit page where the entity was the context. If you change some fields and then submit but some server-side validaton fails then the changes to the entity will be committed even though the user hasn't succesfully submit the form yet. So I would definitely want it to only save the changes once all the validation goes through. Another use case is if you have an add/edit page where the entity is persisted (normally) so that between screens it's not in the hibernate session. In this instance you actually have to do an explicity call to save() because the entity won't be attached to the session so it won't get caught in the automatic commit. Perhaps the behavior could be configurable with a symbol.

> Don't commit the transaction automatically at the end of the request
> --------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Dan Adams
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2247) Transactions should roll back, not commit, at the end of each request

Posted by "Jonathan Barker (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586087#action_12586087 ] 

Jonathan Barker commented on TAPESTRY-2247:
-------------------------------------------

Perhaps the @Transactional annotation used by Spring would be a reasonable example to copy.

> Transactions should roll back, not commit, at the end of each request
> ---------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Task
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Howard M. Lewis Ship
>             Fix For: 5.0.12
>
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Assigned: (TAPESTRY-2247) Don't commit the transaction automatically at the end of the request

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship reassigned TAPESTRY-2247:
----------------------------------------------

    Assignee: Howard M. Lewis Ship  (was: Dan Adams)

> Don't commit the transaction automatically at the end of the request
> --------------------------------------------------------------------
>
>                 Key: TAPESTRY-2247
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2247
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.10
>            Reporter: Dan Adams
>            Assignee: Howard M. Lewis Ship
>
> On thread cleanup, the Session should be flushed not committed. If people want to commit changes they should explicitly do so but having the transaction committed automatically can lead to some very mysterious changing of the data. In my experience, having the transaction committed automatically does more harm than good.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org