0
私は2つのクラスを持っていますとContent
です。 1つの局は、1つまたは複数のコンテンツを有することができる。したがって、StationインスタンスとContentインスタンスの間にはoneToMany関係があります。 jacksonを使用してアプリケーションにjsonファイルをロードしようとしています。ここで BeanCreationException:クラスパスのリソースで定義された 'entityManagerFactory'という名前のBeanを作成中にエラーが発生しました
@Entity
@Data
public class Station {
@Id
@GeneratedValue
Long stationId;
@OneToMany(mappedBy = "station")
List<Content> contents = new ArrayList<Content>();
@Column
String name;
@Column
String address;
public Station(String name, String address) {
this.name = name;
this.address = address;
}
public Station() {
}
}
とコンテンツクラスがある:
@Entity
@Data
public class Content {
@Id
@GeneratedValue
Long id;
@Autowired
StationRepository stationRepo;
@ManyToOne
@JoinColumn(name = "stationId")
Station station;
@Column
String name;
@Column
String type;
@Column
String address;
@Column
int sizeInByte;
@Column
boolean active;
public Content(String name, String type,
String address, int sizeInByte,
boolean active,long stationId) {
this.name = name;
this.type = type;
this.address = address;
this.sizeInByte = sizeInByte;
this.station=stationRepo.findOne(stationId);
this.active = active;
}
public Content() {
}
public Content(long id) {
this.id = id;
}
}
残念ながら、私はデータベースにJSONファイルを読み込むしようとすると、次のエラーが表示されます
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
エラーは、jsonにはまったく関連していません。これは、休止状態の設定が間違っていると思います。 – Andremoniy
どうすれば修正できますか? – Salman
完全なスタックトレースを入れることができますか? –