2
Fork 0

[svn r380] added all kinds of objects

This commit is contained in:
willemc 2009-04-13 19:19:48 +02:00
parent a9520b3804
commit 37fdf22282
140 changed files with 7679 additions and 901 deletions

View file

@ -37,19 +37,17 @@ import com.idcanet.vasc.core.AbstractVascBackend;
*/
abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend {
/**
* Provides a hibernate session which is closed !! when transaction is compleeted.
* @return
*/
abstract EntityManager getEntityManager();
public void persist(Object object) throws Exception {
EntityManager s = getEntityManager();
try {
s.getTransaction().begin();
s.persist(object);
s.getTransaction().commit();
} finally {
if (s!=null) {
s.close();
//s.close();
}
}
}
@ -57,10 +55,13 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend
public Object merge(Object object) throws Exception {
EntityManager s = getEntityManager();
try {
return s.merge(object);
s.getTransaction().begin();
Object result = s.merge(object);
s.getTransaction().commit();
return result;
} finally {
if (s!=null) {
s.close();
//s.close();
}
}
}
@ -68,11 +69,13 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend
public void delete(Object object) throws Exception {
EntityManager s = getEntityManager();
try {
s.getTransaction().begin();
Object newObject = s.merge(object);
s.remove(newObject);
s.getTransaction().commit();
} finally {
if (s!=null) {
s.close();
//s.close();
}
}
}