I have this error when I compile. In test I don't have problem.
I have the dependency javax.xml.bind, jaxb-api.
Error:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.endoorment.models.entity.AccessoryLang.accessory in com.endoorment.models.entity.Accessory.accessorylang
Entities:
@Entity
@Table(name = "accessories")
public class Accessory implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer id;
@OneToMany(mappedBy = "accessory", cascade = CascadeType.ALL)
private Set<AccessoryLang> accessorylang = new HashSet<AccessoryLang>();
@Entity
@Table(name = "accessories_langs")
public class AccessoryLang implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private AccessoryLangId accessorylangid;
@ManyToOne(fetch = FetchType.LAZY)
@MapsId("accessoryId")
@JoinColumn(name = "accessories_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private Accessory accessory;
@ManyToOne(fetch = FetchType.LAZY)
@MapsId("langId")
@JoinColumn(name = "langs_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private Lang lang;
@Column(nullable = false, length = 45)
@NotEmpty
private String name;