Dear hibernate users, i have a method which returns a class of type
PreventivoView.java defined as
Code:
public class PreventivoView {
private String idPreventivo = null;
private Richiedente richiedente = null;
private StatoPreventivo statoPreventivo = null;
private Struttura struttura = null;
private TipoAttivita tipoAttivita = null;
private SedeTecnica sedeTecnica = null;
private String descrizione = "";
PreventivoView() {}
with all his getters and setters defined, which I'll not write 'cause of TL;DR
then I have a method which should load one object of the above type, written as
Code:
public PreventivoView getView() {
String idPreventivo = getIdPreventivo();
if (Value.isEmpty(view) &&
Value.isNotEmpty(idPreventivo)) {
view = (PreventivoView)
getSession().get(PreventivoView.class, idPreventivo);
}
return view;
}
the object of type PreventivoView.java is not really a table, but a bunch of fields mapped as follows
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="previtc.model.preventivo">
<class name="PreventivoView" table="P06_PREVENTIVI" mutable="false">
<id name="idPreventivo" column="P06_ID_PREVENTIVO" type="string" />
<!-- Relations -->
<many-to-one name="richiedente"
column="P06_ID_RICHIEDENTE"
unique="true"
update="false"
insert="false"
not-null="true" />
<many-to-one name="esitoPreventivo"
column="P06_TIPO_ESITO"
unique="true"
update="false"
insert="false"
not-null="true" />
<many-to-one name="statoPreventivo"
column="P06_TIPO_STATO"
unique="true"
update="false"
insert="false"
not-null="true" />
<many-to-one name="struttura"
column="P06_COD_STRUTTURA"
unique="true"
update="false"
insert="false"
not-null="true" />
<many-to-one name="tipoAttivita"
column="P06_TIPO_ATTIVITA"
unique="true"
update="false"
insert="false"
not-null="true" />
<many-to-one name="sedeTecnica"
column="P06_COD_SEDE_TECNICA"
unique="true"
update="false"
insert="false"
not-null="false" />
<property name="descrizione"
column="P06_DESCRIZIONE"
type="string" />
</class>
</hibernate-mapping>
I just want to understand why, at the moment of my query, my object is populated by the method which calls the query, without
any error, but the fields Richiedente , StatoPreventivo , TipoAttivita are not filled with datas! Constraints are correctly mapped in my
Oracle 10g database , as referential integrity . Could anyone explain me why the data are not loaded ? Thank you so much!