View Single Post
  #7 (permalink)  
Old 06-14-2007, 10:24 AM
javadev javadev is offline
Member
 
Join Date: Jun 2007
Posts: 17
javadev is on a distinguished road
hello frnd,
thanx for u r valuable guidence..

as per u r suggation i change the naming notation...
but problem again same..

when i use simple code without <composite-id> it works well..
but when i use composite id it gives exception like above...
Just tell me that what are conditions to use <composite-id>
1. is it necessory to write <key-many-to-one>?
2. is it necessory to override equals(),hashCode() and implements Serializable?

please help me..
again i give u my code that i use...
//mapping file
<class name="HibernateUtil.xmlConfig" table="zespl_gifnoc_lmx">
<composite-id>
<key-property name="countryCd" column="dc_yrtnuoc"/>
<key-property name="dtdVersion" column="noisrev_dtd"/>
<key-property name="dtdType" column="epyt_dtd"/>
<key-property name="dtdFileName" column="eman_elif_dtd"/>
</composite-id>
<property name="xlsFileName" column="eman_elif_lsx"/>
<property name="ICHFlag" column="galf_hci"/>
</class>

//cong.cfg.xml
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">net.sourc eforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserve r://192.168.1.64:1433/Dossier-Mgmt</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="dialect">org.hibernate.dialect.SQLServerDial ect</property>
<property name="show_sql">true</property>
<mapping resource="HibernateDemo\xmlConfig.hbm.xml"/>
</session-factory>

//error log
INFO - Hibernate 3.0rc1
INFO - hibernate.properties not found
INFO - using CGLIB reflection optimizer
INFO - using JDK 1.4 java.sql.Timestamp handling
INFO - configuring from resource: /hibernate.cfg.xml
INFO - Configuration resource: /hibernate.cfg.xml
INFO - Mapping resource: HibernateDemo\xmlConfig.hbm.xml
INFO - Mapping class: HibernateDemo.xmlConfig -> zespl_gifnoc_lmx
WARN - Could not perform validation checks for component as the class HibernateDemo.xmlConfig was not found
INFO - Configured SessionFactory: null
INFO - processing extends queue
INFO - processing collection mappings
INFO - processing association property references
INFO - processing foreign key constraints
INFO - Using dialect: org.hibernate.dialect.SQLServerDialect
INFO - Default batch fetch size: 1
INFO - Generate SQL with comments: disabled
INFO - Order SQL updates by primary key: disabled
INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO - Using ASTQueryTranslatorFactory
INFO - Query language substitutions: {}
INFO - Using Hibernate built-in connection pool (not for production use!)
INFO - Hibernate connection pool size: 20
INFO - autocommit mode: false
INFO - using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://192.168.1.64:1433/Dossier-Mgmt
INFO - connection properties: {user=sa, password=****}
INFO - Scrollable result sets: enabled
INFO - JDBC3 getGeneratedKeys(): enabled
INFO - Using default transaction strategy (direct JDBC transactions)
INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
INFO - Automatic flush during beforeCompletion(): disabled
INFO - Automatic session close at end of transaction: disabled
INFO - Cache provider: org.hibernate.cache.EhCacheProvider
INFO - Second-level cache: enabled
INFO - Optimize cache for minimal puts: disabled
INFO - Structured second-level cache entries: enabled
INFO - Query cache: disabled
INFO - Echoing all SQL to stdout
INFO - Statistics: disabled
INFO - Deleted entity synthetic identifier rollback: disabled
INFO - Default entity-mode: pojo
INFO - building session factory
WARN - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C://lib/ehcache-1.1.jar!/ehcache-failsafe.xml
INFO - Not binding factory to JNDI, no JNDI name configured
INFO - Checking 0 named queries
Hibernate: select xmlconfig0_.dc_yrtnuoc as col_0_0_, xmlconfig0_.noisrev_dtd as col_0_1_, xmlconfig0_.epyt_dtd as col_0_2_, xmlconfig0_.eman_elif_dtd as col_0_3_ from zespl_gifnoc_lmx xmlconfig0_
Exception in thread "main" java.lang.ClassCastException: HibernateDemo.xmlConfig
at org.hibernate.type.ManyToOneType.hydrate(ManyToOne Type.java:63)
at org.hibernate.type.EntityType.nullSafeGet(EntityTy pe.java:196)
at org.hibernate.impl.IteratorImpl.postNext(IteratorI mpl.java:95)
at org.hibernate.impl.IteratorImpl.<init>(IteratorImp l.java:62)
at org.hibernate.loader.hql.QueryLoader.iterate(Query Loader.java:382)
at org.hibernate.hql.ast.QueryTranslatorImpl.iterate( QueryTranslatorImpl.java:278)
at org.hibernate.impl.SessionImpl.iterate(SessionImpl .java:865)
at org.hibernate.impl.QueryImpl.iterate(QueryImpl.jav a:41)
at HibernateDemo.TestXmlConfig.main(TestXmlConfig.jav a:14)

can WARN matters for execution of code????
thanx and regards,
JavaDev48
Reply With Quote