Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Savepoints, Checkpoints, Rollbacks?

OK so it doesn't look like this is possible directly with JPA or Eclipselink
as far as I can tell however I've managed to coble this together, in case
its of any use to anyone hear goes....

first to get a savepoint...

    public Savepoint getSavepoint() throws SQLException {
        //Get the SQL connection
        Connection conn = ((UnitOfWorkImpl) ((JpaEntityManager)

        //Get a savepoint from the SQL connection
        return conn.setSavepoint();


next to make use of it...
    public void commitToSave1(Savepoint sp) throws SQLException {
        Connection conn = ((UnitOfWorkImpl) ((JpaEntityManager)
        //roll the connection back to the savepoint
        //commit the current state of the transaction
        //clear the persistence context causing all managed entities to
        //become detached
        //commit the transaction to release locks and reset the entity

Hope that may be of use to someone:-D

paulccarey wrote:
> Hi I am using eclipselink with JPA
> Is it possible to create savepoints like JDBC can?
> So I can rollback a transaction to a certain point without losing all
> changes?
> Thanks
> P

View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top