wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes please solve this prob Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "please solve this prob " Watch "please solve this prob " New topic
Author

please solve this prob

mahesh vidudhala
Greenhorn

Joined: Nov 29, 2011
Posts: 1
run:
Hibernate many to many (XML Mapping)
Nov 29, 2011 3:48:51 PM org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.1.GA
Nov 29, 2011 3:48:51 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
Nov 29, 2011 3:48:51 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Nov 29, 2011 3:48:51 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Nov 29, 2011 3:48:51 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : hibernate.hbm.xml
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : com/pkg/Category.hbm.xml
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : com/pkg/Stock.hbm.xml
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.pkg.Category -> category
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.HbmBinder bindCollection
INFO: Mapping collection: com.pkg.Category.stocks -> stock_category
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.pkg.Stock -> stock
Nov 29, 2011 3:48:52 PM org.hibernate.cfg.HbmBinder bindCollection
INFO: Mapping collection: com.pkg.Stock.categories -> stock_category
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.AnnotationConfiguration secondPassCompile
INFO: Hibernate Validator not found: ignoring
Nov 29, 2011 3:48:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Nov 29, 2011 3:48:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Nov 29, 2011 3:48:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Nov 29, 2011 3:48:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/mahesh
Nov 29, 2011 3:48:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****}
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 5.1.59-community
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.13 ( Revision: ${bzr.revision-id} )
Nov 29, 2011 3:48:53 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
Nov 29, 2011 3:48:53 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Nov 29, 2011 3:48:53 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
Nov 29, 2011 3:48:53 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Nov 29, 2011 3:48:53 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Nov 29, 2011 3:48:54 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
Nov 29, 2011 3:48:54 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Nov 29, 2011 3:48:54 PM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Nov 29, 2011 3:48:54 PM org.hibernate.event.def.AbstractFlushingEventListener performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.pkg.Category
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:78)
at org.hibernate.persister.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:755)
at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1143)
at org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java:26)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
Done
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:145)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at com.pkg.App.main(App.java:44)
BUILD SUCCESSFUL (total time: 8 seconds)
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Hello mahesh vidudhala, welcome to javaranch.

You error is here: Could not synchronize database state with session
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.pkg.Category


You is trying to save an objetct that is not transient. [=


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please solve this prob
 
Similar Threads
Unable to get hibernate session
Can't connect to MySQL database with Hibernate
hibernate
No Persistent Classes found for Query Class
Problem in pushing data through hibernate even after creating the hibernate session...