I have 2 classes Organization and CompanyProperty.
from Organization.xbm.xml :
Code:
<bag
name="properties"
table="multilanguage_property"
lazy="false"
inverse="true"
cascade="all"
where="disc like 'comp'"
>
<key column="ref_id"/>
<one-to-many
class="com.clearview.feedback.db.language.property.CompanyProperty"/>
</bag>
When i execute such query:
Code:
<query name="OrgGetSimilarOrgs"><![CDATA[
from Organization as org, CompanyProperty as prop where prop.refId = org.id and prop.language.id=? and prop.name = ? and prop.value like ?
]]></query>
Hibernate executes such sql queries:
Code:
Hibernate: select organiza0_.org_id as org_id0_, companyp1_.prop_id as prop_id1_, organiza0_.client as client0_, companyp1_.lang_id as lang_id1_, companyp1_.name as name1_, companyp1_.value as value1_, companyp1_.description as descript6_1_, companyp1_.ref_id as ref_id1_ from organization organiza0_, multilanguage_property companyp1_ where companyp1_.disc='comp' and ((companyp1_.ref_id=organiza0_.org_id )and(companyp1_.lang_id=? )and(companyp1_.name=? )and(companyp1_.value like ? ))
Hibernate: select multilan0_.prop_id as prop_id__, language1_.lang_id as lang_id0_, language1_.name as name0_, language1_.description as descript3_0_, multilan0_.prop_id as prop_id1_, multilan0_.lang_id as lang_id1_, multilan0_.name as name1_, multilan0_.value as value1_, multilan0_.description as descript6_1_, multilan0_.ref_id as ref_id1_ from multilanguage_property multilan0_ left outer join language language1_ on multilan0_.lang_id=language1_.lang_id where multilan0_.ref_id=? and multilan0_.disc like 'comp'
in Organization class such set method for CompanyProperties
Code:
protected void setProperties(List properties) throws WrongPropertyException {
this.properties = properties;
for (int i = 0; i < properties.size(); i++) {
CompanyProperty multiLanguageProperty =
(CompanyProperty) properties.get(i);
log.info("Company id: "+getId()+" CompanyProperty with name: " + multiLanguageProperty.getName() +
" value: "+multiLanguageProperty.getValue()+" and language: " + multiLanguageProperty.getLanguage());
}
}
In db there 2 properies(
Code:
prop_id__ lang_id0_ name0_ descript3_0_ prop_id1_ lang_id1_ name1_ value1_ descript6_1_ ref_id1_
111 1 en English 111 1 name bonas Bonas 36
112 2 fr French 112 2 name bonas_fr BonasFR 36
) for organization but when executes setProperties method i see such output
Code:
Company id: 36 and properties size: 2 MultiLanguageProperty with id 111 name: null value: null and language: null
Company id: 36 and properties size: 2 MultiLanguageProperty with id 112 name: name value: bonas_fr and language: fr
What's it? Why first element is null except its id?[/code]