Java Hibernate-Jboss Forge在我的列表中添加空元素
我使用Jboss forge生成简单的CRUD。这没关系,但当我得到实体列表(Java Hibernate-Jboss Forge在我的列表中添加空元素,java,hibernate,jpa,jboss-forge,Java,Hibernate,Jpa,Jboss Forge,我使用Jboss forge生成简单的CRUD。这没关系,但当我得到实体列表(postEspDices)时,会添加一个空元素: 我的实体: @ManyToMany @JoinTable(name = "COR_TYPEFICHE_REGRPRJ", joinColumns = {@JoinColumn(name = "ID_TYPEFICHE", referencedColumnName = "ID")}, inverseJoinColumns = @Join
postEspDices
)时,会添加一个空元素:
我的实体:
@ManyToMany
@JoinTable(name = "COR_TYPEFICHE_REGRPRJ",
joinColumns = {@JoinColumn(name = "ID_TYPEFICHE", referencedColumnName = "ID")},
inverseJoinColumns = @JoinColumn(name = "ID_REGRPRJ", referencedColumnName = "ID"))
@OrderColumn(name = "ORDRE")
private List<RegroupementPostePrejudice> postesPrejudices;
你的代码没有显示你在哪里向列表中添加数据,也没有显示你在哪里持久化你的对象,你能更具体一些,并且有更多的信息吗?你能提供一个托管在github上的吗?
@Named
@Stateful
@ConversationScoped
public class TypeFicheBean implements Serializable {
...
@Inject
private Conversation conversation;
@PersistenceContext(unitName = "persistence-unit", type = PersistenceContextType.EXTENDED)
private EntityManager entityManager;
public void retrieve() {
if (FacesContext.getCurrentInstance().isPostback()) {
return;
}
if (this.conversation.isTransient()) {
this.conversation.begin();
this.conversation.setTimeout(1800000L);
}
if (this.id == null) {
this.typeFiche = this.example;
} else {
this.typeFiche = findById(getId());
}
}
public TypeFiche findById(Long id) {
return this.entityManager.find(TypeFiche.class, id);
}