-->
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.  [ 1 post ] 
Author Message
 Post subject: MappingException: broken column mapping
PostPosted: Wed May 30, 2007 5:30 am 
Beginner
Beginner

Joined: Mon Feb 05, 2007 2:33 am
Posts: 32
Hibernate version: 3

Mapping documents:

Addressdata table

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.DAO.account.Addressdata" table="addressdata" catalog="pao">
<composite-id>
<key-property name="accountid" type="java.lang.Integer">
<column name="ACCOUNTID" />
</key-property>
<key-property name="contactid" type="java.lang.Integer">
<column name="CONTACTID" />
</key-property>
<key-property name="addrtypeid" type="java.lang.String">
<column name="ADDRTYPEID" length="3" />
</key-property>
<key-property name="sequence" type="java.lang.Short">
<column name="SEQUENCE" />
</key-property>
<key-property name="compid" type="java.lang.Integer">
<column name="COMPID" />
</key-property>
</composite-id>
<one-to-one name="generalid" class="com.DAO.account.General">
</one-to-one>

<property name="reltype" type="java.lang.String">
<column name="RELTYPE" length="1" />
</property>
</class>
</hibernate-mapping>


General Table

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.DAO.account.General" table="general" catalog="pao">
<id name="generalid" type="java.lang.Integer">
<column name="generalid" />
<generator class="native" />
</id>

<property name="admoid" type="java.lang.Integer">
<column name="ADMOID" not-null="true" />
</property>
<property name="countryid" type="java.lang.String">
<column name="COUNTRYID" length="3" not-null="true" />
</property>
<property name="district" type="java.lang.String">
<column name="DISTRICT" length="40" />
</property>
<property name="information" type="java.lang.String">
<column name="INFORMATION" length="60" />
</property>
<property name="municipalid" type="java.lang.String">
<column name="MUNICIPALID" length="15" />
</property>
<property name="mutdat" type="java.util.Date">
<column name="MUTDAT" length="10" />
</property>
<property name="number" type="java.lang.Integer">
<column name="NUMBER" />
</property>
<property name="numberext" type="java.lang.String">
<column name="NUMBEREXT" length="15" />
</property>
<many-to-one name="placeid" column="PLACEID" class="com.DAO.account.Place">
</many-to-one>
<property name="postcode" type="java.lang.String">
<column name="POSTCODE" length="10" />
</property>
<property name="stateid" type="java.lang.String">
<column name="STATEID" length="2" />
</property>
<property name="street" type="java.lang.String">
<column name="STREET" length="100" />
</property>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Session session;
List result;

ServletContext context=request.getSession().getServletContext();
SessionFactory _factory = (SessionFactory) context.getAttribute("SESSION_FACTORY_KEY_CRM");
session=_factory.openSession();
result = (session.createSQLQuery(query).addEntity(className)).list();

return result;



Full stack trace of any exception that occurs:

org.hibernate.MappingException: broken column mapping for: generalid.id of: com.
DAO.account.Addressdata
at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPa
ths(AbstractPropertyMapping.java:122)
at org.hibernate.persister.entity.AbstractPropertyMapping.initIdentifier
PropertyPaths(AbstractPropertyMapping.java:176)
at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPa
ths(AbstractPropertyMapping.java:160)
at org.hibernate.persister.entity.AbstractEntityPersister.initOrdinaryPr
opertyPaths(AbstractEntityPersister.java:1585)
at org.hibernate.persister.entity.AbstractEntityPersister.initPropertyPa
ths(AbstractEntityPersister.java:1613)
at org.hibernate.persister.entity.AbstractEntityPersister.postConstruct(
AbstractEntityPersister.java:2610)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(Sing
leTableEntityPersister.java:386)
at org.hibernate.persister.PersisterFactory.createClassPersister(Persist
erFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
216)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1176)
at com.common.CrmPlugIn.init(CrmPlugIn.java:52)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServle
t.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1044)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:88
7)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3948)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
271)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:85
0)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
loyer.java:316)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:859)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:723)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:393)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:166)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:816)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
19)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:234
3)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
Error while initializing hibernate: broken column mapping for: generalid.id of:
com.DAO.account.Addressdata

Name and version of the database you are using: mysql







pls tell me a solution to prevent this .

where as general id is related as one-to-one from addressdata to general table

whats wrong with this pls help


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.