*
The moose likes Object Relational Mapping and the fly likes Problem with the <set> mapping please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem with the <set> mapping please help " Watch "Problem with the <set> mapping please help " New topic
Author

Problem with the <set> mapping please help

Maxime Dupaul
Greenhorn

Joined: May 17, 2011
Posts: 1
Hello everyone, (sorry if my English is not very good and/or precises)

I'm actually working on an school project, I took the decision to use Hibernate.

Since I'm a new user of this framework I'm having a big problem.
When I try to save an object from the class Enfant, the 3 <set> associated to it does't save in the database.

So if someone could point me in the right direction it would be very much appreciated.
To this post, I'm joining the classes and mapping file regarding my problem.

Thank !!

Class Enfant


Class Parent


Class EnfantPersonneauthorisee


Class EnfantAllergie


Mapping file for the class Enfant


Mapping file for the class Parent


Mapping file for the Classe EnfantPersonneauthorisee


Mapping file for the Class EnfantAllergie


My Hibernate Configuration file


and there is the LOG I get when i try to save an "enfant" object..

2011-05-15 21:35:40 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
2011-05-15 21:35:40 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
2011-05-15 21:35:40 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Model/Adresse.hbm.xml
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Model.Adresse -> Adresse
2011-05-15 21:35:40 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Model/Garderie.hbm.xml
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Model.Garderie -> Garderie
2011-05-15 21:35:40 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Model/Gestionnaire.hbm.xml
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Model.Gestionnaire -> Gestionnaire
2011-05-15 21:35:40 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Model/Enfant.hbm.xml
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Model.Enfant -> Enfant
2011-05-15 21:35:40 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Model/EnfantAllergie.hbm.xml
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Model.EnfantAllergie -> enfant_allergie
2011-05-15 21:35:40 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Model/EnfantPersonneauthorisee.hbm.xml
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Model.EnfantPersonneauthorisee -> enfant_personneauthorisee
2011-05-15 21:35:40 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Model/Parent.hbm.xml
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Model.Parent -> Parent
2011-05-15 21:35:40 org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: Model.Enfant.enfantPersonneauthorisees -> enfant_personneauthorisee
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: Model.Enfant.enfantAllergies -> enfant_allergie
2011-05-15 21:35:40 org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: Model.Enfant.parent -> Parent
2011-05-15 21:35:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
2011-05-15 21:35:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
2011-05-15 21:35:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
2011-05-15 21:35:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/gsdga
2011-05-15 21:35:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=gsdg_app, password=****}
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 5.1.35-community
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.13 ( Revision: ${bzr.revision-id} )
2011-05-15 21:35:41 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
2011-05-15 21:35:41 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
2011-05-15 21:35:41 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2011-05-15 21:35:41 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
2011-05-15 21:35:41 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
2011-05-15 21:35:41 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
2011-05-15 21:35:42 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: Running hbm2ddl schema update
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: fetching database metadata
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: updating schema
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: gsdga.adresse
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [codepostal, province, ville, pays, adresseid, numerocivic, nomrue]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: []
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [primary]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: gsdga.enfant
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [prenom, nomfamille, dateinsctiption, garderieid, sexe, commentaire, adesseid, enfantid, datenaissance]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk7bfc540aadc8c528, fk7bfc540a86d6536a]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [fk7bfc540aadc8c528, primary, fk7bfc540a86d6536a]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: gsdga.garderie
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [heurefermeture, garderieid, description, gestionnaireid, heureouverture, adesseid, nom, tarif]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fka2e92d35adc8c528, fka2e92d355428df00]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [fka2e92d35adc8c528, primary, fka2e92d355428df00]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: gsdga.gestionnaire
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [prenom, garderieid, nomusager, gestionnaireid, motpasse, telephone, nom]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk199f77a086d6536a]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [fk199f77a086d6536a, primary]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: gsdga.parent
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [courriel, nomusager, parentid, telephonebureau, motpasse, telephonecell, type, enfantid, prenom, nomfamille, telephonemaison, adresseid, nas, commentaire, datenaissance]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk8e0ff4ca5ff4514, fk8e0ff4caf7f198b4]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [fk8e0ff4ca5ff4514, primary, fk8e0ff4caf7f198b4]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: gsdg.enfant_allergie
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [allergie, enfantallergiid, enfantid]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk8fd61baa5ff4514]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [primary, fk8fd61baa5ff4514]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: gsdg.enfant_personneauthorisee
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [enfantpersonneauthoriseeid, personneauthorisee, enfantid]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk6b6226965ff4514]
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [primary, fk6b6226965ff4514]
Hibernate: select max(enfantID) from Enfant
Hibernate: select max(adresseID) from Adresse
Hibernate: insert into Adresse (codePostal, nomRue, numeroCivic, pays, province, ville, adresseID) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Enfant (prenom, nomFamille, dateNaissance, dateInsctiption, sexe, commentaire, adesseID, garderieID, enfantID) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: update Garderie set description=?, heureFermeture=?, heureOuverture=?, nom=?, tarif=?, adesseID=?, gestionnaireID=? where garderieID=?
2011-05-15 21:35:42 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: schema update complete
Hibernate: update Adresse set codePostal=?, nomRue=?, numeroCivic=?, pays=?, province=?, ville=? where adresseID=?
Hibernate: update Gestionnaire set nomUsager=?, motPasse=?, prenom=?, nom=?, telephone=?, garderieID=? where gestionnaireID=?
 
jQuery in Action, 2nd edition
 
subject: Problem with the <set> mapping please help
 
Similar Threads
Simple Hibernate Help (Im Noob)
error connecting to SQL Server 2005
Can't connect to MySQL database with Hibernate
SQLGrammarException
Hibernate problem