Здравствуйте, у меня есть 2 сущности Страна со встроенным свойством
@IdClass(Country.class)
@Entity
@Table(name="country")
public class Country implements Serializable{
@Id
@Column(name="code", length=3, nullable=false)
private String code;
@Column(name="name", length=256, nullable=false)
private String name;
@EmbeddedId
private CountryLanguage language;
public CountryLanguage getCountryLanguage() {
return language;
}
public void setCountryLanguage(CountryLanguage language) {
this.language = language;
}
CountryLanguage встроенный класс с геттерами и сеттерами
@Embeddable
public class CountryLanguage {
@Column(name="country_code", length=3, nullable=false)
private String code;
@Column(name="language", length=256, nullable=false)
private String language;
@Column(name="is_official", length=256, nullable=false)
private boolean official;
У меня есть исключение
Caused by: java.lang.reflect.InvocationTargetException: null springbootapp
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_212] springbootapp
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_212] springbootapp
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_212] springbootapp
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_212] springbootapp
at org.hibernate.tuple.component.ComponentTuplizerFactory.constructTuplizer(ComponentTuplizerFactory.java:104) ~[hibernate-core-5.4.10.Final.jar!/:5.4.10.Final] springbootapp
... 46 common frames omitted springbootapp
Caused by: org.hibernate.PropertyNotFoundException: Could not locate field name [official] on class [hello.world.entity.Country]