hi leenabora,
if possible rather then attaching files please use code tag.
Code:
exception
org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not insert: [com.xyz.abc..domain.Schedule];
nested exception is org.hibernate.exception.SQLGrammarException: could not insert: [com.xyz.abc..domain.Schedule]
root cause
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'counterParty' in 'field list'
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
for the above excpetion
i think u need to make changes on the following entity.
Code:
@Entity
@Table(name="Schedules")
public class Schedule implements Serializable{
private static final long serialVersionUID = 1L;
private Long Id;
private String description;
private Long ownLegalEntityId;
private Long counterPartyId;
private Long marketId;
@ManyToOne
@JoinColumn(name="ID", table="OWN_LEGAL_ENTITIES", nullable = false, updatable = false, insertable = false)
private OwnLegalEntity ownLegalEntity;
@ManyToOne
@JoinColumn(name="ID", table="COUNTERPARTIES", nullable = false, updatable = false, insertable = false)
private CounterParty counterParty;
@ManyToOne
@JoinColumn(name="ID", table="MARKETS", nullable = false, updatable = false, insertable = false)
private Market market;
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
public Long getId() {
return Id;
}
public void setId(Long id) {
Id = id;
}
@Column(name="DESCRIPTION")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getOwnLegalEntityId() {
return ownLegalEntityId;
}
public void setOwnLegalEntityId(Long ownLegalEntityId) {
this.ownLegalEntityId = ownLegalEntityId;
}
public Long getCounterPartyId() {
return counterPartyId;
}
public void setCounterPartyId(Long counterPartyId) {
this.counterPartyId = counterPartyId;
}
public Long getMarketId() {
return marketId;
}
public void setMarketId(Long marketId) {
this.marketId = marketId;
}
public OwnLegalEntity getOwnLegalEntity() {
return ownLegalEntity;
}
@Transient
public void setOwnLegalEntity(OwnLegalEntity ownLegalEntity) {
this.ownLegalEntity = ownLegalEntity;
}
public CounterParty getCounterParty() {
return counterParty;
}
@Transient
public void setCounterParty(CounterParty counterParty) {
this.counterParty = counterParty;
}
public Market getMarket() {
return market;
}
@Transient
public void setMarket(Market market) {
this.market = market;
}
}
please make sure that do you really need the highlighted field type Long, As per my knowledge this field type should be objects fo respective entities.
for e.g. private CounterParty counterParty;
then mapped this one with respective foreign key.
with best regards,
ishaan