I think I got it now. This seems to work:
Code:
Transaction tx = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
User user1 = userDAO.findById(new Integer(1), false);
user1.setFirstname("Jane");
userDAO.flush();
Savepoint savepoint = userDAO.setSavepoint("my_savepoint");
user1.setFirstname("John");
userDAO.flush();
userDAO.rollbackSavepoint(savepoint);
tx.commit();
Resulting firstname in the database is "Jane". I guess I simply lacked knowledge of the flush mechanism.
The savepoint methods in the DAO looks as followed:
Code:
private Savepoint savepoint;
public Savepoint setSavepoint(final String savePoint)
{
getSession().doWork(new Work()
{
public void execute(Connection connection) throws SQLException
{
savepoint = connection.setSavepoint(savePoint);
}
});
return savepoint;
}
public void rollbackSavepoint(final Savepoint savepoint)
{
getSession().doWork(new Work(){
public void execute(Connection connection) throws SQLException
{
connection.rollback(savepoint);
}
});
}
Thanks for your support. I hope this is how it it meant to be used.
The Session.clear() thing isn't quite what I need. Too powerful you could say. Since some not yet performed operations might be wanted while others might not be. So sadly, clearing everything isn't an option...
5 comments:
adidas tubular x
true religion jeans
ray ban sunglasses outlet
tiffany and co jewelry
tiffany and co uk
mlb jerseys shop
chrome hearts online store
yeezy
chrome hearts online
yeezy boost 350
http://www.chromehearts.com.co
adidas yeezy uk
louboutin shoes
michael kors outlet
cheap oakley sunglasses
http://www.nikedunks.us.org
retro jordans
ralph lauren uk
michael jordan shoes
toms outlet store
yeezy boost
tiffany and co uk
www0626
coach outlet
malone souliers
y3 shoes
christian louboutin outlet
clarks shoes
christian louboutin shoes
michael kors outlet
chloe sunglassess
canada goose jackets
nike revolution
asics gel lyte v blanche homme Vous allez lire achat nike flyknit lunar beaucoup de souffrances de cette douleur qui ont obtenu leur soulagement simplement de l'art de la marche. Néanmoins, l'enlèvement des chaussures nike air max cage printemps 2013 cicatrices chéloïdes n'est pas impossible! Mais vous devez d'abord trouver le bon remède. Et asics gel lyte 3 glow in the dark femme bien qu'il y ait vraiment beaucoup trop de fonctionnalités dans l'environnement du cigare à considérer nike air jordan 11 retro low gg pour ce post, j'ai supposé que je pourrais fournir un certain nombre de conseils pendant la asics gel noosa tri 10 navy stratégie pour le briquet allume-cigare, peut-être un accent important que vous pouvez avoir ( attaché avec l'humidor adidas zx flux homme soldes bien sûr).
lacoste polo
moncler jackets
nike flyknit
vans shoes
asics running shoes
yeezy
paul george shoes
red bottoms
yeezy shoes
hermes belt
find more Dolabuy Hermes see here now visit here check out the post right here pop over to this website
Post a Comment