Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

problem with hibernate table mapping.

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm using spring with hibernate. The method below is used to fetch the data from oracle database. When executing this method I'm getting error:
*** ERROR: IwfFormsinfoEO is not mapped.
*** ERROR: Invalid path: 'forms.formId'
*** ERROR: Invalid path: 'forms.formDescription'
Invalid Queryorg.hibernate.hql.ast.QuerySyntaxError: IwfFormsinfoEO is not mapped. [Select forms.formId,forms.formDescription from IwfFormsinfoEO forms where forms.formDescription is not null]

public FormsVO[] getSelectNotice() throws BusinessException
{
List codeElements = new ArrayList();
Session session = null;
Transaction tx=null;
try
{
String queryString = "Select forms.formId,forms.formDescription from "+ ConstantsUtil.FORM_TABLE+" forms where forms.formDescription is not null";
session =getSessionFactory().openSession();
Query query = session.createQuery(queryString);
List ls = query.list();
}
catch(Exception e)
{
logger.error("Unknown Exception=" + e);

}
return null;
}

I'm having a constant FORM_TABLE with value 'IwfFormsinfoEO'. and my mapping file is

<hibernate-mapping auto-import="false">
<class name="com.tier.uiConnect.hibernate.IwfFormsinfoEO" table="IWF_FORMSINFO" >

<id name="formId" column="FORM_ID">
<generator class="assigned"> </generator>
</id>

<property name="formDescription" column="FORM_DESCRIPTION" />
<property name="outgoing" column="OUTGOING" />
<property name="recipientType" column="RECIPIENT_TYPE" />
<property name="incoming" column="INCOMING" />
<property name="incomingDocType" column="INCOMING_DOC_TYPE" />
<property name="wiAssignToRoleId" column="WI_ASSIGN_TO_ROLE_ID" />
<property name="daysToCompleteWork" column="DAYS_TO_COMPLETE_WORK" />
<property name="priority" column="PRIORITY" />
<property name="workTypeId" column="WORK_TYPE_ID" />
<property name="thtemplateid" column="THTEMPLATEID" />
<property name="createdBy" column="CREATED_BY" />
<property name="dateCreated" column="DATE_CREATED" />
<property name="modifiedBy" column="MODIFIED_BY" />
<property name="dateModified" column="DATE_MODIFIED" />
</hibernate-mapping>

I'm also having a java class, IwfFormsinfoEO.java which is mapped with the database table via this XML.

Please let me know what mistake I'm doing...Its urgent.
Kindly help.

Naresh Daswani
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will have to mention this hbm file in the hibernate.cfg.xml
 
Naresh Daswani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I don't have any such hibernate.cfg.xml file, I have defined the things in another xml file of spring in following way..

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.autocommit">false</prop>
<prop key="hibernate.connection.datasource">jdbc/uim</prop>
</props>
</property>
<property name="mappingDirectoryLocations">
<list>
<value>classpath:com/tier/uiConnect/common/code/persistence/model</value>
<value>classpath:com/tier/uiConnect/hibernate</value>
</list>
</property>
</bean>

All other files are getting mapped...What is the problem with this file I am not getting...plz help..

Naresh Daswani
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure that hbm file is present in either of the directories that you mentioned in:




And what do hibernate logs say, when the session factory is being built?
 
Naresh Daswani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes that file is there...and logs are fine...while building the session factory there is no problem..

while starting the server following is logged

[12/4/06 19:26:43:776 IST] 00000035 Configuration I Mapping file: D:\IWFLatest\uiConnect\WebContent\WEB-INF\classes\com\tier\uiConnect\hibernate\IwfFormsinfoEO.hbm.xml

[12/4/06 19:26:43:776 IST] 00000035 HbmBinder I Mapping class: com.tier.uiConnect.hibernate.IwfFormsinfoEO -> IWF_FORMSINFO

this specifies the configuration is fine..

Naresh Daswani
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try changing the HQL to:

 
Naresh Daswani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jaikiran...it worked but please could you tell me the reason behind this code...as it is not feasible for me to write full path of the EO file, I want to put simple name IwfFormsinfoEO only... for that what should I do...

Thanks for your help.

Naresh Daswani
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try giving package name in hbm file

<hibernate-mapping package="com.....">
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic