My guess is that I've ran accross a bug.
Hibernate: 2.1.2
DBMS: Postgresql 7.4
Code:
org.postgresql.util.PSQLException: ERROR: column networkcab0_.elt does not exist
And very true, there's no such column, and there's no mentioning of the three letters ent in any of the mapping files nor java source files. All I find is the "Constant Field Value":
Code:
net.sf.hibernate.mapping.Collection
public static final String DEFAULT_ELEMENT_COLUMN_NAME "elt"
The query: (hold on)
Code:
select networkcab0_.elt as elt__, networkcab0_.computer as computer__, networkcab1_.id as id0_, networkcab1_.connectionType as connecti2_0_, networkcab1_.note as note0_, networkcab1_.cableType as cableType0_, networkcab1_.computer as computer0_, networkcab1_.outlet as outlet0_, networkcab1_.port as port0_, networkcab1_.downlink as downlink0_, networkcab2_.id as id1_, networkcab2_.name as name1_, networkcab2_.description as descript3_1_, computer3_.id as id2_, computer3_.hostname as hostname2_, computer3_.NVG as NVG2_, computer3_.visible as visible2_, computer3_.note as note2_, computer3_.mac as mac2_, computer3_.ipv4 as ipv42_, computer3_.code as code2_, computer3_.owner as owner2_, computer3_.firewallMode as firewal10_2_, computer3_.status as status2_, ipv44_.id as id3_, ipv44_.reserved as reserved3_, ipv44_.private as private3_, ipv44_.assignedAt as assignedAt3_, ipv44_.address as address3_, person5_.id as id4_, person5_.name as name4_, person5_.language as language4_, person5_.eMailAddress as eMailAdd4_4_, person5_.telephone as telephone4_, person5_.homepage as homepage4_, person5_.education as education4_, person5_.username as username4_, person5_.password as password4_, person5_.lastLogin as lastLogin4_, person5_.thisLogin as thisLogin4_, person5_.note as note4_, person5_.flat as flat4_, person5_.status as status4_, person5_.visibilityMode as visibil15_4_, flat6_.id as id5_, flat6_.floor as floor5_, flat6_.name as name5_, flat6_.description as descript4_5_, flat6_.note as note5_, flat6_.staircase as staircase5_, staircase7_.id as id6_, staircase7_.name as name6_, staircase7_.description as descript3_6_, staircase7_.livingArea as livingArea6_, livingarea8_.id as id7_, livingarea8_.name as name7_, livingarea8_.description as descript3_7_, status9_.id as id8_, status9_.name as name8_, status9_.description as descript3_8_, visibility10_.id as id9_, visibility10_.name_sv as name_sv9_, visibility10_.name_en as name_en9_, firewallmo11_.id as id10_, firewallmo11_.name_sv as name_sv10_, firewallmo11_.name_en as name_en10_, status12_.id as id11_, status12_.name as name11_, status12_.description as descript3_11_, outlet13_.id as id12_, outlet13_.name as name12_, outlet13_.note as note12_, outlet13_.flat as flat12_, outlet13_.wiringCloset as wiringCl5_12_, wiringclos14_.id as id13_, wiringclos14_.name as name13_, wiringclos14_.floor as floor13_, wiringclos14_.officialName as official4_13_, wiringclos14_.description as descript5_13_, wiringclos14_.note as note13_, wiringclos14_.staircase as staircase13_, switchport15_.id as id14_, switchport15_.name as name14_, switchport15_.immortal as immortal14_, switchport15_.switch as switch14_, switchport15_.portType as portType14_, switch16_.id as id15_, switch16_.name as name15_, switch16_.note as note15_, switch16_.mac as mac15_, switch16_.switchModel as switchMo5_15_, switch16_.wiringCloset as wiringCl6_15_, switch16_.ipv4 as ipv415_, switchmode17_.id as id16_, switchmode17_.name as name16_, switchmode17_.snmpName as snmpName16_, switchmode17_.snmpSupported as snmpSupp4_16_, wiringclos18_.id as id17_, wiringclos18_.name as name17_, wiringclos18_.floor as floor17_, wiringclos18_.officialName as official4_17_, wiringclos18_.description as descript5_17_, wiringclos18_.note as note17_, wiringclos18_.staircase as staircase17_, ipv419_.id as id18_, ipv419_.reserved as reserved18_, ipv419_.private as private18_, ipv419_.assignedAt as assignedAt18_, ipv419_.address as address18_, porttype20_.id as id19_, porttype20_.name as name19_, porttype20_.description as descript3_19_, networkcab21_.id as id20_, networkcab21_.computer as computer20_, networkcab21_.port as port20_, networkcab21_.note as note20_, networkcab21_.cableType as cableType20_, networkcab22_.id as id21_, networkcab22_.name as name21_, networkcab22_.description as descript3_21_
from networkCables networkcab0_
inner join NetworkCables networkcab1_ on networkcab0_.elt=networkcab1_.id
left outer join NetworkCableTypes networkcab2_ on networkcab1_.cableType=networkcab2_.id
left outer join Computers computer3_ on networkcab1_.computer=computer3_.id
left outer join IPv4Addresses ipv44_ on computer3_.ipv4=ipv44_.id
left outer join Persons person5_ on computer3_.owner=person5_.id
left outer join Flats flat6_ on person5_.flat=flat6_.id
left outer join Staircases staircase7_ on flat6_.staircase=staircase7_.id
left outer join LivingAreas livingarea8_ on staircase7_.livingArea=livingarea8_.id
left outer join Statuses status9_ on person5_.status=status9_.id
left outer join VisibilityModes visibility10_ on person5_.visibilityMode=visibility10_.id
left outer join FirewallModes firewallmo11_ on computer3_.firewallMode=firewallmo11_.id
left outer join Statuses status12_ on computer3_.status=status12_.id
left outer join Outlets outlet13_ on networkcab1_.outlet=outlet13_.id
left outer join WiringClosets wiringclos14_ on outlet13_.wiringCloset=wiringclos14_.id
left outer join SwitchPorts switchport15_ on networkcab1_.port=switchport15_.id
left outer join Switches switch16_ on switchport15_.switch=switch16_.id
left outer join SwitchModels switchmode17_ on switch16_.switchModel=switchmode17_.id
left outer join WiringClosets wiringclos18_ on switch16_.wiringCloset=wiringclos18_.id
left outer join IPv4Addresses ipv419_ on switch16_.ipv4=ipv419_.id
left outer join PortTypes porttype20_ on switchport15_.portType=porttype20_.id
left outer join NetworkCables networkcab21_ on switchport15_.id=networkcab21_.port
left outer join NetworkCableTypes networkcab22_ on networkcab21_.cableType=networkcab22_.id
where networkcab0_.computer=?
Rewriting it replacing networkcab0_.elt to .id at least is syntactically correct:
Code:
select networkcab0_.id as elt__, networkcab0_.computer as computer__, networkcab1_.id as id0_, networkcab1_.connectionType as connecti2_0_, networkcab1_.note as note0_, networkcab1_.cableType as cableType0_, networkcab1_.computer as computer0_, networkcab1_.outlet as outlet0_, networkcab1_.port as port0_, networkcab1_.downlink as downlink0_, networkcab2_.id as id1_, networkcab2_.name as name1_, networkcab2_.description as descript3_1_, computer3_.id as id2_, computer3_.hostname as hostname2_, computer3_.NVG as NVG2_, computer3_.visible as visible2_, computer3_.note as note2_, computer3_.mac as mac2_, computer3_.ipv4 as ipv42_, computer3_.code as code2_, computer3_.owner as owner2_, computer3_.firewallMode as firewal10_2_, computer3_.status as status2_, ipv44_.id as id3_, ipv44_.reserved as reserved3_, ipv44_.private as private3_, ipv44_.assignedAt as assignedAt3_, ipv44_.address as address3_, person5_.id as id4_, person5_.name as name4_, person5_.language as language4_, person5_.eMailAddress as eMailAdd4_4_, person5_.telephone as telephone4_, person5_.homepage as homepage4_, person5_.education as education4_, person5_.username as username4_, person5_.password as password4_, person5_.lastLogin as lastLogin4_, person5_.thisLogin as thisLogin4_, person5_.note as note4_, person5_.flat as flat4_, person5_.status as status4_, person5_.visibilityMode as visibil15_4_, flat6_.id as id5_, flat6_.floor as floor5_, flat6_.name as name5_, flat6_.description as descript4_5_, flat6_.note as note5_, flat6_.staircase as staircase5_, staircase7_.id as id6_, staircase7_.name as name6_, staircase7_.description as descript3_6_, staircase7_.livingArea as livingArea6_, livingarea8_.id as id7_, livingarea8_.name as name7_, livingarea8_.description as descript3_7_, status9_.id as id8_, status9_.name as name8_, status9_.description as descript3_8_, visibility10_.id as id9_, visibility10_.name_sv as name_sv9_, visibility10_.name_en as name_en9_, firewallmo11_.id as id10_, firewallmo11_.name_sv as name_sv10_, firewallmo11_.name_en as name_en10_, status12_.id as id11_, status12_.name as name11_, status12_.description as descript3_11_, outlet13_.id as id12_, outlet13_.name as name12_, outlet13_.note as note12_, outlet13_.flat as flat12_, outlet13_.wiringCloset as wiringCl5_12_, wiringclos14_.id as id13_, wiringclos14_.name as name13_, wiringclos14_.floor as floor13_, wiringclos14_.officialName as official4_13_, wiringclos14_.description as descript5_13_, wiringclos14_.note as note13_, wiringclos14_.staircase as staircase13_, switchport15_.id as id14_, switchport15_.name as name14_, switchport15_.immortal as immortal14_, switchport15_.switch as switch14_, switchport15_.portType as portType14_, switch16_.id as id15_, switch16_.name as name15_, switch16_.note as note15_, switch16_.mac as mac15_, switch16_.switchModel as switchMo5_15_, switch16_.wiringCloset as wiringCl6_15_, switch16_.ipv4 as ipv415_, switchmode17_.id as id16_, switchmode17_.name as name16_, switchmode17_.snmpName as snmpName16_, switchmode17_.snmpSupported as snmpSupp4_16_, wiringclos18_.id as id17_, wiringclos18_.name as name17_, wiringclos18_.floor as floor17_, wiringclos18_.officialName as official4_17_, wiringclos18_.description as descript5_17_, wiringclos18_.note as note17_, wiringclos18_.staircase as staircase17_, ipv419_.id as id18_, ipv419_.reserved as reserved18_, ipv419_.private as private18_, ipv419_.assignedAt as assignedAt18_, ipv419_.address as address18_, porttype20_.id as id19_, porttype20_.name as name19_, porttype20_.description as descript3_19_, networkcab21_.id as id20_, networkcab21_.computer as computer20_, networkcab21_.port as port20_, networkcab21_.note as note20_, networkcab21_.cableType as cableType20_, networkcab22_.id as id21_, networkcab22_.name as name21_, networkcab22_.description as descript3_21_
from networkCables networkcab0_
inner join NetworkCables networkcab1_ on networkcab0_.id=networkcab1_.id
left outer join NetworkCableTypes networkcab2_ on networkcab1_.cableType=networkcab2_.id
left outer join Computers computer3_ on networkcab1_.computer=computer3_.id
left outer join IPv4Addresses ipv44_ on computer3_.ipv4=ipv44_.id
left outer join Persons person5_ on computer3_.owner=person5_.id
left outer join Flats flat6_ on person5_.flat=flat6_.id
left outer join Staircases staircase7_ on flat6_.staircase=staircase7_.id
left outer join LivingAreas livingarea8_ on staircase7_.livingArea=livingarea8_.id
left outer join Statuses status9_ on person5_.status=status9_.id
left outer join VisibilityModes visibility10_ on person5_.visibilityMode=visibility10_.id
left outer join FirewallModes firewallmo11_ on computer3_.firewallMode=firewallmo11_.id
left outer join Statuses status12_ on computer3_.status=status12_.id
left outer join Outlets outlet13_ on networkcab1_.outlet=outlet13_.id
left outer join WiringClosets wiringclos14_ on outlet13_.wiringCloset=wiringclos14_.id
left outer join SwitchPorts switchport15_ on networkcab1_.port=switchport15_.id
left outer join Switches switch16_ on switchport15_.switch=switch16_.id
left outer join SwitchModels switchmode17_ on switch16_.switchModel=switchmode17_.id
left outer join WiringClosets wiringclos18_ on switch16_.wiringCloset=wiringclos18_.id
left outer join IPv4Addresses ipv419_ on switch16_.ipv4=ipv419_.id
left outer join PortTypes porttype20_ on switchport15_.portType=porttype20_.id
left outer join NetworkCables networkcab21_ on switchport15_.id=networkcab21_.port
left outer join NetworkCableTypes networkcab22_ on networkcab21_.cableType=networkcab22_.id
where networkcab0_.computer=?;
But how the heck did elt get there?