-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem related to mapping files and invalid column
PostPosted: Mon Apr 17, 2006 11:37 am 
Newbie

Joined: Tue Jan 17, 2006 1:02 am
Posts: 6
Location: mumbai,india
hibernate version 3.0


consider following Mapping documents:

<class name="com.dss.pdm.components.style.models.PdmStylePomModel"
table="DB_PDM_STYLE_POM" lazy="true">
<id name="pdmStylePomId" column="PDM_STYLE_POM_ID"
type="long">
<generator class="assigned" />
</id>
<property name="pdmStyleSizeRangeSetId"
column="PDM_STYLE_SIZE_RANGE_SET_ID" type="long" />
<property name="pdmStyleId" column="PDM_STYLE_ID" type="long" />
<property name="pdmTemplateId" column="PDM_TEMPLATE_ID"
type="long" />
<property name="pomGradingId" column="POM_GRADING_ID"
type="long" />
<property name="serialNumber" column="SERIAL_NUMBER"
type="integer" />

<property name="tolerance" column="TOLERANCE" type="double" />
<property name="stylePomReference" column="STYLE_POM_REFERENCE"
type="string" />
<property name="stylePomDescription"
column="STYLE_POM_DESCRIPTION" type="string" />
<property name="isDeleted" column="ISDELETED" type="integer" />
<property name="addUserId" column="ADD_USER_ID" type="long" />
<property name="addDate" column="ADD_DATE" type="timestamp" />
<property name="editUserId" column="EDIT_USER_ID" type="long" />
<property name="editDate" column="EDIT_DATE" type="timestamp" />
</class>



and another model mapping in same xml file which has problem in its column name


<class name= "com.dss.pdm.components.style.models.PdmArchiveStylePomModel" table="DB_PDM_STYLE_POM_A">
<id name= "pdmArchiveStylePomId" column= "PDM_STYLE_POM_A_ID" type= "long">
<generator class="assigned" />
</id>
<property name= "pdmArchiveId" column= "PDM_ARCHIVE_ID" type="long" />
<property name="pdmStyleSizeRangeSetId" column= "PDM_STYLE_SIZE_RANGE_SET_ID" type="long" />
<property name="pdmStyleId" column="PDM_STYLE_ID" type="long" />
<property name="pdmTemplateId" column= "PDM_TEMPLATE_ID" type="long" />
<property name="pomGradingId" column= "POM_GRADING_ID" type="long" />
<property name="serialNumber" column="SARIAL_NUMBER" type="integer" />
<property name="tolerance" column="TOLERANCE" type="double" />

<property name="isDeleted" column="ISDELETED" type="integer" />
<property name="addUserId" column="ADD_USER_ID" type="long" />
<property name="addDate" column="ADD_DATE" type="timestamp" />
<property name="editUserId" column="EDIT_USER_ID" type="long" />
<property name="editDate" column="EDIT_DATE" type="timestamp" />
</class>



Problem is


when ever i try to retrieving PdmStylePomModels(first mapped model ) by

i got following exception

Hibernate: select pdmstylepo0_.PDM_STYLE_POM_ID as PDM1_, pdmstylepo0_.PDM_STYLE_SIZE_RANGE_SET_ID as PDM2_71_, pdmstylepo0_.PDM_STYLE_ID as PDM3_71_, pdmstylepo0_.PDM_TEMPLATE_ID as PDM4_71_, pdmstylepo0_.POM_GRADING_ID as POM5_71_, pdmstylepo0_.SERIAL_NUMBER as SERIAL6_71_, pdmstylepo0_.TOLERANCE as TOLERANCE71_, pdmstylepo0_.STYLE_POM_REFERENCE as STYLE8_71_, pdmstylepo0_.STYLE_POM_DESCRIPTION as STYLE9_71_, pdmstylepo0_.ISDELETED as ISDELETED71_, pdmstylepo0_.ADD_USER_ID as ADD11_71_, pdmstylepo0_.ADD_DATE as ADD12_71_, pdmstylepo0_.EDIT_USER_ID as EDIT13_71_, pdmstylepo0_.EDIT_DATE as EDIT14_71_ from DB_PDM_STYLE_POM pdmstylepo0_ where pdmstylepo0_.ISDELETED=0 and pdmstylepo0_.PDM_STYLE_SIZE_RANGE_SET_ID=?
2006-04-17 20:56:41,434 - DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
2006-04-17 20:56:41,434 - DEBUG org.hibernate.type.LongType - binding '36915' to parameter: 1
2006-04-17 20:56:41,450 - DEBUG org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
2006-04-17 20:56:41,450 - DEBUG org.hibernate.loader.Loader - processing result set
2006-04-17 20:56:41,450 - DEBUG org.hibernate.loader.Loader - done processing result set (0 rows)
2006-04-17 20:56:41,450 - DEBUG org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
2006-04-17 20:56:41,481 - DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2006-04-17 20:56:41,481 - DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
2006-04-17 20:56:41,481 - DEBUG org.hibernate.loader.Loader - total objects hydrated: 0
2006-04-17 20:56:41,481 - DEBUG org.hibernate.engine.PersistenceContext - initializing non-lazy collections
2006-04-17 20:56:41,481 - DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2006-04-17 20:56:41,481 - DEBUG org.hibernate.SQL - select pdmarchive0_.PDM_STYLE_POM_A_ID as PDM1_, pdmarchive0_.PDM_ARCHIVE_ID as PDM2_91_, pdmarchive0_.PDM_STYLE_SIZE_RANGE_SET_ID as PDM3_91_, pdmarchive0_.PDM_STYLE_ID as PDM4_91_, pdmarchive0_.PDM_TEMPLATE_ID as PDM5_91_, pdmarchive0_.POM_GRADING_ID as POM6_91_, pdmarchive0_.SARIAL_NUMBER as SARIAL7_91_, pdmarchive0_.TOLERANCE as TOLERANCE91_, pdmarchive0_.ISDELETED as ISDELETED91_, pdmarchive0_.ADD_USER_ID as ADD10_91_, pdmarchive0_.ADD_DATE as ADD11_91_, pdmarchive0_.EDIT_USER_ID as EDIT12_91_, pdmarchive0_.EDIT_DATE as EDIT13_91_ from DB_PDM_STYLE_POM_A pdmarchive0_ where pdmarchive0_.ISDELETED=0 and pdmarchive0_.PDM_STYLE_SIZE_RANGE_SET_ID=?
Hibernate: select pdmarchive0_.PDM_STYLE_POM_A_ID as PDM1_, pdmarchive0_.PDM_ARCHIVE_ID as PDM2_91_, pdmarchive0_.PDM_STYLE_SIZE_RANGE_SET_ID as PDM3_91_, pdmarchive0_.PDM_STYLE_ID as PDM4_91_, pdmarchive0_.PDM_TEMPLATE_ID as PDM5_91_, pdmarchive0_.POM_GRADING_ID as POM6_91_, pdmarchive0_.SARIAL_NUMBER as SARIAL7_91_, pdmarchive0_.TOLERANCE as TOLERANCE91_, pdmarchive0_.ISDELETED as ISDELETED91_, pdmarchive0_.ADD_USER_ID as ADD10_91_, pdmarchive0_.ADD_DATE as ADD11_91_, pdmarchive0_.EDIT_USER_ID as EDIT12_91_, pdmarchive0_.EDIT_DATE as EDIT13_91_ from DB_PDM_STYLE_POM_A pdmarchive0_ where pdmarchive0_.ISDELETED=0 and pdmarchive0_.PDM_STYLE_SIZE_RANGE_SET_ID=?

2006-04-17 20:56:41,481 - DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
2006-04-17 20:56:41,481 - DEBUG org.hibernate.type.LongType - binding '36915' to parameter: 1
2006-04-17 20:56:41,512 - DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2006-04-17 20:56:41,512 - DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
2006-04-17 20:56:41,528 - DEBUG org.hibernate.util.JDBCExceptionReporter - could not execute query [select pdmarchive0_.PDM_STYLE_POM_A_ID as PDM1_, pdmarchive0_.PDM_ARCHIVE_ID as PDM2_91_, pdmarchive0_.PDM_STYLE_SIZE_RANGE_SET_ID as PDM3_91_, pdmarchive0_.PDM_STYLE_ID as PDM4_91_, pdmarchive0_.PDM_TEMPLATE_ID as PDM5_91_, pdmarchive0_.POM_GRADING_ID as POM6_91_, pdmarchive0_.SARIAL_NUMBER as SARIAL7_91_, pdmarchive0_.TOLERANCE as TOLERANCE91_, pdmarchive0_.ISDELETED as ISDELETED91_, pdmarchive0_.ADD_USER_ID as ADD10_91_, pdmarchive0_.ADD_DATE as ADD11_91_, pdmarchive0_.EDIT_USER_ID as EDIT12_91_, pdmarchive0_.EDIT_DATE as EDIT13_91_ from DB_PDM_STYLE_POM_A pdmarchive0_ where pdmarchive0_.ISDELETED=0 and pdmarchive0_.PDM_STYLE_SIZE_RANGE_SET_ID=?]
java.sql.SQLException: ORA-00904: "PDMARCHIVE0_"."SARIAL_NUMBER": invalid identifier

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:158)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:509)
at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:977)
at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:552)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1094)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3015)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3056)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.SessionImpl.find(SessionImpl.java:823)
at com.dss.core.dataaccess.impl.HibernateDataAccessor.find(HibernateDataAccessor.java:753)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:292)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:163)
at $Proxy1.find(Unknown Source)
at com.dss.pdm.components.style.impl.PdmStylePomManager.getPdmStylePoms(PdmStylePomManager.java:222)
at com.dss.pdm.components.style.impl.PdmStyleSizeRangeSetManager.getPdmStyleSizeRangeSets(PdmStyleSizeR


Qurey written in bold fonts is not called by me but called by Hibernate and
This query has some problem in mapping

hence it throws exception




MY Question is why do this query written in bold is called when my code does not called it

is it because i have written both mapping classes in same xml file this is occured


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 1:40 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Configuration is read sequentially, therefore second definition overrides the first and becomes the only mapping for your class.

If you want/need to keep both mappings then you need to add entity attribute to the mappings and try to retrieve instances with using entity name instead of class name.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: still face problem
PostPosted: Tue Apr 18, 2006 6:44 am 
Newbie

Joined: Tue Jan 17, 2006 1:02 am
Posts: 6
Location: mumbai,india
thanks for taking time to sove my problem

as u said i shuffled my mapping files places
but still i got problem



Exception is

System Error occured..Please inform administratorRoot Cause :could not resolve property: pdmStyleSetComponentsId of: com.dss.pdm.components.style.models.PdmArchiveStyleSetComponentsModel [ FROM com.dss.pdm.components.style.models.PdmArchiveStyleSetComponentsModel pdmStyleSetComponentsModel WHERE pdmStyleSetComponentsModel.pdmStyleSetComponentsId = ? ]; nested exception is org.hibernate.QueryException: could not resolve property: pdmStyleSetComponentsId of: com.dss.pdm.components.style.models.PdmArchiveStyleSetComponentsModel [ FROM com.dss.pdm.components.style.models.PdmArchiveStyleSetComponentsModel pdmStyleSetComponentsModel WHERE pdmStyleSetComponentsModel.pdmStyleSetComponentsId = ? ]


problem is PdmArchiveStyleSetComponentsModel is subclass of PdmStyleSetComponentsModel AND WHEN EVER I TRY TO FIRE QUERIES RELATED TO SUPER CLASS QUERY OF SUB CLASS IS CALLED INTERNALLY BY hIBERNATE

hOW TO SOLVE THIS PROBLEM


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