-->
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.  [ 7 posts ] 
Author Message
 Post subject: One-To-Many Beziehung
PostPosted: Wed Mar 01, 2006 8:26 pm 
Newbie

Joined: Wed Mar 01, 2006 8:02 pm
Posts: 3
Hallo,

habe grade erst mit Hibernate angefangen und wollte mal eine einfache One-To-Many Beziehung versuchen. Leider klappt das nicht. Die Tabellen und Objekt werden angelegt und gespeichert. Leider klappt der Set aufruf nicht, der mir die verschiedenen Objekt geben sollte. (User 1 = n Nachrichten)

User Mapping:
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>
    <class name="example.user.User" table="USERS">
   
       <id name="id" column="USER_ID">
            <generator class="native"/>
        </id>
      <property name="nickname"       column="USER_NICKNAME"       length="50"    not-null="true" />
      <property name="email"          column="USER_EMAIL"       length="100"    not-null="true" />
      <property name="passwort"       column="USER_PASSWORT"       length="50"    not-null="true" />
      <property name="registriert"    column="USER_REGISTRIERT"    type="timestamp" />   
      
      <set name="messages" table="USER_MESSAGES" order-by="MESSAGE_GESCHRIEBEN ASC" inverse="true">
       <key column="MESSAGE_BENUTZER_ID" />
       <one-to-many class="example.messages.Message"/>
      </set>
    
    </class>
   </hibernate-mapping>


User_Message mapping:

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>
    <class name="example.messages.Message" table="USER_MESSAGES">
   
       <id name="id" column="MESSAGE_ID">
            <generator class="native"/>
        </id>
       
      <property name="title" column="MESSAGE_TITLE" length="100" not-null="true" />
      <property name="inhalt" column="MESSAGE_INHALT" length="1000" not-null="true" />
      <property name="geschrieben" column="MESSAGE_GESCHRIEBEN" type="timestamp" />   
          
      <many-to-one name="benutzerId" class="example.user.User" column="MESSAGE_USER_ID" not-null="true"/>
    
    </class>
   </hibernate-mapping>


Hier der Code der User Klasse:

Code:
package example.user;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import org.apache.log4j.Logger;

public class User {
   
   private static Logger log = Logger.getLogger(User.class);
   
   private int id;
   private String nickname;
   private String email;
   private String passwort;
   private Date registriert;
   
   private Set messages = new HashSet();
   
   public Set getMessages() {
      log.info("getMessages");
      return messages;
   }

   public void setMessages(Set messages) {
      log.info("setMessages");
      this.messages = messages;
   }

}


Die Objekte werden erfolgreich gespeichert und die Id der Benutzer steht auch bei den Nachrichten. Nur der aufruf der User.getMessages(); liefert kein ergebnis zurück. Es wird einfach ein Set Objekt mit 0 Datensätzen zurück gegeben. Hat einer ne Idee was ich falsch mache.

Habe mich an: http://www.xylax.net/hibernate/onetomany.html orientiert.

Danke im vorraus


Last edited by RooKee on Thu Mar 02, 2006 6:17 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 5:28 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
ich glaub du hast das mapping von message vergessen (und user zwei mal gepostet).

Ausserdem wäre ein log auf debug level noch hilfreich

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 6:22 am 
Newbie

Joined: Wed Mar 01, 2006 8:02 pm
Posts: 3
Oh ^^

Habs nochmal editiert.


Hier die Logausgaben im DEBUG:

Code:
0     [main] INFO  example.user.User  - User
0     [main] DEBUG example.user.UserBO  - Storing User: example.user.User@4a65e0
46    [main] INFO  org.hibernate.cfg.Environment  - Hibernate 3.1
46    [main] INFO  org.hibernate.cfg.Environment  - hibernate.properties not found
46    [main] INFO  org.hibernate.cfg.Environment  - using CGLIB reflection optimizer
46    [main] INFO  org.hibernate.cfg.Environment  - using JDK 1.4 java.sql.Timestamp handling
125   [main] INFO  org.hibernate.cfg.Configuration  - configuring from resource: /hibernate.cfg.xml
125   [main] INFO  org.hibernate.cfg.Configuration  - Configuration resource: /hibernate.cfg.xml
187   [main] DEBUG org.hibernate.util.DTDEntityResolver  - trying to locate http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath under org/hibernate/
187   [main] DEBUG org.hibernate.util.DTDEntityResolver  - found http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath
234   [main] DEBUG org.hibernate.cfg.Configuration  - connection.driver_class=com.mysql.jdbc.Driver
234   [main] DEBUG org.hibernate.cfg.Configuration  - connection.url=jdbc:mysql://127.0.0.1:3306/hibernate_example
234   [main] DEBUG org.hibernate.cfg.Configuration  - connection.username=root
234   [main] DEBUG org.hibernate.cfg.Configuration  - connection.password=root
234   [main] DEBUG org.hibernate.cfg.Configuration  - cache.provider_class=org.hibernate.cache.NoCacheProvider
234   [main] DEBUG org.hibernate.cfg.Configuration  - current_session_context_class=thread
234   [main] DEBUG org.hibernate.cfg.Configuration  - show_sql=true
234   [main] DEBUG org.hibernate.cfg.Configuration  - hbm2ddl.auto=create
234   [main] DEBUG org.hibernate.cfg.Configuration  - dialect=org.hibernate.dialect.MySQLDialect
234   [main] DEBUG org.hibernate.cfg.Configuration  - null<-org.dom4j.tree.DefaultAttribute@117a8bd [Attribute: name resource value "example/user/User.hbm.xml"]
234   [main] INFO  org.hibernate.cfg.Configuration  - Reading mappings from resource: example/user/User.hbm.xml
234   [main] DEBUG org.hibernate.util.DTDEntityResolver  - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
234   [main] DEBUG org.hibernate.util.DTDEntityResolver  - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
343   [main] INFO  org.hibernate.cfg.HbmBinder  - Mapping class: example.user.User -> USERS
359   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: id -> USER_ID
375   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: nickname -> USER_NICKNAME
375   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: email -> USER_EMAIL
375   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: passwort -> USER_PASSWORT
390   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: registriert -> USER_REGISTRIERT
390   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: messages
390   [main] DEBUG org.hibernate.cfg.Configuration  - null<-org.dom4j.tree.DefaultAttribute@1f14ceb [Attribute: name resource value "example/messages/Message.hbm.xml"]
390   [main] INFO  org.hibernate.cfg.Configuration  - Reading mappings from resource: example/messages/Message.hbm.xml
390   [main] DEBUG org.hibernate.util.DTDEntityResolver  - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
390   [main] DEBUG org.hibernate.util.DTDEntityResolver  - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
421   [main] INFO  org.hibernate.cfg.HbmBinder  - Mapping class: example.messages.Message -> USER_MESSAGES
421   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: id -> MESSAGE_ID
437   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: title -> MESSAGE_TITLE
437   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: inhalt -> MESSAGE_INHALT
437   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: geschrieben -> MESSAGE_GESCHRIEBEN
484   [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: benutzerId -> MESSAGE_USER_ID
484   [main] INFO  org.hibernate.cfg.Configuration  - Configured SessionFactory: null
484   [main] DEBUG org.hibernate.cfg.Configuration  - properties: {hibernate.connection.password=root, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, sun.boot.library.path=C:\Programme\Java\jre1.5.0_06\bin, java.vm.version=1.5.0_06-b05, hibernate.connection.username=root, 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=DE, sun.os.patch.level=Service Pack 1, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Hibernate\Example\Hibernate Example1, java.runtime.version=1.5.0_06-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hbm2ddl.auto=create, hibernate.current_session_context_class=thread, java.endorsed.dirs=C:\Programme\Java\jre1.5.0_06\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOKUME~1\MARKUS~1\LOKALE~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., cache.provider_class=org.hibernate.cache.NoCacheProvider, user.variant=, os.name=Windows XP, sun.jnu.encoding=Cp1252, java.library.path=C:\Programme\Java\jre1.5.0_06\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Technologies\ATI.ACE\;C:\Programme\MySQL\MySQL Server 5.0\bin;C:\Programme\Ant 1.6.5/bin;C:\Programme\J2sdk1.4.2_10/bin, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, connection.password=root, user.home=C:\Dokumente und Einstellungen\Markus Unger, user.timezone=, connection.username=root, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, user.name=Markus Unger, java.class.path=C:\Hibernate\Example\Hibernate Example1\bin;C:\Hibernate\Example\Hibernate Example1\lib\antlr-2.7.6rc1.jar;C:\Hibernate\Example\Hibernate Example1\lib\asm.jar;C:\Hibernate\Example\Hibernate Example1\lib\asm-attrs.jar;C:\Hibernate\Example\Hibernate Example1\lib\cglib-2.1.3.jar;C:\Hibernate\Example\Hibernate Example1\lib\commons-collections-2.1.1.jar;C:\Hibernate\Example\Hibernate Example1\lib\commons-logging-1.0.4.jar;C:\Hibernate\Example\Hibernate Example1\lib\dom4j-1.6.1.jar;C:\Hibernate\Example\Hibernate Example1\lib\hibernate3.jar;C:\Hibernate\Example\Hibernate Example1\lib\jta.jar;C:\Hibernate\Example\Hibernate Example1\lib\log4j-1.2.11.jar;C:\Hibernate\Example\Hibernate Example1\lib\mysql-connector-java-3.1.12-bin.jar, hibernate.show_sql=true, current_session_context_class=thread, java.vm.specification.version=1.0, java.home=C:\Programme\Java\jre1.5.0_06, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://127.0.0.1:3306/hibernate_example, 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, sharing, java.version=1.5.0_06, java.ext.dirs=C:\Programme\Java\jre1.5.0_06\lib\ext, sun.boot.class.path=C:\Programme\Java\jre1.5.0_06\lib\rt.jar;C:\Programme\Java\jre1.5.0_06\lib\i18n.jar;C:\Programme\Java\jre1.5.0_06\lib\sunrsasign.jar;C:\Programme\Java\jre1.5.0_06\lib\jsse.jar;C:\Programme\Java\jre1.5.0_06\lib\jce.jar;C:\Programme\Java\jre1.5.0_06\lib\charsets.jar;C:\Programme\Java\jre1.5.0_06\classes, java.vendor=Sun Microsystems Inc., connection.driver_class=com.mysql.jdbc.Driver, file.separator=\, hibernate.hbm2ddl.auto=create, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, connection.url=jdbc:mysql://127.0.0.1:3306/hibernate_example, dialect=org.hibernate.dialect.MySQLDialect, sun.cpu.isalist=}
484   [main] DEBUG org.hibernate.cfg.Configuration  - Preparing to build session factory with filters : {}
484   [main] INFO  org.hibernate.cfg.Configuration  - processing extends queue
484   [main] INFO  org.hibernate.cfg.Configuration  - processing collection mappings
484   [main] DEBUG org.hibernate.cfg.CollectionSecondPass  - Second pass for collection: example.user.User.messages
484   [main] INFO  org.hibernate.cfg.HbmBinder  - Mapping collection: example.user.User.messages -> USER_MESSAGES
484   [main] DEBUG org.hibernate.cfg.CollectionSecondPass  - Mapped collection key: USER_ID, one-to-many: example.messages.Message
484   [main] INFO  org.hibernate.cfg.Configuration  - processing association property references
484   [main] INFO  org.hibernate.cfg.Configuration  - processing foreign key constraints
484   [main] DEBUG org.hibernate.cfg.Configuration  - resolving reference to class: example.user.User
484   [main] DEBUG org.hibernate.cfg.Configuration  - resolving reference to class: example.user.User
500   [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - Using Hibernate built-in connection pool (not for production use!)
515   [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - Hibernate connection pool size: 20
515   [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - autocommit mode: false
515   [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://127.0.0.1:3306/hibernate_example
515   [main] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - connection properties: {user=root, password=root}
515   [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - total checked-out connections: 0
515   [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - opening new JDBC connection
781   [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - created connection to: jdbc:mysql://127.0.0.1:3306/hibernate_example, Isolation Level: 4
781   [main] INFO  org.hibernate.cfg.SettingsFactory  - RDBMS: MySQL, version: 5.0.18-nt
781   [main] INFO  org.hibernate.cfg.SettingsFactory  - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.12 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )
781   [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - returning connection to pool, pool size: 1
796   [main] INFO  org.hibernate.dialect.Dialect  - Using dialect: org.hibernate.dialect.MySQLDialect
796   [main] INFO  org.hibernate.transaction.TransactionFactoryFactory  - Using default transaction strategy (direct JDBC transactions)
796   [main] INFO  org.hibernate.transaction.TransactionManagerLookupFactory  - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Automatic flush during beforeCompletion(): disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Automatic session close at end of transaction: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - JDBC batch size: 15
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - JDBC batch updates for versioned data: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Scrollable result sets: enabled
812   [main] DEBUG org.hibernate.cfg.SettingsFactory  - Wrap result sets: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - JDBC3 getGeneratedKeys(): enabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Connection release mode: auto
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Maximum outer join fetch depth: 2
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Default batch fetch size: 1
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Generate SQL with comments: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Order SQL updates by primary key: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
812   [main] INFO  org.hibernate.hql.ast.ASTQueryTranslatorFactory  - Using ASTQueryTranslatorFactory
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Query language substitutions: {}
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Second-level cache: enabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Query cache: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Cache provider: org.hibernate.cache.NoCacheProvider
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Optimize cache for minimal puts: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Structured second-level cache entries: disabled
812   [main] DEBUG org.hibernate.exception.SQLExceptionConverterFactory  - Using dialect defined converter
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Echoing all SQL to stdout
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Statistics: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Deleted entity synthetic identifier rollback: disabled
812   [main] INFO  org.hibernate.cfg.SettingsFactory  - Default entity-mode: pojo
843   [main] INFO  org.hibernate.impl.SessionFactoryImpl  - building session factory
843   [main] DEBUG org.hibernate.impl.SessionFactoryImpl  - Session factory constructed with filter configurations : {}
843   [main] DEBUG org.hibernate.impl.SessionFactoryImpl  - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=root, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, sun.boot.library.path=C:\Programme\Java\jre1.5.0_06\bin, java.vm.version=1.5.0_06-b05, hibernate.connection.username=root, 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=DE, sun.os.patch.level=Service Pack 1, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Hibernate\Example\Hibernate Example1, java.runtime.version=1.5.0_06-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hbm2ddl.auto=create, hibernate.current_session_context_class=thread, java.endorsed.dirs=C:\Programme\Java\jre1.5.0_06\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOKUME~1\MARKUS~1\LOKALE~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, cache.provider_class=org.hibernate.cache.NoCacheProvider, os.name=Windows XP, sun.jnu.encoding=Cp1252, java.library.path=C:\Programme\Java\jre1.5.0_06\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Technologies\ATI.ACE\;C:\Programme\MySQL\MySQL Server 5.0\bin;C:\Programme\Ant 1.6.5/bin;C:\Programme\J2sdk1.4.2_10/bin, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, user.home=C:\Dokumente und Einstellungen\Markus Unger, connection.password=root, user.timezone=, java.awt.printerjob=sun.awt.windows.WPrinterJob, connection.username=root, java.specification.version=1.5, file.encoding=Cp1252, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, java.class.path=C:\Hibernate\Example\Hibernate Example1\bin;C:\Hibernate\Example\Hibernate Example1\lib\antlr-2.7.6rc1.jar;C:\Hibernate\Example\Hibernate Example1\lib\asm.jar;C:\Hibernate\Example\Hibernate Example1\lib\asm-attrs.jar;C:\Hibernate\Example\Hibernate Example1\lib\cglib-2.1.3.jar;C:\Hibernate\Example\Hibernate Example1\lib\commons-collections-2.1.1.jar;C:\Hibernate\Example\Hibernate Example1\lib\commons-logging-1.0.4.jar;C:\Hibernate\Example\Hibernate Example1\lib\dom4j-1.6.1.jar;C:\Hibernate\Example\Hibernate Example1\lib\hibernate3.jar;C:\Hibernate\Example\Hibernate Example1\lib\jta.jar;C:\Hibernate\Example\Hibernate Example1\lib\log4j-1.2.11.jar;C:\Hibernate\Example\Hibernate Example1\lib\mysql-connector-java-3.1.12-bin.jar, user.name=Markus Unger, hibernate.show_sql=true, current_session_context_class=thread, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\Programme\Java\jre1.5.0_06, hibernate.connection.url=jdbc:mysql://127.0.0.1:3306/hibernate_example, hibernate.dialect=org.hibernate.dialect.MySQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=de, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, sharing, hibernate.cglib.use_reflection_optimizer=true, java.version=1.5.0_06, java.ext.dirs=C:\Programme\Java\jre1.5.0_06\lib\ext, sun.boot.class.path=C:\Programme\Java\jre1.5.0_06\lib\rt.jar;C:\Programme\Java\jre1.5.0_06\lib\i18n.jar;C:\Programme\Java\jre1.5.0_06\lib\sunrsasign.jar;C:\Programme\Java\jre1.5.0_06\lib\jsse.jar;C:\Programme\Java\jre1.5.0_06\lib\jce.jar;C:\Programme\Java\jre1.5.0_06\lib\charsets.jar;C:\Programme\Java\jre1.5.0_06\classes, java.vendor=Sun Microsystems Inc., file.separator=\, connection.driver_class=com.mysql.jdbc.Driver, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.hbm2ddl.auto=create, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, sun.desktop=windows, connection.url=jdbc:mysql://127.0.0.1:3306/hibernate_example, sun.cpu.isalist=, dialect=org.hibernate.dialect.MySQLDialect}
1109  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Static SQL for entity: example.messages.Message
1109  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Version select: select MESSAGE_ID from USER_MESSAGES where MESSAGE_ID =?
1109  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Snapshot select: select message_.MESSAGE_ID, message_.MESSAGE_TITLE as MESSAGE2_1_, message_.MESSAGE_INHALT as MESSAGE3_1_, message_.MESSAGE_GESCHRIEBEN as MESSAGE4_1_, message_.MESSAGE_USER_ID as MESSAGE5_1_ from USER_MESSAGES message_ where message_.MESSAGE_ID=?
1140  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Insert 0: insert into USER_MESSAGES (MESSAGE_TITLE, MESSAGE_INHALT, MESSAGE_GESCHRIEBEN, MESSAGE_USER_ID, MESSAGE_ID) values (?, ?, ?, ?, ?)
1140  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Update 0: update USER_MESSAGES set MESSAGE_TITLE=?, MESSAGE_INHALT=?, MESSAGE_GESCHRIEBEN=?, MESSAGE_USER_ID=? where MESSAGE_ID=?
1140  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Delete 0: delete from USER_MESSAGES where MESSAGE_ID=?
1156  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Identity insert: insert into USER_MESSAGES (MESSAGE_TITLE, MESSAGE_INHALT, MESSAGE_GESCHRIEBEN, MESSAGE_USER_ID) values (?, ?, ?, ?)
1156  [main] INFO  example.user.User  - User
1156  [main] INFO  example.user.User  - User
1156  [main] INFO  example.user.User  - getMessages
1156  [main] INFO  example.user.User  - setMessages
1156  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Static SQL for entity: example.user.User
1156  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Version select: select USER_ID from USERS where USER_ID =?
1156  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Snapshot select: select user_.USER_ID, user_.USER_NICKNAME as USER2_0_, user_.USER_EMAIL as USER3_0_, user_.USER_PASSWORT as USER4_0_, user_.USER_REGISTRIERT as USER5_0_ from USERS user_ where user_.USER_ID=?
1156  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Insert 0: insert into USERS (USER_NICKNAME, USER_EMAIL, USER_PASSWORT, USER_REGISTRIERT, USER_ID) values (?, ?, ?, ?, ?)
1156  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Update 0: update USERS set USER_NICKNAME=?, USER_EMAIL=?, USER_PASSWORT=?, USER_REGISTRIERT=? where USER_ID=?
1156  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Delete 0: delete from USERS where USER_ID=?
1156  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Identity insert: insert into USERS (USER_NICKNAME, USER_EMAIL, USER_PASSWORT, USER_REGISTRIERT) values (?, ?, ?, ?)
1171  [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister  - Static SQL for collection: example.user.User.messages
1171  [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister  -  Row insert: update USER_MESSAGES set USER_ID=? where MESSAGE_ID=?
1171  [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister  -  Row delete: update USER_MESSAGES set USER_ID=null where USER_ID=? and MESSAGE_ID=?
1171  [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister  -  One-shot delete: update USER_MESSAGES set USER_ID=null where USER_ID=?
1203  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for entity example.messages.Message: select message0_.MESSAGE_ID as MESSAGE1_1_0_, message0_.MESSAGE_TITLE as MESSAGE2_1_0_, message0_.MESSAGE_INHALT as MESSAGE3_1_0_, message0_.MESSAGE_GESCHRIEBEN as MESSAGE4_1_0_, message0_.MESSAGE_USER_ID as MESSAGE5_1_0_ from USER_MESSAGES message0_ where message0_.MESSAGE_ID=?
1203  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for entity example.messages.Message: select message0_.MESSAGE_ID as MESSAGE1_1_0_, message0_.MESSAGE_TITLE as MESSAGE2_1_0_, message0_.MESSAGE_INHALT as MESSAGE3_1_0_, message0_.MESSAGE_GESCHRIEBEN as MESSAGE4_1_0_, message0_.MESSAGE_USER_ID as MESSAGE5_1_0_ from USER_MESSAGES message0_ where message0_.MESSAGE_ID=?
1203  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for entity example.messages.Message: select message0_.MESSAGE_ID as MESSAGE1_1_0_, message0_.MESSAGE_TITLE as MESSAGE2_1_0_, message0_.MESSAGE_INHALT as MESSAGE3_1_0_, message0_.MESSAGE_GESCHRIEBEN as MESSAGE4_1_0_, message0_.MESSAGE_USER_ID as MESSAGE5_1_0_ from USER_MESSAGES message0_ where message0_.MESSAGE_ID=? for update
1203  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for entity example.messages.Message: select message0_.MESSAGE_ID as MESSAGE1_1_0_, message0_.MESSAGE_TITLE as MESSAGE2_1_0_, message0_.MESSAGE_INHALT as MESSAGE3_1_0_, message0_.MESSAGE_GESCHRIEBEN as MESSAGE4_1_0_, message0_.MESSAGE_USER_ID as MESSAGE5_1_0_ from USER_MESSAGES message0_ where message0_.MESSAGE_ID=? for update
1218  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for action ACTION_MERGE on entity example.messages.Message: select message0_.MESSAGE_ID as MESSAGE1_1_0_, message0_.MESSAGE_TITLE as MESSAGE2_1_0_, message0_.MESSAGE_INHALT as MESSAGE3_1_0_, message0_.MESSAGE_GESCHRIEBEN as MESSAGE4_1_0_, message0_.MESSAGE_USER_ID as MESSAGE5_1_0_ from USER_MESSAGES message0_ where message0_.MESSAGE_ID=?
1218  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for action ACTION_REFRESH on entity example.messages.Message: select message0_.MESSAGE_ID as MESSAGE1_1_0_, message0_.MESSAGE_TITLE as MESSAGE2_1_0_, message0_.MESSAGE_INHALT as MESSAGE3_1_0_, message0_.MESSAGE_GESCHRIEBEN as MESSAGE4_1_0_, message0_.MESSAGE_USER_ID as MESSAGE5_1_0_ from USER_MESSAGES message0_ where message0_.MESSAGE_ID=?
1218  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for entity example.user.User: select user0_.USER_ID as USER1_0_0_, user0_.USER_NICKNAME as USER2_0_0_, user0_.USER_EMAIL as USER3_0_0_, user0_.USER_PASSWORT as USER4_0_0_, user0_.USER_REGISTRIERT as USER5_0_0_ from USERS user0_ where user0_.USER_ID=?
1218  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for entity example.user.User: select user0_.USER_ID as USER1_0_0_, user0_.USER_NICKNAME as USER2_0_0_, user0_.USER_EMAIL as USER3_0_0_, user0_.USER_PASSWORT as USER4_0_0_, user0_.USER_REGISTRIERT as USER5_0_0_ from USERS user0_ where user0_.USER_ID=?
1218  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for entity example.user.User: select user0_.USER_ID as USER1_0_0_, user0_.USER_NICKNAME as USER2_0_0_, user0_.USER_EMAIL as USER3_0_0_, user0_.USER_PASSWORT as USER4_0_0_, user0_.USER_REGISTRIERT as USER5_0_0_ from USERS user0_ where user0_.USER_ID=? for update
1218  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for entity example.user.User: select user0_.USER_ID as USER1_0_0_, user0_.USER_NICKNAME as USER2_0_0_, user0_.USER_EMAIL as USER3_0_0_, user0_.USER_PASSWORT as USER4_0_0_, user0_.USER_REGISTRIERT as USER5_0_0_ from USERS user0_ where user0_.USER_ID=? for update
1218  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for action ACTION_MERGE on entity example.user.User: select user0_.USER_ID as USER1_0_0_, user0_.USER_NICKNAME as USER2_0_0_, user0_.USER_EMAIL as USER3_0_0_, user0_.USER_PASSWORT as USER4_0_0_, user0_.USER_REGISTRIERT as USER5_0_0_ from USERS user0_ where user0_.USER_ID=?
1234  [main] DEBUG org.hibernate.loader.entity.EntityLoader  - Static select for action ACTION_REFRESH on entity example.user.User: select user0_.USER_ID as USER1_0_0_, user0_.USER_NICKNAME as USER2_0_0_, user0_.USER_EMAIL as USER3_0_0_, user0_.USER_PASSWORT as USER4_0_0_, user0_.USER_REGISTRIERT as USER5_0_0_ from USERS user0_ where user0_.USER_ID=?
1250  [main] DEBUG org.hibernate.loader.collection.OneToManyLoader  - Static select for one-to-many example.user.User.messages: select messages0_.USER_ID as USER6_1_, messages0_.MESSAGE_ID as MESSAGE1_1_, messages0_.MESSAGE_ID as MESSAGE1_1_0_, messages0_.MESSAGE_TITLE as MESSAGE2_1_0_, messages0_.MESSAGE_INHALT as MESSAGE3_1_0_, messages0_.MESSAGE_GESCHRIEBEN as MESSAGE4_1_0_, messages0_.MESSAGE_USER_ID as MESSAGE5_1_0_ from USER_MESSAGES messages0_ where messages0_.USER_ID=? order by messages0_.MESSAGE_GESCHRIEBEN ASC
1250  [main] DEBUG org.hibernate.impl.SessionFactoryObjectFactory  - initializing class SessionFactoryObjectFactory
1250  [main] DEBUG org.hibernate.impl.SessionFactoryObjectFactory  - registered: 4028808b09b55ca30109b55ca5a20000 (unnamed)
1250  [main] INFO  org.hibernate.impl.SessionFactoryObjectFactory  - Not binding factory to JNDI, no JNDI name configured
1250  [main] DEBUG org.hibernate.impl.SessionFactoryImpl  - instantiated session factory
1250  [main] INFO  org.hibernate.cfg.Configuration  - processing extends queue
1250  [main] INFO  org.hibernate.cfg.Configuration  - processing collection mappings
1250  [main] INFO  org.hibernate.cfg.Configuration  - processing association property references
1250  [main] INFO  org.hibernate.cfg.Configuration  - processing foreign key constraints
1250  [main] DEBUG org.hibernate.cfg.Configuration  - resolving reference to class: example.user.User
1250  [main] DEBUG org.hibernate.cfg.Configuration  - resolving reference to class: example.user.User
1250  [main] INFO  org.hibernate.cfg.Configuration  - processing extends queue
1250  [main] INFO  org.hibernate.cfg.Configuration  - processing collection mappings
1250  [main] INFO  org.hibernate.cfg.Configuration  - processing association property references
1250  [main] INFO  org.hibernate.cfg.Configuration  - processing foreign key constraints
1250  [main] DEBUG org.hibernate.cfg.Configuration  - resolving reference to class: example.user.User
1250  [main] DEBUG org.hibernate.cfg.Configuration  - resolving reference to class: example.user.User
1250  [main] INFO  org.hibernate.tool.hbm2ddl.SchemaExport  - Running hbm2ddl schema export
1250  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - import file not found: /import.sql
1250  [main] INFO  org.hibernate.tool.hbm2ddl.SchemaExport  - exporting generated schema to database
1250  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - total checked-out connections: 0
1250  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - using pooled JDBC connection, pool size: 0
1250  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - alter table USER_MESSAGES drop foreign key FK29C45340B5F6AB9
1296  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - alter table USER_MESSAGES drop foreign key FK29C45340C3B91A81
1312  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - drop table if exists USERS
1328  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - drop table if exists USER_MESSAGES
1328  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - create table USERS (USER_ID integer not null auto_increment, USER_NICKNAME varchar(50) not null, USER_EMAIL varchar(100) not null, USER_PASSWORT varchar(50) not null, USER_REGISTRIERT datetime, primary key (USER_ID))
1343  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - create table USER_MESSAGES (MESSAGE_ID integer not null auto_increment, MESSAGE_TITLE varchar(100) not null, MESSAGE_INHALT text not null, MESSAGE_GESCHRIEBEN datetime, MESSAGE_USER_ID integer not null, USER_ID integer, primary key (MESSAGE_ID))
1343  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - alter table USER_MESSAGES add index FK29C45340B5F6AB9 (USER_ID), add constraint FK29C45340B5F6AB9 foreign key (USER_ID) references USERS (USER_ID)
1343  [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - alter table USER_MESSAGES add index FK29C45340C3B91A81 (MESSAGE_USER_ID), add constraint FK29C45340C3B91A81 foreign key (MESSAGE_USER_ID) references USERS (USER_ID)
1359  [main] INFO  org.hibernate.tool.hbm2ddl.SchemaExport  - schema export complete
1359  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - returning connection to pool, pool size: 1
1359  [main] INFO  org.hibernate.impl.SessionFactoryImpl  - Checking 0 named HQL queries
1359  [main] INFO  org.hibernate.impl.SessionFactoryImpl  - Checking 0 named SQL queries
1390  [main] DEBUG org.hibernate.impl.SessionImpl  - opened session at timestamp: 11412090813
1531  [main] DEBUG org.hibernate.context.ThreadLocalSessionContext  - allowing method [beginTransaction] in non-transacted context
1531  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - begin
1531  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - opening JDBC connection
1531  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - total checked-out connections: 0
1531  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - using pooled JDBC connection, pool size: 0
1593  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - current autocommit status: false
1593  [main] DEBUG org.hibernate.jdbc.JDBCContext  - after transaction begin
1593  [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener  - saving transient instance
1593  [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - saving [example.user.User#<null>]
1593  [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - executing insertions
1609  [main] INFO  example.user.User  - getMessages
1609  [main] DEBUG org.hibernate.event.def.WrapVisitor  - Wrapped collection in role: example.user.User.messages
1609  [main] INFO  example.user.User  - setMessages
1625  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Inserting entity: example.user.User (native id)
1625  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
1625  [main] DEBUG org.hibernate.SQL  - insert into USERS (USER_NICKNAME, USER_EMAIL, USER_PASSWORT, USER_REGISTRIERT) values (?, ?, ?, ?)
Hibernate: insert into USERS (USER_NICKNAME, USER_EMAIL, USER_PASSWORT, USER_REGISTRIERT) values (?, ?, ?, ?)
1625  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - preparing statement
1640  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Dehydrating entity: [example.user.User#<null>]
1640  [main] DEBUG org.hibernate.type.StringType  - binding 'Markus' to parameter: 1
1640  [main] DEBUG org.hibernate.type.StringType  - binding 'email@email.com' to parameter: 2
1640  [main] DEBUG org.hibernate.type.StringType  - binding '123456' to parameter: 3
1640  [main] DEBUG org.hibernate.type.TimestampType  - binding '2006-03-01 11:31:20' to parameter: 4
1656  [main] DEBUG org.hibernate.id.IdentifierGeneratorFactory  - Natively generated identity: 1
1656  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
1656  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - closing statement
1656  [main] DEBUG example.user.UserBO  - Storing User Successfull
1656  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - commit
1656  [main] DEBUG org.hibernate.impl.SessionImpl  - automatically flushing session
1656  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - flushing session
1656  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - processing flush-time cascades
1656  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - dirty checking collections
1656  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushing entities and processing referenced collections
1656  [main] INFO  example.user.User  - getMessages
1671  [main] DEBUG org.hibernate.engine.Collections  - Collection found: [example.user.User.messages#1], was: [<unreferenced>] (initialized)
1671  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Processing unreferenced collections
1671  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Scheduling collection removes/(re)creates/updates
1671  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
1671  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
1671  [main] DEBUG org.hibernate.pretty.Printer  - listing entities:
1671  [main] INFO  example.user.User  - getMessages
1671  [main] DEBUG org.hibernate.pretty.Printer  - example.user.User{nickname=Markus, passwort=123456, email=email@email.com, registriert=2006-03-01 11:31:20, id=1, messages=[]}
1671  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - executing flush
1671  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - post flush
1671  [main] DEBUG org.hibernate.jdbc.JDBCContext  - before transaction completion
1671  [main] DEBUG org.hibernate.impl.SessionImpl  - before transaction completion
1671  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - committed JDBC Connection
1671  [main] DEBUG org.hibernate.jdbc.JDBCContext  - after transaction completion
1671  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - aggressively releasing JDBC connection
1671  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
1671  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - returning connection to pool, pool size: 1
1671  [main] DEBUG org.hibernate.impl.SessionImpl  - after transaction completion
1671  [main] DEBUG org.hibernate.impl.SessionImpl  - automatically closing session
1671  [main] DEBUG org.hibernate.impl.SessionImpl  - closing session
1671  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - connection already null in cleanup : no action
ID: 1
1687  [main] INFO  example.messages.MessageBO  - Storing Message: 0;example.user.User@4a65e0;Willkommen;Hallo Markus;Wed Mar 01 11:31:21 CET 2006
1687  [main] DEBUG org.hibernate.impl.SessionImpl  - opened session at timestamp: 11412090816
1687  [main] DEBUG org.hibernate.context.ThreadLocalSessionContext  - allowing method [beginTransaction] in non-transacted context
1687  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - begin
1687  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - opening JDBC connection
1687  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - total checked-out connections: 0
1687  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - using pooled JDBC connection, pool size: 0
1687  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - current autocommit status: false
1687  [main] DEBUG org.hibernate.jdbc.JDBCContext  - after transaction begin
1687  [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener  - saving transient instance
1687  [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - saving [example.messages.Message#<null>]
1687  [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - executing insertions
1687  [main] DEBUG org.hibernate.engine.IdentifierValue  - id unsaved-value: 0
1687  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Inserting entity: example.messages.Message (native id)
1687  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
1687  [main] DEBUG org.hibernate.SQL  - insert into USER_MESSAGES (MESSAGE_TITLE, MESSAGE_INHALT, MESSAGE_GESCHRIEBEN, MESSAGE_USER_ID) values (?, ?, ?, ?)
Hibernate: insert into USER_MESSAGES (MESSAGE_TITLE, MESSAGE_INHALT, MESSAGE_GESCHRIEBEN, MESSAGE_USER_ID) values (?, ?, ?, ?)
1687  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - preparing statement
1687  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Dehydrating entity: [example.messages.Message#<null>]
1687  [main] DEBUG org.hibernate.type.StringType  - binding 'Willkommen' to parameter: 1
1687  [main] DEBUG org.hibernate.type.StringType  - binding 'Hallo Markus' to parameter: 2
1687  [main] DEBUG org.hibernate.type.TimestampType  - binding '2006-03-01 11:31:21' to parameter: 3
1687  [main] DEBUG org.hibernate.engine.IdentifierValue  - id unsaved-value: 0
1687  [main] DEBUG org.hibernate.type.IntegerType  - binding '1' to parameter: 4
1687  [main] DEBUG org.hibernate.id.IdentifierGeneratorFactory  - Natively generated identity: 1
1687  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
1687  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - closing statement
1687  [main] INFO  example.messages.MessageBO  - Storing Message Successfull
1687  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - commit
1687  [main] DEBUG org.hibernate.impl.SessionImpl  - automatically flushing session
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - flushing session
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - processing flush-time cascades
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - dirty checking collections
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushing entities and processing referenced collections
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Processing unreferenced collections
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Scheduling collection removes/(re)creates/updates
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
1687  [main] DEBUG org.hibernate.pretty.Printer  - listing entities:
1687  [main] DEBUG org.hibernate.pretty.Printer  - example.messages.Message{title=Willkommen, benutzerId=example.user.User#1, geschrieben=2006-03-01 11:31:21, inhalt=Hallo Markus, id=1}
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - executing flush
1687  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - post flush
1687  [main] DEBUG org.hibernate.jdbc.JDBCContext  - before transaction completion
1687  [main] DEBUG org.hibernate.impl.SessionImpl  - before transaction completion
1687  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - committed JDBC Connection
1687  [main] DEBUG org.hibernate.jdbc.JDBCContext  - after transaction completion
1687  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - aggressively releasing JDBC connection
1687  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
1687  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - returning connection to pool, pool size: 1
1687  [main] DEBUG org.hibernate.impl.SessionImpl  - after transaction completion
1687  [main] DEBUG org.hibernate.impl.SessionImpl  - automatically closing session
1687  [main] DEBUG org.hibernate.impl.SessionImpl  - closing session
1687  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - connection already null in cleanup : no action
1687  [main] INFO  example.messages.MessageBO  - Storing Message: 0;example.user.User@4a65e0;Willkommen1;Hallo Markus1;Wed Mar 01 11:31:21 CET 2006
1687  [main] DEBUG org.hibernate.impl.SessionImpl  - opened session at timestamp: 11412090816
1687  [main] DEBUG org.hibernate.context.ThreadLocalSessionContext  - allowing method [beginTransaction] in non-transacted context
1687  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - begin
1687  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - opening JDBC connection
1687  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - total checked-out connections: 0
1687  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - using pooled JDBC connection, pool size: 0
1687  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - current autocommit status: false
1687  [main] DEBUG org.hibernate.jdbc.JDBCContext  - after transaction begin
1687  [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener  - saving transient instance
1687  [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - saving [example.messages.Message#<null>]
1703  [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener  - executing insertions
1703  [main] DEBUG org.hibernate.engine.IdentifierValue  - id unsaved-value: 0
1703  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Inserting entity: example.messages.Message (native id)
1703  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
1703  [main] DEBUG org.hibernate.SQL  - insert into USER_MESSAGES (MESSAGE_TITLE, MESSAGE_INHALT, MESSAGE_GESCHRIEBEN, MESSAGE_USER_ID) values (?, ?, ?, ?)
Hibernate: insert into USER_MESSAGES (MESSAGE_TITLE, MESSAGE_INHALT, MESSAGE_GESCHRIEBEN, MESSAGE_USER_ID) values (?, ?, ?, ?)
1703  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - preparing statement
1703  [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Dehydrating entity: [example.messages.Message#<null>]
1703  [main] DEBUG org.hibernate.type.StringType  - binding 'Willkommen1' to parameter: 1
1703  [main] DEBUG org.hibernate.type.StringType  - binding 'Hallo Markus1' to parameter: 2
1703  [main] DEBUG org.hibernate.type.TimestampType  - binding '2006-03-01 11:31:21' to parameter: 3
1703  [main] DEBUG org.hibernate.engine.IdentifierValue  - id unsaved-value: 0
1703  [main] DEBUG org.hibernate.type.IntegerType  - binding '1' to parameter: 4
1703  [main] DEBUG org.hibernate.id.IdentifierGeneratorFactory  - Natively generated identity: 2
1703  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
1703  [main] DEBUG org.hibernate.jdbc.AbstractBatcher  - closing statement
1703  [main] INFO  example.messages.MessageBO  - Storing Message Successfull
1703  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - commit
1703  [main] DEBUG org.hibernate.impl.SessionImpl  - automatically flushing session
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - flushing session
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - processing flush-time cascades
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - dirty checking collections
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushing entities and processing referenced collections
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Processing unreferenced collections
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Scheduling collection removes/(re)creates/updates
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
1703  [main] DEBUG org.hibernate.pretty.Printer  - listing entities:
1703  [main] DEBUG org.hibernate.pretty.Printer  - example.messages.Message{title=Willkommen1, benutzerId=example.user.User#1, geschrieben=2006-03-01 11:31:21, inhalt=Hallo Markus1, id=2}
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - executing flush
1703  [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener  - post flush
1703  [main] DEBUG org.hibernate.jdbc.JDBCContext  - before transaction completion
1703  [main] DEBUG org.hibernate.impl.SessionImpl  - before transaction completion
1703  [main] DEBUG org.hibernate.transaction.JDBCTransaction  - committed JDBC Connection
1703  [main] DEBUG org.hibernate.jdbc.JDBCContext  - after transaction completion
1703  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - aggressively releasing JDBC connection
1703  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
1703  [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - returning connection to pool, pool size: 1
1703  [main] DEBUG org.hibernate.impl.SessionImpl  - after transaction completion
1703  [main] DEBUG org.hibernate.impl.SessionImpl  - automatically closing session
1703  [main] DEBUG org.hibernate.impl.SessionImpl  - closing session
1703  [main] DEBUG org.hibernate.jdbc.ConnectionManager  - connection already null in cleanup : no action
1703  [main] INFO  example.user.User  - getMessages
LIST: 0
Termin: Markus


Und der vollständigkeithalber der Client:

Code:
import java.util.Date;
import java.util.Iterator;
import java.util.Set;

import example.messages.Message;
import example.messages.MessageBO;
import example.user.User;
import example.user.UserBO;

public class Client {
   
   public static void main(String[] args) {
      User user = new User();
      user.setNickname("Markus");
      user.setEmail("email@email.com");
      user.setPasswort("123456");
      user.setRegistriert(new Date());      
      UserBO.storeUser(user);
      
      System.out.println("ID: " + user.getId());
      
      
      Message msg = new Message();
      msg.setBenutzerId(user);
      msg.setGeschrieben(new Date());
      msg.setInhalt("Hallo Markus");      
      msg.setTitle("Willkommen");
      
      MessageBO.storeMessage(msg);
      
      Message msg1 = new Message();
      msg1.setBenutzerId(user);
      msg1.setGeschrieben(new Date());
      msg1.setInhalt("Hallo Markus1");      
      msg1.setTitle("Willkommen1");
      
      MessageBO.storeMessage(msg1);      
      
      Set list = user.getMessages();
      
      Iterator itr = list.iterator();
      
      while(itr.hasNext()) {
         Message tmp = (Message) itr.next();
         System.out.println("Message: " + tmp);
      }
      
      System.out.println("LIST: " + list.size());
      
      System.out.println("Termin: " + user.getNickname());
      
   
   }

}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 6:59 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
Ich vermute, dass Du in der setUserId Methode von Message, deine bi-direktionale Verknüpfung nicht pflegst.

Hast Du dort einen Aufruf, der was in dieser Richtung macht:

Code:
...
pubic class Message .....

public void setUserId(User user) {
  this.userId = user;
  user.addMessages(this);
}
...


Ausserdem lädst Du deinen User nicht im Client. Versuch mal, nach dem Speichern ein
Code:
User loadedUser = UserBO.loadUser(user.getId());

aufzurufen... dann sollten die Messages eigentlich gleich mitkommen.

Anbei noch ein kleiner Link zur Hibernate Doku:
http://www.hibernate.org/hib_docs/v3/re ... hild-bidir

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 7:33 am 
Newbie

Joined: Wed Mar 01, 2006 8:02 pm
Posts: 3
Yeap.. das mit der User.add funktioniert.

Aber das mit dem User im Client laden ist so nciht richtig. Wenn ich den über Session.save(); speichere, wird das Objekt automatisch aktualisiert und hat alle aktuellen Werte. Also muß man das nicht seperat neu laden.

Danke


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 8:33 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
Quote:
Wenn ich den über Session.save(); speichere, wird das Objekt automatisch aktualisiert und hat alle aktuellen Werte.


Generell mag das funktionieren, aber nur für Objekte, die nicht detached sind. Da Du aber Deine Session nach jeder User / MessageBO funktion schliesst hast Du ein Problem. Laut Deinem Log file wird die Session 3 mal geschlossen. Beim letzten Aufruf ist das User Objekt Detached und wird somit nicht nachgezogen. Prüf das Verhalten mal in nem Debugger.

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 8:54 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Ein Object wird niemals automatisch aktualisiert.
Es kann sein, dass die Daten in der DB richtig geschrieben werden, aber Hibernate sucht nicht nach allen Objekten, die im Speicher sind und prüft, ob es dort etwas zu aktualisieren gibt.

Gruß Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.