-->
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.  [ 2 posts ] 
Author Message
 Post subject: identifier mapping has wrong number of columns
PostPosted: Mon Jul 12, 2004 7:32 am 
Newbie

Joined: Mon Jul 12, 2004 7:21 am
Posts: 2
I'm getting this ' identifier mapping has wrong number of columns' exception, heres the stack trace and the mapping file is below.

If you have 30 seconds and can give me any pointers, it would be appreciated!


Code:
Caused by: java.lang.ExceptionInInitializerError
   at biz.easyec.business.DMIService.saveUser(DMIService.java:177)
   at biz.easyec.web.action.UserListAction.save_onClick(UserListAction.java:77)
   ... 36 more
Caused by: java.lang.RuntimeException: Configuration problem: identifier mapping has wrong number of columns: biz.easyec.business.value.hibernate.MemberTrading type: biz.easyec.business.value.hibernate.MemberTraadingPK
   at biz.easyec.dao.HibernateUtil.<clinit>(HibernateUtil.java:22)
   ... 38 more
Caused by: net.sf.hibernate.MappingException: identifier mapping has wrong number of columns: biz.easyec.business.value.hibernate.MemberTrading type: biz.easyec.business.value.hibernate.MemberTradingPK
   at net.sf.hibernate.mapping.RootClass.validate(RootClass.java:201)
   at net.sf.hibernate.cfg.Configuration.validate(Configuration.java:605)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:762)
   at biz.easyec.dao.HibernateUtil.<clinit>(HibernateUtil.java:19)
   ... 38 more


The mapping file in question is:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->
<class name="biz.easyec.business.value.hibernate.MemberTrading" table="MEMBER_TRADING">
  <composite-id
   class="biz.easyec.business.value.hibernate.MemberTradingPK"
   name="comp_id" unsaved-value="none">
   <!-- bi-directional many-to-one association to MemberDocument -->
   <key-many-to-one name="memberDocument" class="biz.easyec.business.value.hibernate.MemberDocument">
    <column name="IDMEMBER"/>
    <column name="IDINDUSTRY"/>
    <column name="CHAPPLICATION"/>
    <column name="CHDOCUMENT"/>
    <column name="CHDIRECTION"/>
   </key-many-to-one>
   <!-- bi-directional many-to-one association to Member -->
   <key-many-to-one name="member" class="biz.easyec.business.value.hibernate.Member">
    <column name="IDPARTNER"/>
   </key-many-to-one>
  </composite-id>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: fixed it.
PostPosted: Tue Jul 13, 2004 8:00 am 
Newbie

Joined: Mon Jul 12, 2004 7:21 am
Posts: 2
I gave up trying to sort out the mass of .hbm files that middlegen generated and figured out my root cause has something to do with all the foreign key constraints and stupid compound keys we've got in our db.

So, 1 solution would be to figure out how all that works in hibernate, but I don't have the time and frankly, don't need those features yet.

So, I dropped the foreign key constraints on a copy of the DB and ran middlegen again.

Result: success, I'm adding and deleting objects using hibernate.

The 'hard stuff' will have to wait.


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