I agree, it should work.
I'm very surprised when analyzing the trace and the result of the session.load() :
1/ My object is correctly initialized, the many-to-one is a proxy :
result= Dossier (id=221)
appelant= Raitance$$EnhancerByCGLIB$$c96c2d05 (id=225)
2/ Here is the relevant hibernate trace :
08-04-2004 14:06:18:608 DEBUG net.sf.hibernate.impl.SessionImpl:531 - opened session
08-04-2004 14:06:18:628 DEBUG net.sf.hibernate.impl.SessionImpl:1950 - loading [com.uniclick.afbah.modele.dossier.Dossier#409]
08-04-2004 14:06:18:638 DEBUG net.sf.hibernate.impl.SessionImpl:2047 - attempting to resolve [com.uniclick.afbah.modele.dossier.Dossier#409]
08-04-2004 14:06:18:658 DEBUG net.sf.hibernate.cache.ReadWriteCache:68 - Cache lookup: 409
08-04-2004 14:06:18:658 DEBUG net.sf.hibernate.cache.ReadWriteCache:78 - Cache hit: 409
08-04-2004 14:06:18:668 DEBUG net.sf.hibernate.impl.SessionImpl:2092 - resolved object in second-level cache [com.uniclick.afbah.modele.dossier.Dossier#409]
...
08-04-2004 14:06:19:650 DEBUG net.sf.hibernate.impl.SessionImpl:1950 - loading [com.uniclick.afbah.modele.dossier.raitance.Raitance#409]
08-04-2004 14:06:19:660 DEBUG net.sf.hibernate.impl.SessionImpl:1950 - loading [com.uniclick.afbah.modele.dossier.maltraitance.Maltraitance#409]
08-04-2004 14:06:19:680 DEBUG net.sf.hibernate.impl.SessionImpl:3891 - creating collection wrapper:[com.uniclick.afbah.modele.dossier.Dossier.victimes#409]
08-04-2004 14:06:19:690 DEBUG net.sf.hibernate.impl.SessionImpl:3891 - creating collection wrapper:[com.uniclick.afbah.modele.dossier.Dossier.maltraitants#409]
08-04-2004 14:06:19:700 DEBUG net.sf.hibernate.impl.SessionImpl:3891 - creating collection wrapper:[com.uniclick.afbah.modele.dossier.Dossier.suivis#409]
08-04-2004 14:06:19:710 DEBUG net.sf.hibernate.impl.SessionImpl:2047 - attempting to resolve [com.uniclick.afbah.modele.dossier.raitance.Raitance#409]
08-04-2004 14:06:19:720 DEBUG net.sf.hibernate.impl.SessionImpl:2080 - object not resolved in any cache [com.uniclick.afbah.modele.dossier.raitance.Raitance#409]
08-04-2004 14:06:19:730 DEBUG net.sf.hibernate.persister.EntityPersister:416 - Materializing entity: [com.uniclick.afbah.modele.dossier.raitance.Raitance#409]
08-04-2004 14:06:19:740 DEBUG net.sf.hibernate.impl.BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
08-04-2004 14:06:19:750 DEBUG net.sf.hibernate.SQL:237 - select raitance0_.id as id0_, raitance0_.adresse as adresse0_, raitance0_.age as age0_, raitance0_.code_postal as code_pos4_0_, raitance0_.contacte_direct as contacte5_0_, raitance0_.nom as nom0_, raitance0_.prenom as prenom0_, raitance0_.profession_id as professi8_0_, raitance0_.relation_victime as relation9_0_, raitance0_.sexe as sexe0_, raitance0_.situation_familiale as situati11_0_, raitance0_.tel_bur as tel_bur0_, raitance0_.tel_dom as tel_dom0_, raitance0_.tel_port as tel_port0_, raitance0_.civilite as civilite0_, raitance0_.ville as ville0_, raitance0_.commentaires as comment17_0_ from raitance raitance0_ where raitance0_.id=?
Hibernate: select raitance0_.id as id0_, raitance0_.adresse as adresse0_, raitance0_.age as age0_, raitance0_.code_postal as code_pos4_0_, raitance0_.contacte_direct as contacte5_0_, raitance0_.nom as nom0_, raitance0_.prenom as prenom0_, raitance0_.profession_id as professi8_0_, raitance0_.relation_victime as relation9_0_, raitance0_.sexe as sexe0_, raitance0_.situation_familiale as situati11_0_, raitance0_.tel_bur as tel_bur0_, raitance0_.tel_dom as tel_dom0_, raitance0_.tel_port as tel_port0_, raitance0_.civilite as civilite0_, raitance0_.ville as ville0_, raitance0_.commentaires as comment17_0_ from raitance raitance0_ where raitance0_.id=?
08-04-2004 14:06:19:770 DEBUG net.sf.hibernate.impl.BatcherImpl:241 - preparing statement
08-04-2004 14:06:19:780 DEBUG net.sf.hibernate.type.LongType:46 - binding '409' to parameter: 1
08-04-2004 14:06:19:800 DEBUG net.sf.hibernate.loader.Loader:197 - processing result set
08-04-2004 14:06:19:830 DEBUG net.sf.hibernate.loader.Loader:405 - result row: 409
08-04-2004 14:06:19:840 DEBUG net.sf.hibernate.loader.Loader:536 - Initializing object from ResultSet: 409
08-04-2004 14:06:19:850 DEBUG net.sf.hibernate.loader.Loader:605 - Hydrating entity: com.uniclick.afbah.modele.dossier.raitance.Raitance#409
08-04-2004 14:06:19:870 DEBUG net.sf.hibernate.type.StringType:68 - returning '54 rue d'alouette' as column: adresse0_
08-04-2004 14:06:19:880 DEBUG net.sf.hibernate.type.PersistentEnumType:68 - returning '7' as column: age0_
08-04-2004 14:06:19:890 DEBUG net.sf.hibernate.type.StringType:68 - returning '75012' as column: code_pos4_0_
08-04-2004 14:06:19:900 DEBUG net.sf.hibernate.type.PersistentEnumType:68 - returning '0' as column: contacte5_0_
08-04-2004 14:06:19:910 DEBUG net.sf.hibernate.type.StringType:68 - returning 'DUPONT' as column: nom0_
08-04-2004 14:06:19:930 DEBUG net.sf.hibernate.type.StringType:68 - returning 'Bertrand' as column: prenom0_
08-04-2004 14:06:19:940 DEBUG net.sf.hibernate.type.LongType:68 - returning '1' as column: professi8_0_
08-04-2004 14:06:19:950 DEBUG net.sf.hibernate.type.LongType:68 - returning '1' as column: relation9_0_
08-04-2004 14:06:19:960 DEBUG net.sf.hibernate.type.PersistentEnumType:68 - returning '1' as column: sexe0_
08-04-2004 14:06:19:970 DEBUG net.sf.hibernate.type.PersistentEnumType:68 - returning '0' as column: situati11_0_
08-04-2004 14:06:19:990 DEBUG net.sf.hibernate.type.StringType:68 - returning '0178124578' as column: tel_bur0_
08-04-2004 14:06:20:000 DEBUG net.sf.hibernate.type.StringType:68 - returning '0141547896' as column: tel_dom0_
08-04-2004 14:06:20:010 DEBUG net.sf.hibernate.type.StringType:68 - returning '0678651245' as column: tel_port0_
08-04-2004 14:06:20:030 DEBUG net.sf.hibernate.type.PersistentEnumType:68 - returning '1' as column: civilite0_
08-04-2004 14:06:20:040 DEBUG net.sf.hibernate.type.StringType:68 - returning 'PARIS' as column: ville0_
08-04-2004 14:06:20:060 DEBUG net.sf.hibernate.type.StringType:68 - returning 'bonjour
|