我正在开发一个关于我国一些彩票的 java 程序,它有一个包含乐透和其他号码的数据库。实体类没有问题,但是当我运行问题时,我的持久性单元无法识别一个实体类。我是 java 的初学者,提前致谢。
下面是实体类:Numbers
@Entity
@Table(name = "NUMBERS")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Numbers.findAll", query = "SELECT n FROM Numbers n")
, @NamedQuery(name = "Numbers.findById", query = "SELECT n FROM Numbers n WHERE n.id = :id")
, @NamedQuery(name = "Numbers.findByNum", query = "SELECT n FROM Numbers n WHERE n.num = :num AND n.lotto = :lotto")
, @NamedQuery(name = "Numbers.findByAssociated", query = "SELECT n FROM Numbers n WHERE n.num = :num AND n.associated = :associated AND n.lotto = :lotto")
, @NamedQuery(name = "Numbers.findByLotto", query = "SELECT n FROM Numbers n WHERE n.lotto = :lotto")})
public class Numbers implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Basic(optional = false)
@Column(name = "NUM")
private int num;
@Basic(optional = false)
@Column(name = "ASSOCIATED")
private int associated;
@Basic(optional = false)
@Column(name = "LOTTO")
private String lotto;
以及我用来插入数据库的代码:Numbers
public static boolean insertAlert(EntityManager em, Numbers an) {
boolean success = false;
Alert alert = Check.createAlert(Check.CONFIRMATION, "Añadir números asociados", "¿Deseas añadir estos números?");
Optional<ButtonType> result = alert.showAndWait();
}
持久性单元可以识别我所有的实体类,但不能识别这个,我不知道如何解决这个问题......
杨__羊羊
沧海一幻觉
12345678_0001
相关分类