-->
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: HIbernate -inner class in mapping
PostPosted: Mon Jul 03, 2006 4:45 am 
Newbie

Joined: Mon Jul 03, 2006 3:59 am
Posts: 1
Hi all
i am using static inner class and try to make the databse by setting property <property name="hbm2ddl.auto">create</property>
while on searching in net and other tutorial i am able to create the database
i used the following hbm.xml file for inner class

here Dataparameter is outer class and MemoryExpression is the inner class


<subclass name="com.daffodilwoods.framework.core.view.client.dataparameter.DataParameter" discriminator-value="DataParameter" >
<property
name="editable"
column="editable"/>
<property
name="defaultRowOn"
column="defaultRowOn"/>
<property
name="memoryAddress"
column="memoryAddress"/>
<property
name="searchKey"
column="searchKey"/>
<property
name="explicitFilter"
column="explicitFilter"/>
<!-- <many-to-one name="MemoryExpression" column="memoryDataObjectId" cascade="all"> </many-to-one>
<many-to-one name="memoryExpression"
column="memoryExpression" cascade="all"/>

<class name="com.daffodilwoods.framework.core.view.client.dataparameter$MemoryExpression"
table="MemoryExpression">
<id name="Id"
column="Id">
<generator class="increment"/>
</id> -->

<component name="id" class="com.daffodilwoods.framework.core.view.client.dataparameter.DataParameter$MemoryExpression" >


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

<property
name="memryViewId"
column="memryViewId"/>
<property
name="type"
column="type"/>
<property
name="memoryFuntion"
column="memoryFuntion"/>

</component>
</subclass>


But when i try to insert the record from Hibernate Util it show the following error


Exception in thread "main" org.hibernate.MappingException: Unknown entity: com.daffodilwoods.framework.core.view.client.dataparameter.DataParameter$MemoryExpression
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:514)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1302)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:89)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
at com.daffodilwoods.framework.datasource.hibernate.HibernateUtil.main(HibernateUtil.java:122)

_________________
Neeraj
India


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.