Joined: Thu May 01, 2008 4:53 pm Posts: 11
|
Hi Every One,
I am using hibernate3.2.6 and oracle 10g and eclipse.I created general Java project in eclipse.I created two classes Event,Event_Organizer for two tables EVENTS and EVENT_ORGANIZERS.
Here is my event.hbm.xml file:
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="events.Event" table="EVENTS" > <id name="eventId" type="java.lang.Integer" column="EVENT_ID" > <generator class="increment" /> </id> <property name="eventTitle" type="java.lang.String" column="EVENT_TITLE" length="20" /> <property name="totalMembers" type="java.lang.Integer" column="TOTAL_MEMBERS" length="-1" /> [b]<set name="eventOrganizers" cascade="all"> <key column="EVENT_ID"/> <one-to-many class="events.Event_Organizer"/> </set>[/b] </class> </hibernate-mapping>
and i wrote mappings tags for both *.hbm.xml files in my hibernate.cfg.xml. Now when i try to run client program.I am getting an exception like below. Code: 11:56:31,890 INFO Environment:514 - Hibernate 3.2.6 11:56:32,015 INFO Environment:532 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=sun.jdbc.odbc.JdbcOdbcDriver, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.Oracle9Dialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=system, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:oracle:thin:@localhost:1522:XE, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1} 11:56:32,078 INFO Environment:563 - using java.io streams to persist binary types 11:56:32,078 INFO Environment:681 - Bytecode provider name : cglib 11:56:32,093 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling 11:56:32,265 INFO Configuration:1432 - configuring from resource: /hibernate.cfg.xml 11:56:32,265 INFO Configuration:1409 - Configuration resource: /hibernate.cfg.xml 11:56:32,718 INFO Configuration:559 - Reading mappings from resource : events/event.hbm.xml 11:56:32,953 INFO HbmBinder:300 - Mapping class: events.Event -> EVENTS 11:56:32,984 INFO Configuration:559 - Reading mappings from resource : events/event_Organizer.hbm.xml 11:56:33,031 INFO HbmBinder:300 - Mapping class: events.Event_Organizer -> EVENT_ORGANIZERS 11:56:33,046 INFO Configuration:1547 - Configured SessionFactory: null 11:56:33,062 INFO HbmBinder:2382 - Mapping collection: events.Event.eventOrganizers -> EVENT_ORGANIZERS 11:56:33,609 WARN RootClass:210 - composite-id class does not override equals(): events.Event_Organizer 11:56:33,609 WARN RootClass:215 - composite-id class does not override hashCode(): events.Event_Organizer 11:56:33,625 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!) 11:56:33,625 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1 11:56:33,625 INFO DriverManagerConnectionProvider:45 - autocommit mode: true 11:56:33,734 INFO DriverManagerConnectionProvider:80 - using driver: sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MyOracle 11:56:33,734 INFO DriverManagerConnectionProvider:86 - connection properties: {user=system, password=****, autocommit=true} 11:56:39,671 INFO SettingsFactory:89 - RDBMS: Oracle, version: 10.02.0010 11:56:39,671 INFO SettingsFactory:90 - JDBC driver: JDBC-ODBC Bridge (SQORA32.DLL), version: 2.0001 (10.02.0001) 11:56:39,843 INFO Dialect:152 - Using dialect: org.hibernate.dialect.Oracle9Dialect 11:56:39,843 WARN Oracle9Dialect:37 - The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead 11:56:39,859 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions) 11:56:39,875 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 11:56:39,875 INFO SettingsFactory:143 - Automatic flush during beforeCompletion(): disabled 11:56:39,875 INFO SettingsFactory:147 - Automatic session close at end of transaction: disabled 11:56:39,875 INFO SettingsFactory:154 - JDBC batch size: 15 11:56:39,875 INFO SettingsFactory:157 - JDBC batch updates for versioned data: enabled 11:56:39,875 INFO SettingsFactory:162 - Scrollable result sets: enabled 11:56:39,875 INFO SettingsFactory:170 - JDBC3 getGeneratedKeys(): disabled 11:56:39,875 INFO SettingsFactory:178 - Connection release mode: auto 11:56:39,875 INFO SettingsFactory:202 - Maximum outer join fetch depth: 1 11:56:39,875 INFO SettingsFactory:205 - Default batch fetch size: 1 11:56:39,875 INFO SettingsFactory:209 - Generate SQL with comments: disabled 11:56:39,875 INFO SettingsFactory:213 - Order SQL updates by primary key: disabled 11:56:39,890 INFO SettingsFactory:217 - Order SQL inserts for batching: disabled 11:56:39,890 INFO SettingsFactory:386 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 11:56:39,921 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory 11:56:39,921 INFO SettingsFactory:225 - Query language substitutions: {yes='Y', no='N'} 11:56:39,921 INFO SettingsFactory:230 - JPA-QL strict compliance: disabled 11:56:39,921 INFO SettingsFactory:235 - Second-level cache: enabled 11:56:39,921 INFO SettingsFactory:239 - Query cache: disabled 11:56:39,921 INFO SettingsFactory:373 - Cache provider: org.hibernate.cache.NoCacheProvider 11:56:39,921 INFO SettingsFactory:254 - Optimize cache for minimal puts: disabled 11:56:39,921 INFO SettingsFactory:259 - Cache region prefix: hibernate.test 11:56:39,937 INFO SettingsFactory:263 - Structured second-level cache entries: disabled 11:56:39,984 INFO SettingsFactory:283 - Echoing all SQL to stdout 11:56:39,984 INFO SettingsFactory:290 - Statistics: disabled 11:56:39,984 INFO SettingsFactory:294 - Deleted entity synthetic identifier rollback: disabled 11:56:39,984 INFO SettingsFactory:309 - Default entity-mode: pojo 11:56:39,984 INFO SettingsFactory:313 - Named query checking : enabled 11:56:40,656 INFO SessionFactoryImpl:161 - building session factory 11:56:41,265 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured 11:56:41,437 DEBUG SQL:401 - select max(EVENT_ID) from EVENTS Hibernate: select max(EVENT_ID) from EVENTS Event saved with ID = 10 Event updated with ID = 10 End of Program 11:56:42,015 DEBUG SQL:401 - select event_orga_.EVENT_ID, event_orga_.FIRSTNAME as FIRSTNAME1_, event_orga_.LASTNAME as LASTNAME1_, event_orga_.PHONE as PHONE1_ from EVENT_ORGANIZERS event_orga_ where event_orga_.EVENT_ID=? Hibernate: select event_orga_.EVENT_ID, event_orga_.FIRSTNAME as FIRSTNAME1_, event_orga_.LASTNAME as LASTNAME1_, event_orga_.PHONE as PHONE1_ from EVENT_ORGANIZERS event_orga_ where event_orga_.EVENT_ID=? 11:56:42,031 WARN JDBCExceptionReporter:77 - SQL Error: 0, SQLState: S1000 11:56:42,031 ERROR JDBCExceptionReporter:78 - General error Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not retrieve snapshot: [events.Event_Organizer#component[eventId]{eventId=10}] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.persister.entity.AbstractEntityPersister.getDatabaseSnapshot(AbstractEntityPersister.java:1052) at org.hibernate.engine.StatefulPersistenceContext.getDatabaseSnapshot(StatefulPersistenceContext.java:246) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:189) at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:80) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499) at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218) at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169) at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296) at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169) at org.hibernate.engine.Cascade.cascade(Cascade.java:130) at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131) at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at client.TestClient.main(TestClient.java:70) Caused by: java.sql.SQLException: General error at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(Unknown Source) at org.hibernate.persister.entity.AbstractEntityPersister.getDatabaseSnapshot(AbstractEntityPersister.java:1025) ... 22 more
With these exception details,i couldn't understand what's wrong.
Can any one help me,to solve this problem.
Thank q very much,
siri.
|
|