Example usage for org.hibernate StatelessSession delete

List of usage examples for org.hibernate StatelessSession delete

Introduction

In this page you can find the example usage for org.hibernate StatelessSession delete.

Prototype

void delete(String entityName, Object entity);

Source Link

Document

Delete a row.

Usage

From source file:edu.uncc.genosets.studyset.StudySetDeleter.java

License:Open Source License

@Override
public void persist(StatelessSession ss) {
    if (toDelete != null) {
        for (FactStudySet factStudySet : toDelete) {
            if (factStudySet.getFactId() != null) {
                ss.delete(factStudySet.getEntityName(), factStudySet);
            }// www  . ja  v a2  s  .  c o  m
        }
    }
    if (studySet.getId() != null) {
        ss.delete(studySet.getEntityName(), studySet);
    }
}

From source file:edu.uncc.genosets.studyset.StudySetPersister.java

License:Open Source License

@Override
public void persist(StatelessSession ss) {
    if (studySet.getId() == null) {
        ss.insert(studySet.getEntityName(), studySet);
    } else {//from  w w w.  j  a v  a  2  s.  c o m
        ss.update(studySet.getEntityName(), studySet);
    }
    if (toAdd != null) {
        for (FactStudySet factStudySet : toAdd) {
            if (factStudySet.getFactId() == null) {
                factStudySet.setStudySetId(studySet.getId());
                ss.insert(factStudySet.getEntityName(), factStudySet);
            }
        }
    }
    if (toDelete != null) {
        for (FactStudySet factStudySet : toDelete) {
            if (factStudySet.getFactId() != null) {
                ss.delete(factStudySet.getEntityName(), factStudySet);
            }
        }
    }
}