blob: 4e982f6aa9c65f2da6d017023979a72b8da37473 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2013-2020 LAAS-CNRS (www.laas.fr)
* 7 Colonel Roche 31077 Toulouse - France
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* Initial Contributors:
* Thierry Monteil : Project manager, technical co-manager
* Mahdi Ben Alaya : Technical co-manager
* Samir Medjiah : Technical co-manager
* Khalil Drira : Strategy expert
* Guillaume Garzone : Developer
* François Aïssaoui : Developer
*
* New contributors :
*******************************************************************************/
package org.eclipse.om2m.persistence.eclipselink.internal.dao;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.persistence.eclipselink.internal.DBTransactionJPAImpl;
import org.eclipse.om2m.persistence.service.DBTransaction;
public class CSEBaseDAO extends AbstractDAO<CSEBaseEntity>{
@Override
public CSEBaseEntity find(DBTransaction dbTransaction, Object id) {
DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
CSEBaseEntity entity = transaction.getEm().find(CSEBaseEntity.class, id);
/*if(entity!=null){
transaction.getEm().refresh(entity);
}*/
return entity;
}
@Override
public void delete(DBTransaction dbTransaction, CSEBaseEntity resource) {
DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
transaction.getEm().remove(resource);
}
@Override
public void update(DBTransaction dbTransaction, CSEBaseEntity resource) {
DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
transaction.getEm().merge(resource);
}
}