-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Retrieving objects problem!
PostPosted: Fri Sep 17, 2004 7:07 pm 
Beginner
Beginner

Joined: Sun Apr 04, 2004 8:45 am
Posts: 20
Hibernate version: 2.1.4

Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
   <hibernate-mapping>
      <class name="Person" table="t_personen">
         <id name="personId" type="long" unsaved-value="null" >
            <column name="PERSON_ID" sql-type="integer" not-null="true"/>
            <generator class="hilo"/>
         </id>
         <!-- Nachname -->
         <property name="nachname">
            <column not-null="true" sql-type="varchar(32)" name="NACHNAME"
               />
         </property>
         <!-- Vorname -->
         <property name="vorname">
            <column not-null="true" sql-type="varchar(32)" name="VORNAME" />
         </property>
         <!-- Username -->
         <property name="username">
            <column not-null="false" sql-type="varchar(32)" name="USERNAME"
               />
         </property>
         <!-- Password -->
         <property name="password">
            <column not-null="false" sql-type="varchar(32)" name="PASSWORD"
               />
         </property>
         <!-- Adresse - Unidirektionale Assoziation one-to-one -->
         <one-to-one name="adresse"
            class="Adresse" cascade="all" />
         <!-- Unterklasse Student -->
         <joined-subclass name="Student"
            table="t_studierende">
            <key column="STUDIERENDE_ID" />
            <!-- Matrikelnummer -->
            <property name="matrikelNummer">
               <column not-null="true" sql-type="integer"
                  name="MATRIKEL_NUMMER"></column>
            </property>
         </joined-subclass>
      </class>
      <!-- Person ByNachname -->
      <query name="personByNachname">
         <![CDATA[from Person as obj where obj.nachname = :value]]>
      </query>
      <!-- Person ByVorname -->
      <query name="personByVorname">
         <![CDATA[from Person as obj where obj.vorname = :value]]>
      </query>
      <!-- Person ByName (Nachname, Vorname) -->
      <query name="personByName">
         <![CDATA[from Person as obj where obj.nachname = :nName and obj.vorname = :vName]]>
      </query>
      <!-- Person ById -->
      <query name="personById">
         <![CDATA[from Person as obj where obj.personId = :value]]>
      </query>
      <!-- Person byUsername -->
      <query name="personByUsername">
         <![CDATA[from Person as obj where obj.username = :value]]>
      </query>
</hibernate-mapping>


Code:
?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
   <hibernate-mapping>
      <class name="Adresse" table="t_adressen">
         <id name="adresseId" type="long" unsaved-value="null" >
            <column name="ADRESSE_ID" sql-type="integer" not-null="true"/>
            <generator class="hilo"/>
         </id>
         <!-- Strasse -->
         <property name="strasse">
            <column not-null="true" sql-type="varchar(32)" name="STRASSE" />
         </property>
         <!-- Hausnummer -->
         <property name="hausNummer">
            <column not-null="false" sql-type="integer" name="HAUSNUMMER" />
         </property>
         <!-- Postleitzahl -->
         <property name="plz">
            <column not-null="true" sql-type="integer" name="PLZ" />
         </property>
         <!-- Ort -->
         <property name="ort">
            <column not-null="true" sql-type="varchar(32)" name="ORT" />
         </property>
         <!-- Kontakt - Unidirektionale Assoziation one-to-one -->
         <one-to-one name="kontakt"
            class="Kontakt" cascade="all" foreign-key="ADRESSE_ID"/>
      </class>
      <!-- Adresse ById -->
      <query name="adresseById">
         <![CDATA[from Adresse as obj where obj.adresseId = :value]]>
      </query>
      <!-- Adresse ByPlz -->
      <query name="adresseByPlz">
         <![CDATA[fAdresse as obj where obj.plz = :value]]>
      </query>
      <!-- Adresse ByOrt -->
      <query name="adresseByOrt">
         <![CDATA[from Adresse as obj where obj.ort = :value]]>
      </query>
   </hibernate-mapping>


Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
   <hibernate-mapping>
      <class name="Kontakt" table="t_kontakte">
      <id name="kontaktId" type="long" unsaved-value="null" >
         <column name="KONTAKT_ID" sql-type="integer" not-null="true"/>
         <generator class="hilo"/>
      </id>
      <!-- Telefon -->
      <property name="telefon">
         <column not-null="false" sql-type="varchar(32)" name="TELEFON"/>
      </property>
      <!-- Email -->
      <property name="email">
         <column not-null="false" sql-type="varchar(32)" name="EMAIL"/>
      </property>
   </class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():

Code:
import java.util.Iterator;
import java.util.List;

import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;

import org.apache.log4j.Logger;

public class Test
{
    protected static Logger logger;
   
    static
    {
        logger = Logger.getLogger(Test.class);
    }
   
    public static void main(String[] args)
    {
        initStudierende();
        showStudierende();
    }
   
    private static void initStudierende()
    {
        try
        {
            Adresse adr1 = new Adresse("Strasse_A", 12, 7777, "Stadt_1",
                    new Kontakt("077 320 00 44", "rolf@tic.ch"));
            Adresse adr2 = new Adresse("Strasse_B", 22, 8888, "Stadt_2",
                    new Kontakt("088 320 33 44", "dani@dplanet.ch"));
            Adresse adr3 = new Adresse("Strasse_C", 47, 9999, "Stadt_3",
                    new Kontakt("099 340 63 11", "ursf@tic.ch"));                   

            Student std1 = new Student("Bucher", "Daniel", adr1, 200104);
            Student std2 = new Student("Waser", "Ivan", adr2, 200117);
            Student std3 = new Student("Sicher", "Beat", adr3, 200113);

            std1.setUsername("user1");
            std1.setPassword("pwd_user1");
            std2.setUsername("user2");
            std2.setPassword("pwd_user2");
            std3.setUsername("user3");
            std3.setPassword("pwd_user3");
           
            // Speichern
            Session session = DbHandler.getInstance().getSession();
            Transaction tx = session.beginTransaction();
           
            session.save(std1);
            session.save(std2);
            session.save(std3);

           
            tx.commit();
            session.close();
           
        }
        catch (Exception e)
        {
            logger.debug(e);
           
            System.err.println(e);
        }
    }
   
    private static void showStudierende()
    {
        Session session = null;
        Transaction tx = null;
       
        try
        {
            session = DbHandler.getInstance().getSession();
            tx = session.beginTransaction();
           
            Query q = session.createQuery("from Student");
            List lst = q.list();
           
            for (Iterator it = lst.iterator(); it.hasNext(); )
            {
                System.out.println(it.next());
            }
        }
        catch (HibernateException e)
        {
            logger.debug(e);
            System.err.println(e);
           
        }
    }
}


Full stack trace of any exception that occurs:
Code:
java.lang.NullPointerException
   at Person.toString(Person.java:168)
   at Student.toString(Student.java:85)
   at java.lang.String.valueOf(Unknown Source)
   at java.io.PrintStream.print(Unknown Source)
   at java.io.PrintStream.println(Unknown Source)
   at Test.showStudierende(Test.java:84)
   at Test.main(Test.java:23)
Exception in thread "main"


Name and version of the database you are using:
PostgreSQL 7.4.3.1
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
[code]01:02:55,855 INFO Environment:462 - Hibernate 2.1.4
01:02:55,875 INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.connection.username=student, hibernate.connection.password=, hibernate.cglib.use_reflection_optimizer=true, hibernate.connection.pool_size=10, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql://127.0.0.1:5432/ref_test_db, hibernate.connection.driver_class=org.postgresql.Driver}
01:02:55,875 INFO Environment:522 - using CGLIB reflection optimizer
01:02:55,885 INFO Configuration:347 - Mapping resource: Adresse.hbm.xml
01:02:55,935 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
01:02:55,945 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
01:02:56,095 INFO Binder:229 - Mapping class: Adresse -> t_adressen
01:02:56,175 DEBUG Binder:475 - Mapped property: adresseId -> ADRESSE_ID, type: long
01:02:56,186 DEBUG Binder:475 - Mapped property: strasse -> STRASSE, type: string
01:02:56,186 DEBUG Binder:475 - Mapped property: hausNummer -> HAUSNUMMER, type: long
01:02:56,196 DEBUG Binder:475 - Mapped property: plz -> PLZ, type: long
01:02:56,196 DEBUG Binder:475 - Mapped property: ort -> ORT, type: string
01:02:56,206 DEBUG Binder:475 - Mapped property: kontakt, type: Kontakt
01:02:56,206 DEBUG Binder:1267 - Named query: adresseById ->
from Adresse as obj where obj.adresseId = :value

01:02:56,206 DEBUG Binder:1267 - Named query: adresseByPlz ->
fAdresse as obj where obj.plz = :value

01:02:56,216 DEBUG Binder:1267 - Named query: adresseByOrt ->
from Adresse as obj where obj.ort = :value

01:02:56,216 INFO Configuration:347 - Mapping resource: Kontakt.hbm.xml
01:02:56,216 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
01:02:56,216 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
01:02:56,246 INFO Binder:229 - Mapping class: Kontakt -> t_kontakte
01:02:56,246 DEBUG Binder:475 - Mapped property: kontaktId -> KONTAKT_ID, type: long
01:02:56,246 DEBUG Binder:475 - Mapped property: telefon -> TELEFON, type: string
01:02:56,246 DEBUG Binder:475 - Mapped property: email -> EMAIL, type: string
01:02:56,246 INFO Configuration:347 - Mapping resource: Person.hbm.xml
01:02:56,266 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
01:02:56,266 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
01:02:56,296 INFO Binder:229 - Mapping class: Person -> t_personen
01:02:56,296 DEBUG Binder:475 - Mapped property: personId -> PERSON_ID, type: long
01:02:56,296 DEBUG Binder:475 - Mapped property: nachname -> NACHNAME, type: string
01:02:56,296 DEBUG Binder:475 - Mapped property: vorname -> VORNAME, type: string
01:02:56,296 DEBUG Binder:475 - Mapped property: username -> USERNAME, type: string
01:02:56,296 DEBUG Binder:475 - Mapped property: password -> PASSWORD, type: string
01:02:56,296 DEBUG Binder:475 - Mapped property: adresse, type: Adresse
01:02:56,336 INFO Binder:200 - Mapping joined-subclass: Student -> t_studierende
01:02:56,346 DEBUG Binder:475 - Mapped property: matrikelNummer -> MATRIKEL_NUMMER, type: integer
01:02:56,346 DEBUG Binder:1267 - Named query: personByNachname ->
from Person as obj where obj.nachname = :value

01:02:56,346 DEBUG Binder:1267 - Named query: personByVorname ->
from Person as obj where obj.vorname = :value

01:02:56,346 DEBUG Binder:1267 - Named query: personByName ->
from Person as obj where obj.nachname = :nName and obj.vorname = :vName

01:02:56,346 DEBUG Binder:1267 - Named query: personById ->
from Person as obj where obj.personId = :value

01:02:56,346 DEBUG Binder:1267 - Named query: personByUsername ->
from Person as obj where obj.username = :value

01:02:56,346 INFO Configuration:613 - processing one-to-many association mappings
01:02:56,346 INFO Configuration:622 - processing one-to-one association property references
01:02:56,356 INFO Configuration:647 - processing foreign key constraints
01:02:56,356 DEBUG Configuration:657 - resolving reference to class: Person
01:02:56,396 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
01:02:56,396 INFO SettingsFactory:62 - Use outer join fetching: true
01:02:56,396 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
01:02:56,396 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 10
01:02:56,406 INFO DriverManagerConnectionProvider:77 - using driver: org.postgresql.Driver at URL: jdbc:postgresql://127.0.0.1:5432/ref_test_db
01:02:56,406 INFO DriverManagerConnectionProvider:78 - connection properties: {user=student, password=}
01:02:56,416 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
01:02:56,416 DEBUG DriverManagerConnectionProvider:84 - total checked-out connections: 0
01:02:56,416 DEBUG DriverManagerConnectionProvider:100 - opening new JDBC connection
01:02:57,227 DEBUG DriverManagerConnectionProvider:106 - created connection to: jdbc:postgresql://127.0.0.1:5432/ref_test_db, Isolation Level: 2
01:02:57,237 DEBUG DriverManagerConnectionProvider:120 - returning connection to pool, pool size: 1
01:02:57,237 INFO SettingsFactory:102 - Use scrollable result sets: true
01:02:57,247 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false
01:02:57,247 INFO SettingsFactory:108 - Optimize cache for minimal puts: false
01:02:57,247 INFO SettingsFactory:117 - Query language substitutions: {}
01:02:57,247 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider
01:02:57,247 INFO Configuration:1093 - instantiating and configuring caches
01:02:57,457 INFO SessionFactoryImpl:119 - building session factory
01:02:57,457 DEBUG SessionFactoryImpl:125 - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=, sun.boot.library.path=C:\Programme\Java\j2re1.4.2_03\bin, java.vm.version=1.4.2_03-b02, hibernate.connection.username=student, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=CH, sun.os.patch.level=Service Pack 1, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\Dev\eclipse\workspace\ref_test, java.runtime.version=1.4.2_03-b02, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Programme\Java\j2re1.4.2_03\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOKUME~1\HSWHOM~1.C20\LOKALE~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.java2d.fontpath=, java.library.path=C:\Programme\Java\j2re1.4.2_03\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\App\ULTRAE~1;D:\Dev\cygwin\bin;D:\Dev\Java\j2sdk1.4.2_01\bin;C:\Programme\cvsnt;D:\Dev\apache-ant-1.6.1\bin;D:\App\Adabas\bin;D:\App\Adabas\pgm, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.connection.pool_size=10, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.1, user.home=C:\Dokumente und Einstellungen\hswhome.C2003054, user.timezone=Europe/Berlin, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=org.postgresql.Driver, java.class.path=D:\Dev\eclipse\workspace\ref_test\bin;C:\Programme\Java\hibernate-2.1\lib\dom4j-1.4.jar;C:\Programme\Java\hibernate-2.1\hibernate2.jar;C:\Programme\Java\hibernate-2.1\lib\commons-logging-1.0.3.jar;C:\Programme\Java\hibernate-2.1\lib\commons-collections-2.1.jar;C:\Programme\Java\hibernate-2.1\lib\ehcache-0.7.jar;C:\Programme\Java\hibernate-2.1\lib\cglib-full-2.0.1.jar;C:\Programme\Java\hibernate-2.1\lib\jta.jar;D:\Dev\Java\hibernate-2.1\lib\odmg-3.0.jar;D:\Dev\eclipse\workspace\ref_test\xml;D:\Dev\eclipse\workspace\examen_V2\lib\hsqldb.jar;D:\Dev\eclipse\workspace\ref_test\lib\log4j-1.2.8.jar, user.name=hswhome, java.vm.specification.version=1.0, java.home=C:\Programme\Java\j2re1.4.2_03, sun.arch.data.model=32, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql://127.0.0.1:5432/ref_test_db, user.language=de, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2_03, java.ext.dirs=C:\Programme\Java\j2re1.4.2_03\lib\ext, sun.boot.class.path=C:\Programme\Java\j2re1.4.2_03\lib\rt.jar;C:\Programme\Java\j2re1.4.2_03\lib\sunrsasign.jar;C:\Programme\Java\j2re1.4.2_03\lib\jsse.jar;C:\Programme\Java\j2re1.4.2_03\lib\jce.jar;C:\Programme\Java\j2re1.4.2_03\lib\ext\Coroutine4Java.jar;C:\Programme\Java\j2re1.4.2_03\lib\ext\dnsns.jar;C:\Programme\Java\j2re1.4.2_03\lib\ext\jdom.jar;C:\Programme\Java\j2re1.4.2_03\lib\ext\ldapsec.jar;C:\Programme\Java\j2re1.4.2_03\lib\ext\oncrpc.jar;C:\Programme\Java\j2re1.4.2_03\lib\ext\pg74.214.jdbc3.jar;C:\Programme\Java\j2re1.4.2_03\lib\ext\sunjce_provider.jar;D:\Dev\eclipse\workspace\schule\lib\commons-lang-1.0.1.jar, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.cpu.isalist=pentium i486 i386}
01:02:57,808 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
01:02:57,808 DEBUG SessionFactoryObjectFactory:76 - registered: 402881a2ff0ea24a00ff0ea24c060000 (unnamed)
01:02:57,808 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
01:02:57,808 DEBUG SessionFactoryImpl:196 - instantiated session factory
01:02:57,868 DEBUG SessionImpl:555 - opened session
01:02:57,868 DEBUG JDBCTransaction:37 - begin
01:02:57,868 DEBUG DriverManagerConnectionProvider:84 - total checked-out connections: 0
01:02:57,878 DEBUG DriverManagerConnectionProvider:90 - using pooled JDBC connection, pool size: 0
01:02:57,888 DEBUG JDBCTransaction:41 - current autocommit status:false
01:02:57,888 DEBUG DriverManagerConnectionProvider:84 - total checked-out connections: 1
01:02:57,888 DEBUG DriverManagerConnectionProvider:100 - opening new JDBC connection
01:02:57,948 DEBUG DriverManagerConnectionProvider:106 - created connection to: jdbc:postgresql://127.0.0.1:5432/ref_test_db, Isolation Level: 2
01:02:57,998 DEBUG DriverManagerConnectionProvider:120 - returning connection to pool, pool size: 1
01:02:57,998 DEBUG TableHiLoGenerator:62 - new hi value: 33
01:02:57,998 DEBUG SessionImpl:778 - generated identifier: 1081345
01:02:57,998 DEBUG SessionImpl:825 - saving [Student#1081345]
01:02:58,008 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,008 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,008 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,008 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,008 DEBUG SessionImpl:1386 - saveOrUpdate() unsaved instance
01:02:58,008 DEBUG DriverManagerConnectionProvider:84 - total checked-out connections: 1
01:02:58,008 DEBUG DriverManagerConnectionProvider:90 - using pooled JDBC connection, pool size: 0
01:02:58,058 DEBUG DriverManagerConnectionProvider:120 - returning connection to pool, pool size: 1
01:02:58,058 DEBUG TableHiLoGenerator:62 - new hi value: 34
01:02:58,058 DEBUG SessionImpl:778 - generated identifier: 1114113
01:02:58,058 DEBUG SessionImpl:825 - saving [Adresse#1114113]
01:02:58,058 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,058 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,058 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,058 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,058 DEBUG SessionImpl:1386 - saveOrUpdate() unsaved instance
01:02:58,058 DEBUG DriverManagerConnectionProvider:84 - total checked-out connections: 1
01:02:58,058 DEBUG DriverManagerConnectionProvider:90 - using pooled JDBC connection, pool size: 0
01:02:58,108 DEBUG DriverManagerConnectionProvider:120 - returning connection to pool, pool size: 1
01:02:58,118 DEBUG TableHiLoGenerator:62 - new hi value: 35
01:02:58,118 DEBUG SessionImpl:778 - generated identifier: 1146881
01:02:58,118 DEBUG SessionImpl:825 - saving [Kontakt#1146881]
01:02:58,118 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,118 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,118 DEBUG SessionImpl:778 - generated identifier: 1081346
01:02:58,118 DEBUG SessionImpl:825 - saving [Student#1081346]
01:02:58,118 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,118 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,118 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,118 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,118 DEBUG SessionImpl:1386 - saveOrUpdate() unsaved instance
01:02:58,118 DEBUG SessionImpl:778 - generated identifier: 1114114
01:02:58,118 DEBUG SessionImpl:825 - saving [Adresse#1114114]
01:02:58,118 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,118 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,118 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,118 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,128 DEBUG SessionImpl:1386 - saveOrUpdate() unsaved instance
01:02:58,128 DEBUG SessionImpl:778 - generated identifier: 1146882
01:02:58,128 DEBUG SessionImpl:825 - saving [Kontakt#1146882]
01:02:58,128 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,128 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,128 DEBUG SessionImpl:778 - generated identifier: 1081347
01:02:58,128 DEBUG SessionImpl:825 - saving [Student#1081347]
01:02:58,128 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,128 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,128 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,128 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,128 DEBUG SessionImpl:1386 - saveOrUpdate() unsaved instance
01:02:58,128 DEBUG SessionImpl:778 - generated identifier: 1114115
01:02:58,128 DEBUG SessionImpl:825 - saving [Adresse#1114115]
01:02:58,128 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,128 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,128 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,128 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,128 DEBUG SessionImpl:1386 - saveOrUpdate() unsaved instance
01:02:58,138 DEBUG SessionImpl:778 - generated identifier: 1146883
01:02:58,138 DEBUG SessionImpl:825 - saving [Kontakt#1146883]
01:02:58,138 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,138 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,138 DEBUG JDBCTransaction:59 - commit
01:02:58,138 DEBUG SessionImpl:2242 - flushing session
01:02:58,138 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,138 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,138 DEBUG SessionImpl:1371 - saveOrUpdate() persistent instance
01:02:58,138 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,138 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,138 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,138 DEBUG SessionImpl:1371 - saveOrUpdate() persistent instance
01:02:58,138 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,138 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,138 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,138 DEBUG SessionImpl:1371 - saveOrUpdate() persistent instance
01:02:58,138 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,148 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,148 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,148 DEBUG SessionImpl:1371 - saveOrUpdate() persistent instance
01:02:58,148 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,148 DEBUG Cascades:497 - processing cascades for: Student
01:02:58,148 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,148 DEBUG SessionImpl:1371 - saveOrUpdate() persistent instance
01:02:58,148 DEBUG Cascades:506 - done processing cascades for: Student
01:02:58,148 DEBUG Cascades:497 - processing cascades for: Adresse
01:02:58,148 DEBUG Cascades:113 - cascading to saveOrUpdate()
01:02:58,148 DEBUG SessionImpl:1371 - saveOrUpdate() persistent instance
01:02:58,148 DEBUG Cascades:506 - done processing cascades for: Adresse
01:02:58,148 DEBUG SessionImpl:2435 - Flushing entities and processing referenced collections
01:02:58,148 DEBUG SessionImpl:2776 - Processing unreferenced collections
01:02:58,148 DEBUG SessionImpl:2790 - Scheduling collection removes/(re)creates/updates
01:02:58,148 DEBUG SessionImpl:2266 - Flushed: 9 insertions, 0 updates, 0 deletions to 9 objects
01:02:58,148 DEBUG SessionImpl:2271 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
01:02:58,158 DEBUG Printer:75 - listing entities:
01:02:58,158 DEBUG Printer:82 - Adresse{hausNummer=47, plz=9999, strasse=Strasse_C, ort=Stadt_3, adresseId=1114115, kontakt=Kontakt#1146883}
01:02:58,158 DEBUG Printer:82 - Student{password=pwd_user2, nachname=Waser, adresse=Adresse#1114114, username=user2, matrikelNummer=200117, personId=1081346, vorname=Ivan}
01:02:58,158 DEBUG Printer:82 - Adresse{hausNummer=12, plz=7777, strasse=Strasse_A, ort=Stadt_1, adresseId=1114113, kontakt=Kontakt#1146881}
01:02:58,158 DEBUG Printer:82 - Student{password=pwd_user1, nachname=Bucher, adresse=Adresse#1114113, username=user1, matrikelNummer=200104, personId=1081345, vorname=Daniel}
01:02:58,158 DEBUG Printer:82 - Kontakt{telefon=099 340 63 11, kontaktId=1146883, email=ursf@tic.ch}
01:02:58,158 DEBUG Printer:82 - Adresse{hausNummer=22, plz=8888, strasse=Strasse_B, ort=Stadt_2, adresseId=1114114, kontakt=Kontakt#1146882}
01:02:58,158 DEBUG Printer:82 - Kontakt{telefon=088 320 33 44, kontaktId=1146882, email=dani@dplanet.ch}
01:02:58,158 DEBUG Printer:82 - Kontakt{telefon=077 320 00 44, kontaktId=1146881, email=rolf@tic.ch}
01:02:58,158 DEBUG Printer:82 - Student{password=pwd_user3, nachname=Sicher, adresse=Adresse#1114115, username=user3, matrikelNummer=200113, personId=1081347, vorname=Beat}
01:02:58,158 DEBUG SessionImpl:2355 - executing flush
01:02:58,158 DEBUG NormalizedEntityPersister:443 - Inserting entity: [Student#1081345]
01:02:58,158 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,158 DEBUG SQL:237 - insert into t_personen (NACHNAME, VORNAME, USERNAME, PASSWORD, PERSON_ID) values (?, ?, ?, ?, ?)
01:02:58,168 DEBUG BatcherImpl:241 - preparing statement
01:02:58,168 DEBUG BatcherImpl:196 - about to open: 1 open PreparedStatements, 0 open ResultSets
01:02:58,168 DEBUG SQL:237 - insert into t_studierende (MATRIKEL_NUMMER, STUDIERENDE_ID) values (?, ?)
01:02:58,168 DEBUG BatcherImpl:241 - preparing statement
01:02:58,168 DEBUG NormalizedEntityPersister:355 - Dehydrating entity: [Student#1081345]
01:02:58,168 DEBUG BatcherImpl:203 - done closing: 1 open PreparedStatements, 0 open ResultSets
01:02:58,178 DEBUG BatcherImpl:261 - closing statement
01:02:58,178 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,178 DEBUG BatcherImpl:261 - closing statement
01:02:58,178 DEBUG EntityPersister:453 - Inserting entity: [Adresse#1114113]
01:02:58,178 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,178 DEBUG SQL:237 - insert into t_adressen (STRASSE, HAUSNUMMER, PLZ, ORT, ADRESSE_ID) values (?, ?, ?, ?, ?)
01:02:58,178 DEBUG BatcherImpl:241 - preparing statement
01:02:58,178 DEBUG EntityPersister:388 - Dehydrating entity: [Adresse#1114113]
01:02:58,178 DEBUG BatcherImpl:28 - Adding to batch
01:02:58,178 DEBUG EntityPersister:453 - Inserting entity: [Kontakt#1146881]
01:02:58,178 DEBUG BatcherImpl:50 - Executing batch size: 1
01:02:58,178 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,178 DEBUG BatcherImpl:261 - closing statement
01:02:58,178 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,178 DEBUG SQL:237 - insert into t_kontakte (TELEFON, EMAIL, KONTAKT_ID) values (?, ?, ?)
01:02:58,188 DEBUG BatcherImpl:241 - preparing statement
01:02:58,188 DEBUG EntityPersister:388 - Dehydrating entity: [Kontakt#1146881]
01:02:58,188 DEBUG BatcherImpl:28 - Adding to batch
01:02:58,188 DEBUG NormalizedEntityPersister:443 - Inserting entity: [Student#1081346]
01:02:58,188 DEBUG BatcherImpl:50 - Executing batch size: 1
01:02:58,188 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,188 DEBUG BatcherImpl:261 - closing statement
01:02:58,188 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,188 DEBUG SQL:237 - insert into t_personen (NACHNAME, VORNAME, USERNAME, PASSWORD, PERSON_ID) values (?, ?, ?, ?, ?)
01:02:58,188 DEBUG BatcherImpl:241 - preparing statement
01:02:58,188 DEBUG BatcherImpl:196 - about to open: 1 open PreparedStatements, 0 open ResultSets
01:02:58,188 DEBUG SQL:237 - insert into t_studierende (MATRIKEL_NUMMER, STUDIERENDE_ID) values (?, ?)
01:02:58,188 DEBUG BatcherImpl:241 - preparing statement
01:02:58,188 DEBUG NormalizedEntityPersister:355 - Dehydrating entity: [Student#1081346]
01:02:58,198 DEBUG BatcherImpl:203 - done closing: 1 open PreparedStatements, 0 open ResultSets
01:02:58,198 DEBUG BatcherImpl:261 - closing statement
01:02:58,198 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,198 DEBUG BatcherImpl:261 - closing statement
01:02:58,198 DEBUG EntityPersister:453 - Inserting entity: [Adresse#1114114]
01:02:58,208 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,208 DEBUG SQL:237 - insert into t_adressen (STRASSE, HAUSNUMMER, PLZ, ORT, ADRESSE_ID) values (?, ?, ?, ?, ?)
01:02:58,208 DEBUG BatcherImpl:241 - preparing statement
01:02:58,208 DEBUG EntityPersister:388 - Dehydrating entity: [Adresse#1114114]
01:02:58,208 DEBUG BatcherImpl:28 - Adding to batch
01:02:58,208 DEBUG EntityPersister:453 - Inserting entity: [Kontakt#1146882]
01:02:58,208 DEBUG BatcherImpl:50 - Executing batch size: 1
01:02:58,218 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,218 DEBUG BatcherImpl:261 - closing statement
01:02:58,218 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,218 DEBUG SQL:237 - insert into t_kontakte (TELEFON, EMAIL, KONTAKT_ID) values (?, ?, ?)
01:02:58,218 DEBUG BatcherImpl:241 - preparing statement
01:02:58,218 DEBUG EntityPersister:388 - Dehydrating entity: [Kontakt#1146882]
01:02:58,218 DEBUG BatcherImpl:28 - Adding to batch
01:02:58,218 DEBUG NormalizedEntityPersister:443 - Inserting entity: [Student#1081347]
01:02:58,218 DEBUG BatcherImpl:50 - Executing batch size: 1
01:02:58,218 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,218 DEBUG BatcherImpl:261 - closing statement
01:02:58,228 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,228 DEBUG SQL:237 - insert into t_personen (NACHNAME, VORNAME, USERNAME, PASSWORD, PERSON_ID) values (?, ?, ?, ?, ?)
01:02:58,228 DEBUG BatcherImpl:241 - preparing statement
01:02:58,228 DEBUG BatcherImpl:196 - about to open: 1 open PreparedStatements, 0 open ResultSets
01:02:58,228 DEBUG SQL:237 - insert into t_studierende (MATRIKEL_NUMMER, STUDIERENDE_ID) values (?, ?)
01:02:58,228 DEBUG BatcherImpl:241 - preparing statement
01:02:58,228 DEBUG NormalizedEntityPersister:355 - Dehydrating entity: [Student#1081347]
01:02:58,238 DEBUG BatcherImpl:203 - done closing: 1 open PreparedStatements, 0 open ResultSets
01:02:58,238 DEBUG BatcherImpl:261 - closing statement
01:02:58,238 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,238 DEBUG BatcherImpl:261 - closing statement
01:02:58,238 DEBUG EntityPersister:453 - Inserting entity: [Adresse#1114115]
01:02:58,238 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,238 DEBUG SQL:237 - insert into t_adressen (STRASSE, HAUSNUMMER, PLZ, ORT, ADRESSE_ID) values (?, ?, ?, ?, ?)
01:02:58,238 DEBUG BatcherImpl:241 - preparing statement
01:02:58,238 DEBUG EntityPersister:388 - Dehydrating entity: [Adresse#1114115]
01:02:58,238 DEBUG BatcherImpl:28 - Adding to batch
01:02:58,238 DEBUG EntityPersister:453 - Inserting entity: [Kontakt#1146883]
01:02:58,238 DEBUG BatcherImpl:50 - Executing batch size: 1
01:02:58,238 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,238 DEBUG BatcherImpl:261 - closing statement
01:02:58,238 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,238 DEBUG SQL:237 - insert into t_kontakte (TELEFON, EMAIL, KONTAKT_ID) values (?, ?, ?)
01:02:58,238 DEBUG BatcherImpl:241 - preparing statement
01:02:58,248 DEBUG EntityPersister:388 - Dehydrating entity: [Kontakt#1146883]
01:02:58,248 DEBUG BatcherImpl:28 - Adding to batch
01:02:58,248 DEBUG BatcherImpl:50 - Executing batch size: 1
01:02:58,248 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,248 DEBUG BatcherImpl:261 - closing statement
01:02:58,248 DEBUG SessionImpl:2820 - post flush
01:02:58,319 DEBUG SessionImpl:585 - transaction completion
01:02:58,319 DEBUG SessionImpl:573 - closing session
01:02:58,319 DEBUG SessionImpl:3332 - disconnecting session
01:02:58,329 DEBUG DriverManagerConnectionProvider:120 - returning connection to pool, pool size: 2
01:02:58,329 DEBUG SessionImpl:585 - transaction completion
01:02:58,329 DEBUG SessionImpl:555 - opened session
01:02:58,329 DEBUG JDBCTransaction:37 - begin
01:02:58,329 DEBUG DriverManagerConnectionProvider:84 - total checked-out connections: 0
01:02:58,329 DEBUG DriverManagerConnectionProvider:90 - using pooled JDBC connection, pool size: 1
01:02:58,329 DEBUG JDBCTransaction:41 - current autocommit status:false
01:02:58,339 DEBUG SessionImpl:1526 - find: from Student
01:02:58,339 INFO SessionFactoryImpl:531 - closing
01:02:58,339 INFO DriverManagerConnectionProvider:143 - cleaning up connection pool: jdbc:postgresql://127.0.0.1:5432/ref_test_db
01:02:58,339 DEBUG QueryParameters:109 - named parameters: {}
01:02:58,359 DEBUG QueryTranslator:147 - compiling query
01:02:58,369 DEBUG SessionImpl:2242 - flushing session
01:02:58,369 DEBUG SessionImpl:2435 - Flushing entities and processing referenced collections
01:02:58,369 DEBUG SessionImpl:2776 - Processing unreferenced collections
01:02:58,369 DEBUG SessionImpl:2790 - Scheduling collection removes/(re)creates/updates
01:02:58,369 DEBUG SessionImpl:2266 - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
01:02:58,369 DEBUG SessionImpl:2271 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
01:02:58,369 DEBUG SessionImpl:1814 - Dont need to execute flush
01:02:58,369 DEBUG QueryTranslator:199 - HQL: from Student
01:02:58,379 DEBUG QueryTranslator:200 - SQL: select student0_.STUDIERENDE_ID as PERSON_ID, student0_.MATRIKEL_NUMMER as MATRIKEL2_3_, student0__1_.NACHNAME as NACHNAME2_, student0__1_.VORNAME as VORNAME2_, student0__1_.USERNAME as USERNAME2_, student0__1_.PASSWORD as PASSWORD2_ from t_studierende student0_ inner join t_personen student0__1_ on student0_.STUDIERENDE_ID=student0__1_.PERSON_ID
01:02:58,379 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,379 DEBUG SQL:237 - select student0_.STUDIERENDE_ID as PERSON_ID, student0_.MATRIKEL_NUMMER as MATRIKEL2_3_, student0__1_.NACHNAME as NACHNAME2_, student0__1_.VORNAME as VORNAME2_, student0__1_.USERNAME as USERNAME2_, student0__1_.PASSWORD as PASSWORD2_ from t_studierende student0_ inner join t_personen student0__1_ on student0_.STUDIERENDE_ID=student0__1_.PERSON_ID
01:02:58,379 DEBUG BatcherImpl:241 - preparing statement
01:02:58,409 DEBUG Loader:197 - processing result set
01:02:58,409 DEBUG Loader:405 - result row: 1
01:02:58,409 DEBUG Loader:536 - Initializing object from ResultSet: 1
01:02:58,409 DEBUG Loader:605 - Hydrating entity: Student#1
01:02:58,409 DEBUG Loader:405 - result row: 2
01:02:58,409 DEBUG Loader:536 - Initializing object from ResultSet: 2
01:02:58,409 DEBUG Loader:605 - Hydrating entity: Student#2
01:02:58,409 DEBUG Loader:405 - result row: 3
01:02:58,409 DEBUG Loader:536 - Initializing object from ResultSet: 3
01:02:58,409 DEBUG Loader:605 - Hydrating entity: Student#3
01:02:58,409 DEBUG Loader:405 - result row: 4
01:02:58,409 DEBUG Loader:536 - Initializing object from ResultSet: 4
01:02:58,409 DEBUG Loader:605 - Hydrating entity: Student#4
01:02:58,419 DEBUG Loader:405 - result row: 5
01:02:58,419 DEBUG Loader:536 - Initializing object from ResultSet: 5
01:02:58,419 DEBUG Loader:605 - Hydrating entity: Student#5
01:02:58,419 DEBUG Loader:405 - result row: 98305
01:02:58,419 DEBUG Loader:536 - Initializing object from ResultSet: 98305
01:02:58,419 DEBUG Loader:605 - Hydrating entity: Student#98305
01:02:58,419 DEBUG Loader:405 - result row: 98306
01:02:58,419 DEBUG Loader:536 - Initializing object from ResultSet: 98306
01:02:58,419 DEBUG Loader:605 - Hydrating entity: Student#98306
01:02:58,419 DEBUG Loader:405 - result row: 98307
01:02:58,419 DEBUG Loader:536 - Initializing object from ResultSet: 98307
01:02:58,419 DEBUG Loader:605 - Hydrating entity: Student#98307
01:02:58,419 DEBUG Loader:405 - result row: 98308
01:02:58,429 DEBUG Loader:536 - Initializing object from ResultSet: 98308
01:02:58,429 DEBUG Loader:605 - Hydrating entity: Student#98308
01:02:58,429 DEBUG Loader:405 - result row: 98309
01:02:58,429 DEBUG Loader:536 - Initializing object from ResultSet: 98309
01:02:58,429 DEBUG Loader:605 - Hydrating entity: Student#98309
01:02:58,439 DEBUG Loader:405 - result row: 196609
01:02:58,439 DEBUG Loader:536 - Initializing object from ResultSet: 196609
01:02:58,439 DEBUG Loader:605 - Hydrating entity: Student#196609
01:02:58,439 DEBUG Loader:405 - result row: 196610
01:02:58,439 DEBUG Loader:536 - Initializing object from ResultSet: 196610
01:02:58,439 DEBUG Loader:605 - Hydrating entity: Student#196610
01:02:58,439 DEBUG Loader:405 - result row: 196611
01:02:58,449 DEBUG Loader:536 - Initializing object from ResultSet: 196611
01:02:58,449 DEBUG Loader:605 - Hydrating entity: Student#196611
01:02:58,449 DEBUG Loader:405 - result row: 196612
01:02:58,449 DEBUG Loader:536 - Initializing object from ResultSet: 196612
01:02:58,449 DEBUG Loader:605 - Hydrating entity: Student#196612
01:02:58,449 DEBUG Loader:405 - result row: 196613
01:02:58,449 DEBUG Loader:536 - Initializing object from ResultSet: 196613
01:02:58,449 DEBUG Loader:605 - Hydrating entity: Student#196613
01:02:58,449 DEBUG Loader:405 - result row: 294913
01:02:58,449 DEBUG Loader:536 - Initializing object from ResultSet: 294913
01:02:58,449 DEBUG Loader:605 - Hydrating entity: Student#294913
01:02:58,449 DEBUG Loader:405 - result row: 294914
01:02:58,449 DEBUG Loader:536 - Initializing object from ResultSet: 294914
01:02:58,449 DEBUG Loader:605 - Hydrating entity: Student#294914
01:02:58,449 DEBUG Loader:405 - result row: 294915
01:02:58,449 DEBUG Loader:536 - Initializing object from ResultSet: 294915
01:02:58,449 DEBUG Loader:605 - Hydrating entity: Student#294915
01:02:58,449 DEBUG Loader:405 - result row: 294916
01:02:58,459 DEBUG Loader:536 - Initializing object from ResultSet: 294916
01:02:58,459 DEBUG Loader:605 - Hydrating entity: Student#294916
01:02:58,459 DEBUG Loader:405 - result row: 294917
01:02:58,459 DEBUG Loader:536 - Initializing object from ResultSet: 294917
01:02:58,459 DEBUG Loader:605 - Hydrating entity: Student#294917
01:02:58,459 DEBUG Loader:405 - result row: 393217
01:02:58,459 DEBUG Loader:536 - Initializing object from ResultSet: 393217
01:02:58,459 DEBUG Loader:605 - Hydrating entity: Student#393217
01:02:58,459 DEBUG Loader:405 - result row: 393218
01:02:58,459 DEBUG Loader:536 - Initializing object from ResultSet: 393218
01:02:58,459 DEBUG Loader:605 - Hydrating entity: Student#393218
01:02:58,459 DEBUG Loader:405 - result row: 393219
01:02:58,459 DEBUG Loader:536 - Initializing object from ResultSet: 393219
01:02:58,459 DEBUG Loader:605 - Hydrating entity: Student#393219
01:02:58,459 DEBUG Loader:405 - result row: 491521
01:02:58,459 DEBUG Loader:536 - Initializing object from ResultSet: 491521
01:02:58,459 DEBUG Loader:605 - Hydrating entity: Student#491521
01:02:58,459 DEBUG Loader:405 - result row: 491522
01:02:58,459 DEBUG Loader:536 - Initializing object from ResultSet: 491522
01:02:58,459 DEBUG Loader:605 - Hydrating entity: Student#491522
01:02:58,469 DEBUG Loader:405 - result row: 491523
01:02:58,469 DEBUG Loader:536 - Initializing object from ResultSet: 491523
01:02:58,469 DEBUG Loader:605 - Hydrating entity: Student#491523
01:02:58,469 DEBUG Loader:405 - result row: 589825
01:02:58,469 DEBUG Loader:536 - Initializing object from ResultSet: 589825
01:02:58,469 DEBUG Loader:605 - Hydrating entity: Student#589825
01:02:58,469 DEBUG Loader:405 - result row: 589826
01:02:58,469 DEBUG Loader:536 - Initializing object from ResultSet: 589826
01:02:58,469 DEBUG Loader:605 - Hydrating entity: Student#589826
01:02:58,469 DEBUG Loader:405 - result row: 589827
01:02:58,469 DEBUG Loader:536 - Initializing object from ResultSet: 589827
01:02:58,469 DEBUG Loader:605 - Hydrating entity: Student#589827
01:02:58,469 DEBUG Loader:405 - result row: 688129
01:02:58,469 DEBUG Loader:536 - Initializing object from ResultSet: 688129
01:02:58,469 DEBUG Loader:605 - Hydrating entity: Student#688129
01:02:58,469 DEBUG Loader:405 - result row: 688130
01:02:58,469 DEBUG Loader:536 - Initializing object from ResultSet: 688130
01:02:58,469 DEBUG Loader:605 - Hydrating entity: Student#688130
01:02:58,469 DEBUG Loader:405 - result row: 688131
01:02:58,479 DEBUG Loader:536 - Initializing object from ResultSet: 688131
01:02:58,479 DEBUG Loader:605 - Hydrating entity: Student#688131
01:02:58,479 DEBUG Loader:405 - result row: 786433
01:02:58,479 DEBUG Loader:536 - Initializing object from ResultSet: 786433
01:02:58,479 DEBUG Loader:605 - Hydrating entity: Student#786433
01:02:58,479 DEBUG Loader:405 - result row: 786434
01:02:58,479 DEBUG Loader:536 - Initializing object from ResultSet: 786434
01:02:58,479 DEBUG Loader:605 - Hydrating entity: Student#786434
01:02:58,489 DEBUG Loader:405 - result row: 786435
01:02:58,489 DEBUG Loader:536 - Initializing object from ResultSet: 786435
01:02:58,489 DEBUG Loader:605 - Hydrating entity: Student#786435
01:02:58,489 DEBUG Loader:405 - result row: 884737
01:02:58,489 DEBUG Loader:536 - Initializing object from ResultSet: 884737
01:02:58,489 DEBUG Loader:605 - Hydrating entity: Student#884737
01:02:58,489 DEBUG Loader:405 - result row: 884738
01:02:58,489 DEBUG Loader:536 - Initializing object from ResultSet: 884738
01:02:58,489 DEBUG Loader:605 - Hydrating entity: Student#884738
01:02:58,489 DEBUG Loader:405 - result row: 884739
01:02:58,489 DEBUG Loader:536 - Initializing object from ResultSet: 884739
01:02:58,489 DEBUG Loader:605 - Hydrating entity: Student#884739
01:02:58,489 DEBUG Loader:405 - result row: 983041
01:02:58,489 DEBUG Loader:536 - Initializing object from ResultSet: 983041
01:02:58,489 DEBUG Loader:605 - Hydrating entity: Student#983041
01:02:58,489 DEBUG Loader:405 - result row: 983042
01:02:58,489 DEBUG Loader:536 - Initializing object from ResultSet: 983042
01:02:58,489 DEBUG Loader:605 - Hydrating entity: Student#983042
01:02:58,489 DEBUG Loader:405 - result row: 983043
01:02:58,489 DEBUG Loader:536 - Initializing object from ResultSet: 983043
01:02:58,499 DEBUG Loader:605 - Hydrating entity: Student#983043
01:02:58,499 DEBUG Loader:405 - result row: 1081345
01:02:58,499 DEBUG Loader:536 - Initializing object from ResultSet: 1081345
01:02:58,499 DEBUG Loader:605 - Hydrating entity: Student#1081345
01:02:58,499 DEBUG Loader:405 - result row: 1081346
01:02:58,499 DEBUG Loader:536 - Initializing object from ResultSet: 1081346
01:02:58,499 DEBUG Loader:605 - Hydrating entity: Student#1081346
01:02:58,499 DEBUG Loader:405 - result row: 1081347
01:02:58,499 DEBUG Loader:536 - Initializing object from ResultSet: 1081347
01:02:58,499 DEBUG Loader:605 - Hydrating entity: Student#1081347
01:02:58,499 DEBUG Loader:226 - done processing result set (44 rows)
01:02:58,499 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,499 DEBUG BatcherImpl:261 - closing statement
01:02:58,499 DEBUG Loader:239 - total objects hydrated: 44
01:02:58,499 DEBUG SessionImpl:2198 - resolving associations for [Student#1]
01:02:58,499 DEBUG SessionImpl:1982 - loading [Adresse#1]
01:02:58,499 DEBUG SessionImpl:2079 - attempting to resolve [Adresse#1]
01:02:58,499 DEBUG SessionImpl:2112 - object not resolved in any cache [Adresse#1]
01:02:58,499 DEBUG EntityPersister:416 - Materializing entity: [Adresse#1]
01:02:58,499 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,509 DEBUG SQL:237 - select adresse0_.ADRESSE_ID as ADRESSE_ID1_, adresse0_.STRASSE as STRASSE1_, adresse0_.HAUSNUMMER as HAUSNUMMER1_, adresse0_.PLZ as PLZ1_, adresse0_.ORT as ORT1_, kontakt1_.KONTAKT_ID as KONTAKT_ID0_, kontakt1_.TELEFON as TELEFON0_, kontakt1_.EMAIL as EMAIL0_ from t_adressen adresse0_ left outer join t_kontakte kontakt1_ on adresse0_.ADRESSE_ID=kontakt1_.KONTAKT_ID where adresse0_.ADRESSE_ID=?
01:02:58,509 DEBUG BatcherImpl:241 - preparing statement
01:02:58,509 DEBUG Loader:197 - processing result set
01:02:58,509 DEBUG Loader:226 - done processing result set (0 rows)
01:02:58,509 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,519 DEBUG BatcherImpl:261 - closing statement
01:02:58,519 DEBUG Loader:239 - total objects hydrated: 0
01:02:58,519 DEBUG SessionImpl:2222 - done materializing entity [Student#1]
01:02:58,519 DEBUG SessionImpl:2198 - resolving associations for [Student#2]
01:02:58,519 DEBUG SessionImpl:1982 - loading [Adresse#2]
01:02:58,519 DEBUG SessionImpl:2079 - attempting to resolve [Adresse#2]
01:02:58,519 DEBUG SessionImpl:2112 - object not resolved in any cache [Adresse#2]
01:02:58,519 DEBUG EntityPersister:416 - Materializing entity: [Adresse#2]
01:02:58,519 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,519 DEBUG SQL:237 - select adresse0_.ADRESSE_ID as ADRESSE_ID1_, adresse0_.STRASSE as STRASSE1_, adresse0_.HAUSNUMMER as HAUSNUMMER1_, adresse0_.PLZ as PLZ1_, adresse0_.ORT as ORT1_, kontakt1_.KONTAKT_ID as KONTAKT_ID0_, kontakt1_.TELEFON as TELEFON0_, kontakt1_.EMAIL as EMAIL0_ from t_adressen adresse0_ left outer join t_kontakte kontakt1_ on adresse0_.ADRESSE_ID=kontakt1_.KONTAKT_ID where adresse0_.ADRESSE_ID=?
01:02:58,519 DEBUG BatcherImpl:241 - preparing statement
01:02:58,519 DEBUG Loader:197 - processing result set
01:02:58,539 DEBUG Loader:226 - done processing result set (0 rows)
01:02:58,539 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,539 DEBUG BatcherImpl:261 - closing statement
01:02:58,549 DEBUG Loader:239 - total objects hydrated: 0
01:02:58,549 DEBUG SessionImpl:2222 - done materializing entity [Student#2]
01:02:58,549 DEBUG SessionImpl:2198 - resolving associations for [Student#3]
01:02:58,549 DEBUG SessionImpl:1982 - loading [Adresse#3]
01:02:58,549 DEBUG SessionImpl:2079 - attempting to resolve [Adresse#3]
01:02:58,549 DEBUG SessionImpl:2112 - object not resolved in any cache [Adresse#3]
01:02:58,549 DEBUG EntityPersister:416 - Materializing entity: [Adresse#3]
01:02:58,549 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,549 DEBUG SQL:237 - select adresse0_.ADRESSE_ID as ADRESSE_ID1_, adresse0_.STRASSE as STRASSE1_, adresse0_.HAUSNUMMER as HAUSNUMMER1_, adresse0_.PLZ as PLZ1_, adresse0_.ORT as ORT1_, kontakt1_.KONTAKT_ID as KONTAKT_ID0_, kontakt1_.TELEFON as TELEFON0_, kontakt1_.EMAIL as EMAIL0_ from t_adressen adresse0_ left outer join t_kontakte kontakt1_ on adresse0_.ADRESSE_ID=kontakt1_.KONTAKT_ID where adresse0_.ADRESSE_ID=?
01:02:58,549 DEBUG BatcherImpl:241 - preparing statement
01:02:58,549 DEBUG Loader:197 - processing result set
01:02:58,549 DEBUG Loader:226 - done processing result set (0 rows)
01:02:58,549 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,549 DEBUG BatcherImpl:261 - closing statement
01:02:58,559 DEBUG Loader:239 - total objects hydrated: 0
01:02:58,559 DEBUG SessionImpl:2222 - done materializing entity [Student#3]
01:02:58,559 DEBUG SessionImpl:2198 - resolving associations for [Student#4]
01:02:58,559 DEBUG SessionImpl:1982 - loading [Adresse#4]
01:02:58,559 DEBUG SessionImpl:2079 - attempting to resolve [Adresse#4]
01:02:58,559 DEBUG SessionImpl:2112 - object not resolved in any cache [Adresse#4]
01:02:58,559 DEBUG EntityPersister:416 - Materializing entity: [Adresse#4]
01:02:58,559 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,559 DEBUG SQL:237 - select adresse0_.ADRESSE_ID as ADRESSE_ID1_, adresse0_.STRASSE as STRASSE1_, adresse0_.HAUSNUMMER as HAUSNUMMER1_, adresse0_.PLZ as PLZ1_, adresse0_.ORT as ORT1_, kontakt1_.KONTAKT_ID as KONTAKT_ID0_, kontakt1_.TELEFON as TELEFON0_, kontakt1_.EMAIL as EMAIL0_ from t_adressen adresse0_ left outer join t_kontakte kontakt1_ on adresse0_.ADRESSE_ID=kontakt1_.KONTAKT_ID where adresse0_.ADRESSE_ID=?
01:02:58,559 DEBUG BatcherImpl:241 - preparing statement
01:02:58,559 DEBUG Loader:197 - processing result set
01:02:58,569 DEBUG Loader:226 - done processing result set (0 rows)
01:02:58,569 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,569 DEBUG BatcherImpl:261 - closing statement
01:02:58,569 DEBUG Loader:239 - total objects hydrated: 0
01:02:58,569 DEBUG SessionImpl:2222 - done materializing entity [Student#4]
01:02:58,569 DEBUG SessionImpl:2198 - resolving associations for [Student#5]
01:02:58,569 DEBUG SessionImpl:1982 - loading [Adresse#5]
01:02:58,569 DEBUG SessionImpl:2079 - attempting to resolve [Adresse#5]
01:02:58,569 DEBUG SessionImpl:2112 - object not resolved in any cache [Adresse#5]
01:02:58,569 DEBUG EntityPersister:416 - Materializing entity: [Adresse#5]
01:02:58,569 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,569 DEBUG SQL:237 - select adresse0_.ADRESSE_ID as ADRESSE_ID1_, adresse0_.STRASSE as STRASSE1_, adresse0_.HAUSNUMMER as HAUSNUMMER1_, adresse0_.PLZ as PLZ1_, adresse0_.ORT as ORT1_, kontakt1_.KONTAKT_ID as KONTAKT_ID0_, kontakt1_.TELEFON as TELEFON0_, kontakt1_.EMAIL as EMAIL0_ from t_adressen adresse0_ left outer join t_kontakte kontakt1_ on adresse0_.ADRESSE_ID=kontakt1_.KONTAKT_ID where adresse0_.ADRESSE_ID=?
01:02:58,569 DEBUG BatcherImpl:241 - preparing statement
01:02:58,569 DEBUG Loader:197 - processing result set
01:02:58,579 DEBUG Loader:226 - done processing result set (0 rows)
01:02:58,579 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
01:02:58,579 DEBUG BatcherImpl:261 - closing statement
01:02:58,579 DEBUG Loader:239 - total objects hydrated: 0
01:02:58,579 DEBUG SessionImpl:2222 - done materializing entity [Student#5]
01:02:58,579 DEBUG SessionImpl:2198 - resolving associations for [Student#98305]
01:02:58,579 DEBUG SessionImpl:1982 - loading [Adresse#98305]
01:02:58,579 DEBUG SessionImpl:2079 - attempting to resolve [Adresse#98305]
01:02:58,579 DEBUG SessionImpl:2112 - object not resolved in any cache [Adresse#98305]
01:02:58,579 DEBUG EntityPersister:416 - Materializing entity: [Adresse#98305]
01:02:58,579 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
01:02:58,579 DEBUG SQL:237 - select adresse0_.ADRESSE_ID as ADRESSE_ID1_, adresse0_.STRASSE as STRASSE1_, adresse0_.HAUSNUMMER as HAUSNUMMER1_, adresse0_.PLZ as PLZ1_, adresse0_.ORT as ORT1_, kontakt1_.KONTAKT_ID as KONTAKT_ID0_, kontakt1_.TELEFON as TELEFON0_, kontakt1_.EMAIL as EMAIL0_ from t_adress


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 18, 2004 5:24 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
The only thing I can say from the stacktrace is your Person.toString() method relies on a property which is NULL - hence causing the NullPointerException.

Unfortunately, you didn't provide the Person implementation code, so I can't tell you which property is causing the exception.

Are you sure this property is initialized?
Are you sure it is persisted?
Do you experience the same problem when calling toString() on the same instances at the time you create them?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 19, 2004 2:58 am 
Beginner
Beginner

Joined: Sun Apr 04, 2004 8:45 am
Posts: 20
Thanks for your answer, bertrand.

Quote:
Unfortunately, you didn't provide the Person implementation code, so I can't tell you which property is causing the exception.


Here are the classes:
Code:
/* Created on 24.07.2004 */
import java.io.Serializable;

public class Person implements Serializable, Comparable
{
    private Long personId;
    private Adresse adresse;
    private String nachname;
    private String vorname;
    private String username;
    private String password;

    public Person()
    {
    }

    /**
     * @param adresse Adresse
     * @param nachname String
     * @param vorname String
     */
    public Person(Adresse adresse, String nachname, String vorname)
    {
        this.adresse = adresse;
        this.nachname = nachname;
        this.vorname = vorname;
    }

    /**
     * @return personId Long
     */
    public Long getPersonId()
    {
        return personId;
    }

    /**
     * @param personId Long
     */
    private void setPersonId(Long personId)
    {
        this.personId = personId;
    }

    /**
     * @return adresse Adresse
     */
    public Adresse getAdresse()
    {
        return adresse;
    }

    /**
     * @param adresse Adresse
     */
    public void setAdresse(Adresse adresse)
    {
        this.adresse = adresse;
    }

    /**
     * @return nachname String
     */
    public String getNachname()
    {
        return nachname;
    }

    /**
     * @param nachname String
     */
    public void setNachname(String nachname)
    {
        this.nachname = nachname;
    }

    /**
     * @return vorname String
     */
    public String getVorname()
    {
        return vorname;
    }

    /**
     * @param vorname String
     */
    public void setVorname(String vorname)
    {
        this.vorname = vorname;
    }

    /**
     * @return password String
     */
    public String getPassword()
    {
        return password;
    }

    /**
     * @param password String
     */
    public void setPassword(String password)
    {
        this.password = password;
    }

    /**
     * @return username String
     */
    public String getUsername()
    {
        return username;
    }

    /**
     * @param username String
     */
    public void setUsername(String username)
    {
        this.username = username;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object param)
    {
        if (this == param)
        {
            return true;
        }
        if (!(param instanceof Person))
        {
            return false;
        }

        final Person tmp = (Person)param;
       
        return nachname.equals(tmp.nachname)
                && vorname.equals(tmp.vorname)
                && adresse.equals(tmp.adresse);
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#hashCode()
     */
    public int hashCode()
    {

        return nachname.hashCode() + vorname.hashCode() + username.hashCode() + password.hashCode();
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        return nachname + " " + vorname + "\n" + adresse.toString();
    }


Code:
/* Created on 24.07.2004 */

public class Student extends Person
{
    private int matrikelNummer;
    /** Standard-Konstruktor */
    public Student()
    {
     
    }

    /**
     * Parametrisierter Konstruktor
     *
     * @param nachname String
     * @param vorname String
     * @param adresse Adresse
     * @param matrikelNummer int
     */
    public Student(String nachname, String vorname, Adresse adresse,
            int matrikelNummer)
    {
        super(adresse, nachname, vorname);
        this.matrikelNummer = matrikelNummer;
    }



    /**
     * @return matrikelNummer int
     */
    public int getMatrikelNummer()
    {
        return matrikelNummer;
    }

    /**
     * @param matrikelNummer int
     */
    public void setMatrikelNummer(int matrikelNummer)
    {
        this.matrikelNummer = matrikelNummer;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object param)
    {
        if (this == param)
        {
            return true;
        }

        if (!(param instanceof Student))
        {
            return false;
        }

        final Student tmp = (Student) param;

        return super.equals(param) && matrikelNummer == tmp.matrikelNummer;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#hashCode()
     */
    public int hashCode()
    {
        return matrikelNummer;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        return super.toString() + ", Matrikelnummer: " + matrikelNummer;
    }
}


Code:
/* Created on 24.07.2004 */

import java.io.Serializable;

public class Adresse implements Serializable, Comparable
{
    private Long adresseId;
    private String strasse;
    private long hausNummer;
    private long plz;
    private String ort;
    private Kontakt kontakt;

    public Adresse()
    {
    }

    /**
     * @param strasse String
     * @param hausNummer long
     * @param plz long
     * @param ort String
     * @param kontakt Kontakt
     */
    public Adresse(String strasse, long hausNummer, long plz, String ort,
            Kontakt kontakt)
    {
        this.strasse = strasse;
        this.hausNummer = hausNummer;
        this.plz = plz;
        this.ort = ort;
        this.kontakt = kontakt;
    }

    /**
     * @return adresseId Long
     */
    public Long getAdresseId()
    {
        return adresseId;
    }

    /**
     * @param adresseId Long
     */
    private void setAdresseId(Long adresseId)
    {
        this.adresseId = adresseId;
    }

    /**
     * @return hausNummer long
     */
    public long getHausNummer()
    {
        return hausNummer;
    }

    /**
     * @param hausNummer long
     */
    public void setHausNummer(long hausNummer)
    {
        this.hausNummer = hausNummer;
    }

    /**
     * @return ort String
     */
    public String getOrt()
    {
        return ort;
    }

    /**
     * @param ort String
     */
    public void setOrt(String ort)
    {
        this.ort = ort;
    }

    /**
     * @return plz long
     */
    public long getPlz()
    {
        return plz;
    }

    /**
     * @param plz long
     */
    public void setPlz(long plz)
    {
        this.plz = plz;
    }

    /**
     * @return strasse String
     */
    public String getStrasse()
    {
        return strasse;
    }

    /**
     * @param strasse String
     */
    public void setStrasse(String strasse)
    {
        this.strasse = strasse;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object param)
    {
        if (this == param)
        {
            return true;
        }

        if (!(param instanceof Adresse))
        {
            return false;
        }

        final Adresse tmp = (Adresse) param;

        return strasse.equals(tmp.strasse) && hausNummer == tmp.hausNummer
                && plz == tmp.plz && ort.equals(tmp.ort)
                && kontakt.equals(tmp.kontakt);
    }

    /**
     * @return kontakt Kontakt
     */
    public Kontakt getKontakt()
    {
        return kontakt;
    }

    /**
     * @param kontakt Kontakt
     */
    public void setKontakt(Kontakt kontakt)
    {
        this.kontakt = kontakt;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#hashCode()
     */
    public int hashCode()
    {
        return (int) hausNummer + (int) plz + strasse.hashCode();
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        String str = "Adresse: ";
        str += strasse + " " + hausNummer + ", " + plz + " - " + ort;
        str += ", " + kontakt.toString();

        return str;
    }
}


Code:
/* Created on 30.08.2004 */
/** @author Jordan Sucur */
public class Kontakt implements java.io.Serializable
{
    private Long kontaktId;
    private String telefon;
    private String email;

    /** Standardkonstruktor */
    public Kontakt()
    {
    }

    /**
     * @param telefon String
     * @param email String
     */
    public Kontakt(String telefon, String email)
    {
        this.telefon = telefon;
        this.email = email;
    }

    /**
     * @return email String
     */
    public String getEmail()
    {
        return email;
    }

    /**
     * @param email String
     */
    public void setEmail(String email)
    {
        this.email = email;
    }

    /**
     * @return kontaktId Long
     */
    public Long getKontaktId()
    {
        return kontaktId;
    }

    /**
     * @param kontaktId Long
     */
    private void setKontaktId(Long kontaktId)
    {
        this.kontaktId = kontaktId;
    }

    /**
     * @return telefon String
     */
    public String getTelefon()
    {
        return telefon;
    }

    /**
     * @param telefon String
     */
    public void setTelefon(String telefon)
    {
        this.telefon = telefon;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object param)
    {
        if (this == param)
        {
            return true;
        }

        if (!(param instanceof Kontakt))
        {
            return false;
        }

        final Kontakt tmp = (Kontakt) param;

        return telefon.equals(tmp.telefon) && email.equals(tmp.email);
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#hashCode()
     */
    public int hashCode()
    {
        return telefon.hashCode() + email.hashCode();
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        return "Telefon: " + telefon + ", Email: " + email;
    }
}


The property 'addrresse' causes the NullPointerException by trying to access it in the method toString of the class Person.

Quote:
Are you sure this property is initialized?

Yes. See the following code:
Code:
Adresse adr1 = new Adresse("Strasse_A", 12, 7777, "Stadt_1",
                    new Kontakt("077 320 00 44", "rolf@tic.ch"));
            Adresse adr2 = new Adresse("Strasse_B", 22, 8888, "Stadt_2",
                    new Kontakt("088 320 33 44", "dani@dplanet.ch"));
            Adresse adr3 = new Adresse("Strasse_C", 47, 9999, "Stadt_3",
                    new Kontakt("099 340 63 11", "ursf@tic.ch"));   

Student std1 = new Student("Bucher", "Daniel", adr1, 200104);
            Student std2 = new Student("Waser", "Ivan", adr2, 200117);
            Student std3 = new Student("Sicher", "Beat", adr3, 200113);


Quote:
Are you sure it is persisted?

Yes. I persist the student object and I expect that all parts of this object are written to the database. And I see these all in the database too.



Quote:
Do you experience the same problem when calling toString() on the same instances at the time you create them?

If I use the same session, it works. After I close the persisting session and open a new session, it doesn't work.

I hope, you see something more in my code. Thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 19, 2004 4:10 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Basically, the persistence for the Adresse is not working properly. I believe the problem comes from the one-to-one mapping you have been using.

Check the doc and you will see:

Primary key associations don't need an extra table column; if two rows are related by the association then the two table rows share the same primary key value. So if you want two objects to be related by a primary key association, you must make sure that they are assigned the same identifier value!


In your case, they will have different PK (because of the HILO generation)... That's probably why Hibernate doesn't find the addresse back when loading the student.

You should then use the special Hibernate identifier generation strategy called foreign as explained in


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 19, 2004 7:59 pm 
Beginner
Beginner

Joined: Sun Apr 04, 2004 8:45 am
Posts: 20
You are right. My mapping was wrong.

Thanks a lot for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.