Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.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
Jpa 我需要帮助来显示表的id,但我';我有它的内存地址_Jpa_Jsf_El - Fatal编程技术网

Jpa 我需要帮助来显示表的id,但我';我有它的内存地址

Jpa 我需要帮助来显示表的id,但我';我有它的内存地址,jpa,jsf,el,Jpa,Jsf,El,我有两个类,Orgulatour和salle由Orgulatour中的ManyToOne映射,我想在Orgulatour表中显示salles的id,但我得到的是salle的内存地址 This is the mapping in the ordinateur class @ManyToOne @JoinColumn(name="code_salle") private Salle salle; p

我有两个类,Orgulatour和salle由Orgulatour中的ManyToOne映射,我想在Orgulatour表中显示salles的id,但我得到的是salle的内存地址

    This is the mapping in the ordinateur class
    @ManyToOne
        @JoinColumn(name="code_salle")
        private Salle salle;
        
        public Salle getSalle() {
            return salle;
        }
     and here where i want to display it 
    <h:column>
                    <f:facet name="header">Code de la salle</f:facet>
                    <h:outputText value="#{ordinateur.salle}"></h:outputText>
                </h:column>
这是纵坐标类中的映射
@许多酮
@JoinColumn(name=“code\u salle”)
二等兵萨利;
公共服务{
回击;
}
在这里我想展示它
德拉萨尔代码

您的EL表达式引用的是
ordinatiur
中的
salle
属性,因此,您将得到
salle
对象。EL将调用对象上的
toString()
,这就是您看到的输出。您需要输出的是
#{ordinatiur.salle.id}

顺便说一下,您看到的不是内存地址,而是类名和对象的哈希代码。请参阅默认的
toString()
实现:

公共字符串toString(){
返回getClass().getName()+“@”+Integer.toHexString(hashCode());
}