我目前通过一个构造函数传递我的数据,该构造函数填充从我的抽象类和扩展类(即扩展的 MusicItem Abstract 和 CD 和 Vinyl 类)请求的数据
我试图从我的控制器使用 JavaFX 将它们打印到表视图中,但即使放置了 system.out 行也没有显示任何内容。
我已经尝试将它们放入可观察列表以及普通数组列表中,我已经三次检查数据字段以查看它们是否与表格匹配并且我尝试在输入时查看对象但是当我这样做时,该对象的十六进制代码出现。它正确连接到数据库但不显示任何内容
abstract class MusicItem {
@Id
private int songID;
private String name;
private String artist;
private String genre;
private String releaseDate;
private double price;
public MusicItem(int songID, String name, String artist, String genre, String releaseDate, double price) {
this.songID = songID;
this.name = name;
this.artist = artist;
this.genre = genre;
this.releaseDate = releaseDate;
this.price = price;
}
}
@Entity
class Vinyl extends MusicItem{
private double speed;
private double diameter;
Vinyl(int songID, String name, String artist, String genre, String releaseDate, double price, double speed, double diameter) {
super(songID, name, artist, genre, releaseDate, price);
this.speed = speed;
this.diameter = diameter;
}
}
@Entity
class CD extends MusicItem{
private double duration;
CD(int songID, String name, String artist, String genre, String releaseDate, double price, double duration) {
super(songID, name, artist, genre, releaseDate, price);
this.duration = duration;
}
}
慕慕森
相关分类