-->
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.  [ 14 posts ] 
Author Message
 Post subject: basic Problem in Mapping .Help needed.
PostPosted: Wed Feb 25, 2009 3:27 am 
Newbie

Joined: Tue Feb 24, 2009 6:52 am
Posts: 15

I have a table called payments .The structure is as follows

Payments
pmtid---->PK
Versionid---->PK
EmployeeId---->FK from personal table
ClientId----->FK

My mapping file looks like this--->
<hibernate-mapping>
<class name="payments" table="payments_tbl">
<id name="paymentId" type="int" column="paymentId" >
<generator class="assigned"/>
</id>

<id name="versionId" type="int" column="versionid" >
<generator class="assigned"/>
</id>

<many-to-one name="employeeId" class="personalDetails" column="employeeId"/>

<many-to-one name="clientMinorId" class="regionsClientsLocationsMappings" column="clientMinorId"/>

<property name="paymentDate">
<column name="paymentDate" />
</property>

<property name="chequeDate">
<column name="chequeDate"/>
</property>

<property name="installmentAmount">
<column name="installmentAmou............................
................


This gives me mapping exception
I have checked all column names in tables .they are correct.I m using Hibernate 3.2.5

Please help.




Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 3:45 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
You can only have one <id> tag in your mapping file. If you have multiple columns that make up the primary key, you need to use <composite-id> instead. See http://www.hibernate.org/hib_docs/v3/re ... ompositeid


Top
 Profile  
 
 Post subject: exception
PostPosted: Wed Feb 25, 2009 4:30 am 
Newbie

Joined: Tue Feb 24, 2009 6:52 am
Posts: 15
Hello
Thnx for the previous posting, it helped a lot.As i m a newbie to Hibernate

I m getting this exception now .what could be the reason?

Exception--->org.hibernate.MappingException: could not instantiate id generator

Regards
Vikram


Top
 Profile  
 
 Post subject: exception
PostPosted: Wed Feb 25, 2009 4:32 am 
Newbie

Joined: Tue Feb 24, 2009 6:52 am
Posts: 15
Hello
Thnx for the previous posting, it helped a lot.As i m a newbie to Hibernate

I m getting this exception now .what could be the reason?

Exception--->org.hibernate.MappingException: could not instantiate id generator

Regards
Vikram


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 4:38 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
What is your new mapping?


Top
 Profile  
 
 Post subject: hello
PostPosted: Wed Feb 25, 2009 4:50 am 
Newbie

Joined: Tue Feb 24, 2009 6:52 am
Posts: 15
nordborg wrote:
What is your new mapping?


It is giving exception after all mappiing compilation has been done.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 4:54 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
Plz post the contents of ur hbm.xml mapping file.

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 4:56 am 
Beginner
Beginner

Joined: Wed Nov 19, 2008 6:39 am
Posts: 44
Location: Mumbai, India
Put your latest Mapping file and error stack also. It will help me for solving your problem.

_________________
Thx,
Murugesan.
Web: http://www.murugesanpitchandi.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 4:56 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Can you post the new mapping document? I assume you are now using <composite-id> instead of <id> and that the mapping in the original post is no longer relevant?


Top
 Profile  
 
 Post subject: output
PostPosted: Wed Feb 25, 2009 5:18 am 
Newbie

Joined: Tue Feb 24, 2009 6:52 am
Posts: 15
nordborg wrote:
Can you post the new mapping document? I assume you are now using <composite-id> instead of <id> and that the mapping in the original post is no longer relevant?


Before i post the xml .please take a look at this output ---->
INFO: Hibernate 3.2.5
INFO: hibernate.properties not found
INFO: Bytecode provider name : cglib
INFO: using JDK 1.4 java.sql.Timestamp handling
INFO: configuring from resource: /hibernate.cfg.xml
INFO: Configuration resource: /hibernate.cfg.xml
INFO: Reading mappings from resource : hibernate.hbm.xml
INFO: Mapping class: Employee -> employee
INFO: Reading mappings from resource : orders.hbm.xml
INFO: Mapping class: orders -> orders_tbl
INFO: Reading mappings from resource : clients.hbm.xml
INFO: Mapping class: clients -> clients_tbl
INFO: Reading mappings from resource : clientstk.hbm.xml
INFO: Mapping class: clientStock -> clientstock_tbl
INFO: Reading mappings from resource : regions.hbm.xml
INFO: Mapping class: regions -> regions_tbl
INFO: Reading mappings from resource : products.hbm.xml
INFO: Mapping class: products -> products_tbl
INFO: Reading mappings from resource : personaldetails.hbm.xml
INFO: Mapping class: personalDetails -> personaldetails_tbl
INFO: Reading mappings from resource : discounts.hbm.xml
INFO: Mapping class: discounts -> discounts_tbl
INFO: Reading mappings from resource : locations.hbm.xml
INFO: Mapping class: locations -> locations_tbl
INFO: Reading mappings from resource : payments.hbm.xml
INFO: Mapping class: payments -> payments_tbl
INFO: Reading mappings from resource : rcl.hbm.xml
INFO: Mapping class: regionsClientsLocationsMappings -> regionsclientslocationsmappings_tbl
INFO: Reading mappings from resource : orderdet.hbm.xml
INFO: Mapping class: orderDetails -> orderdetails_tbl
INFO: Configured SessionFactory: null
WARNING: composite-id class does not override equals(): payments
WARNING: composite-id class does not override hashCode(): payments
INFO: Using Hibernate built-in connection pool (not for production use!)
INFO: Hibernate connection pool size: 20
INFO: autocommit mode: true
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/sms
INFO: connection properties: {user=root, password=****, autocommit=true}
INFO: RDBMS: MySQL, version: 5.1.30-community
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
INFO: Using dialect: org.hibernate.dialect.DerbyDialect
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: Scrollable result sets: enabled
INFO: JDBC3 getGeneratedKeys(): enabled
INFO: Connection release mode: auto
INFO: Default batch fetch size: 1
INFO: Generate SQL with comments: disabled
INFO: Order SQL updates by primary key: disabled
INFO: Order SQL inserts for batching: disabled
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO: Using ASTQueryTranslatorFactory
INFO: Query language substitutions: {}
INFO: JPA-QL strict compliance: disabled
INFO: Second-level cache: enabled
INFO: Query cache: disabled
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
INFO: Optimize cache for minimal puts: disabled
INFO: Structured second-level cache entries: disabled
INFO: Statistics: disabled
INFO: Deleted entity synthetic identifier rollback: disabled
INFO: Default entity-mode: pojo
INFO: Named query checking : enabled
INFO: building session factory
INFO: Exception--->org.hibernate.MappingException: could not instantiate id generator
INFO: cleaning up connection pool: jdbc:mysql://localhost:3306/sms


Top
 Profile  
 
 Post subject: output
PostPosted: Wed Feb 25, 2009 5:29 am 
Newbie

Joined: Tue Feb 24, 2009 6:52 am
Posts: 15
nordborg wrote:
Can you post the new mapping document? I assume you are now using <composite-id> instead of <id> and that the mapping in the original post is no longer relevant?


Before i post the xml .please take a look at this output ---->
INFO: Hibernate 3.2.5
INFO: hibernate.properties not found
INFO: Bytecode provider name : cglib
INFO: using JDK 1.4 java.sql.Timestamp handling
INFO: configuring from resource: /hibernate.cfg.xml
INFO: Configuration resource: /hibernate.cfg.xml
INFO: Reading mappings from resource : hibernate.hbm.xml
INFO: Mapping class: Employee -> employee
INFO: Reading mappings from resource : orders.hbm.xml
INFO: Mapping class: orders -> orders_tbl
INFO: Reading mappings from resource : clients.hbm.xml
INFO: Mapping class: clients -> clients_tbl
INFO: Reading mappings from resource : clientstk.hbm.xml
INFO: Mapping class: clientStock -> clientstock_tbl
INFO: Reading mappings from resource : regions.hbm.xml
INFO: Mapping class: regions -> regions_tbl
INFO: Reading mappings from resource : products.hbm.xml
INFO: Mapping class: products -> products_tbl
INFO: Reading mappings from resource : personaldetails.hbm.xml
INFO: Mapping class: personalDetails -> personaldetails_tbl
INFO: Reading mappings from resource : discounts.hbm.xml
INFO: Mapping class: discounts -> discounts_tbl
INFO: Reading mappings from resource : locations.hbm.xml
INFO: Mapping class: locations -> locations_tbl
INFO: Reading mappings from resource : payments.hbm.xml
INFO: Mapping class: payments -> payments_tbl
INFO: Reading mappings from resource : rcl.hbm.xml
INFO: Mapping class: regionsClientsLocationsMappings -> regionsclientslocationsmappings_tbl
INFO: Reading mappings from resource : orderdet.hbm.xml
INFO: Mapping class: orderDetails -> orderdetails_tbl
INFO: Configured SessionFactory: null
WARNING: composite-id class does not override equals(): payments
WARNING: composite-id class does not override hashCode(): payments
INFO: Using Hibernate built-in connection pool (not for production use!)
INFO: Hibernate connection pool size: 20
INFO: autocommit mode: true
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/sms
INFO: connection properties: {user=root, password=****, autocommit=true}
INFO: RDBMS: MySQL, version: 5.1.30-community
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
INFO: Using dialect: org.hibernate.dialect.DerbyDialect
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: Scrollable result sets: enabled
INFO: JDBC3 getGeneratedKeys(): enabled
INFO: Connection release mode: auto
INFO: Default batch fetch size: 1
INFO: Generate SQL with comments: disabled
INFO: Order SQL updates by primary key: disabled
INFO: Order SQL inserts for batching: disabled
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO: Using ASTQueryTranslatorFactory
INFO: Query language substitutions: {}
INFO: JPA-QL strict compliance: disabled
INFO: Second-level cache: enabled
INFO: Query cache: disabled
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
INFO: Optimize cache for minimal puts: disabled
INFO: Structured second-level cache entries: disabled
INFO: Statistics: disabled
INFO: Deleted entity synthetic identifier rollback: disabled
INFO: Default entity-mode: pojo
INFO: Named query checking : enabled
INFO: building session factory
INFO: Exception--->org.hibernate.MappingException: could not instantiate id generator
INFO: cleaning up connection pool: jdbc:mysql://localhost:3306/sms


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 5:33 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
The problem is with ur composite id mapping. We can debug the issue only if we get the mapping.

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 5:55 am 
Newbie

Joined: Tue Feb 24, 2009 6:52 am
Posts: 15
littypreethkr wrote:
The problem is with ur composite id mapping. We can debug the issue only if we get the mapping.


Following is the mapping file content---->
<class name="payments" table="payments_tbl">
<composite-id>
<key-property name="paymentId" type="int" column="paymentId"/>
<key-property name="versionId" type="int" column="versionid" />
<key-many-to-one name="employeeId" class="personalDetails" column="employeeId"/>
<key-many-to-one name="clientMinorId" class="regionsClientsLocationsMappings" column="clientMinorId"/>
</composite-id>

<property name="paymentDate">
<column name="paymentDate" />
</property>

<property name="chequeDate">
<column name="chequeDate"/>
</property>

<property name="installmentAmount">
<column name="installmentAmount"/>
</property>

<property name="chequeNo">
<column name="chequeNo"/>
</property>

<property name="draweeBank">
<column name="draweeBank"/>
</property>
</class>
</hibernate-mapping>


I think that error is in some other mapping
i have 9 such mapping files

Regards,
Vikram


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 5:59 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
Plz post orderdet.hbm.xml Also the code of the composite id class which u used in tht file.

_________________
Regards,
Litty Preeth


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