String query = "from FamixMeasurement as fm " +
"where fm.identifier='" + this.getIdentifier() + "' " +
"and fm.entity.id = '" + fCurrentEntity.getId() + "'";
// look in DB if there is already a value stored for that calculation
FamixMeasurement measurement = session.uniqueResult(query, FamixMeasurement.class);
if (measurement == null) {
// no value in DB stored, so calculate the value and store it in DB
measurement = new FamixMeasurement(fCurrentEntity, this.getIdentifier());
measurement.setValue(calculate());
fCurrentSession.startTransaction();
fCurrentSession.saveObject(measurement);
fCurrentSession.endTransaction();
}
return measurement.getValue();
}