Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Suggestion: commit() method returning the number of committed.(Suggestion: commit() method returning the number of committed.)
Suggestion: commit() method returning the number of committed. [message #908540] Wed, 05 September 2012 10:44 Go to next message
Eclipse UserFriend
It would be helpful to me... so I'm presuming others... to have a version of the commit() method similar to the following using the EntityTransaction interface as a model:

/**
* Commit the current resource transaction, writing any
* unflushed changes to the database. This version of the
* commit() method returns the number of SQL modification-
* related statements executed.
*
* @throws IllegalStateException if <code>isActive()</code> is false
* @throws RollbackException if the commit fails
*/
public int commits();


Perhaps obviously, this method would have immediate benefit in a (JUnit style) testing context - where it is difficult to assert if an "update" actually was persisted to the database.

_Marvin
PatternEnabled.com
Re: Suggestion: commit() method returning the number of committed. [message #909060 is a reply to message #908540] Thu, 06 September 2012 09:16 Go to previous messageGo to next message
Eclipse UserFriend
For our own testing we generally accomplish this by setting a custom logger into the Session that monitors SQL logging.

The class is org.eclipse.persistence.testing.framework.QuerySQLTracker, available from our Git repository under testing.
Re: Suggestion: commit() method returning the number of committed. [message #909098 is a reply to message #909060] Thu, 06 September 2012 10:24 Go to previous messageGo to next message
Eclipse UserFriend
Can you include a copy of the "assert" method you are using to ensure updates actually were persisted during unit testing?

_Marvin
PatternEnabled.com
Re: Suggestion: commit() method returning the number of committed. [message #909248 is a reply to message #909060] Thu, 06 September 2012 16:06 Go to previous message
Eclipse UserFriend
James Sutherland wrote on Thu, 06 September 2012 09:16
For our own testing we generally accomplish this by setting a custom logger into the Session that monitors SQL logging.

The class is org.eclipse.persistence.testing.framework.QuerySQLTracker, available from our Git repository under testing.


Elaboration: foundation/eclipselink.core.test/src/org...
Previous Topic:Eclipselink 2.3.2 + composite persistence units + bean validation (jsr303)
Next Topic:Why is EclipseLink querying twice for the same entity?
Goto Forum:
  


Current Time: Fri Jul 04 09:30:56 EDT 2025

Powered by FUDForum. Page generated in 0.17490 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top