Example usage for org.hibernate StatelessSession update

List of usage examples for org.hibernate StatelessSession update

Introduction

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

Prototype

void update(String entityName, Object entity);

Source Link

Document

Update a row.

Usage

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 {// w ww  . j av a 2s  . c om
        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);
            }
        }
    }
}