i would like to ask you for hint about SpringBoot and Derby. I have developed one small private project in Spring Boot and as databe i use Derby. Unfortunatelly I have one problem with the saving a new record in database.
Entity for the table site_overview
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "site_overview")
public class SiteOverview {
@Id
@Column(updatable = false)
protected Integer id;
@OneToOne
@JoinColumn(name = "ownerid", referencedColumnName = "id")
protected User siteOwner;
protected Date dateofcreation;
}
and Service for this table:
@Service
public class SiteOverviewService {
public SiteOverviewDTO addNewSite(SiteOverview newSite) {
SiteOverview savedEntity = siteOverviewRepository.save(newSite);
return siteOverviewMapper.toDTO(savedEntity);
}
}
If I call this method, ti is received following error message:
org.apache.derby.iapi.error.StandardException: Attempt to modify an identity column 'ID'.
It is of course logical, because I try to change the column with ID and this column has to be generated from DerbyDB. The question is >
How I can save the new record and say, please save all variable without ID?
thank you very much!!!