Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Hibernate-Jboss Forge在我的列表中添加空元素_Java_Hibernate_Jpa_Jboss Forge - Fatal编程技术网

Java Hibernate-Jboss Forge在我的列表中添加空元素

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

我使用Jboss forge生成简单的CRUD。这没关系,但当我得到实体列表(
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);
    }