/** Persist an entity given all attributes */ public DClass persist( Object raceKey, java.lang.Long id, java.util.Date actualStart, java.lang.String name, java.util.Date scheduledStart, se.bassac.roster.domain.DTrack track) { DClass domain = null; // if primaryKey specified, use it if (null != id) { domain = findByPrimaryKey(raceKey, id); } // create new? if (null == domain) { domain = new DClass(); // set parent domain.setRaceKey((java.lang.Object) raceKey); // generate Id? if (null != id) { domain.setId(id); } // fields domain.setActualStart(actualStart); domain.setName(name); domain.setScheduledStart(scheduledStart); // one-to-ones // many-to-ones domain.setTrack(track); persist(domain); } return domain; }
@Override protected void setDomainProperty(final DClass domain, final String name, final Object value) { // simple key? if (COLUMN_NAME_ID.equals(name)) { domain.setId((java.lang.Long) value); } // parent key? else if (COLUMN_NAME_RACEKEY.equals(name)) { domain.setRaceKey((java.lang.Object) value); } // fields else if (COLUMN_NAME_ACTUALSTART.equals(name)) { domain.setActualStart((java.util.Date) value); } else if (COLUMN_NAME_CREATEDBY.equals(name)) { domain.setCreatedBy((java.lang.String) value); } else if (COLUMN_NAME_CREATEDDATE.equals(name)) { domain.setCreatedDate((java.util.Date) value); } else if (COLUMN_NAME_NAME.equals(name)) { domain.setName((java.lang.String) value); } else if (COLUMN_NAME_SCHEDULEDSTART.equals(name)) { domain.setScheduledStart((java.util.Date) value); } else if (COLUMN_NAME_UPDATEDBY.equals(name)) { domain.setUpdatedBy((java.lang.String) value); } else if (COLUMN_NAME_UPDATEDDATE.equals(name)) { domain.setUpdatedDate((java.util.Date) value); } // one-to-ones // many-to-ones else if (COLUMN_NAME_TRACK.equals(name)) { DTrack foreign = null; if (null != value) { foreign = trackDao.createDomain(value); } domain.setTrack(foreign); } // many-to-manys else { super.setDomainProperty(domain, name, value); } }
public void setParentKey(DClass domain, Object raceKey) { domain.setRaceKey((Serializable) raceKey); }