• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ids for this class must be manually assigned before calling save()

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two table

Xydataa and Fm4featuress

ID->PK
Fm4features

ID-PK-FK
DataId-pk

mapping file

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 8, 2010 4:08:07 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class name="test.Xydataa" table="xydataa" catalog="navl">
<id name="id" type="java.lang.Integer">
<column name="ID" />
<generator class="identity" />
</id>
<property name="longi" type="string">
<column name="Longi" />
</property>
<property name="lat" type="string">
<column name="Lat" />
</property>
<property name="altitude" type="int">
<column name="Altitude" not-null="true" />
</property>
<property name="angle" type="int">
<column name="Angle" not-null="true" />
</property>
<property name="satellite" type="int">
<column name="Satellite" not-null="true" />
</property>
<property name="speed" type="int">
<column name="Speed" not-null="true" />
</property>
<property name="objectId" type="int">
<column name="ObjectId" not-null="true" />
</property>
<property name="clientId" type="int">
<column name="ClientId" not-null="true" />
</property>
<property name="gpsTime" type="string">
<column name="GpsTime" length="19" not-null="false" />
</property>
<property name="location" type="string">
<column name="Location" />
</property>
<property name="city" type="string">
<column name="City" />
</property>
<property name="state" type="string">
<column name="State" />
</property>
<property name="distance" type="string">
<column name="Distance" length="100" />
</property>
<property name="times" type="timestamp">
<column name="Times" length="19" not-null="false" />
</property>
<set name="objtablees" inverse="true">
<key>
<column name="ID" not-null="true" unique="true" />
</key>
<one-to-many class="test.Objtablee" />
</set>
<set name="fm4featuresses" cascade="all" inverse="true">
<key>
<column name="ID" not-null="true" />
</key>
<one-to-many class="test.Fm4featuress" />
</set>
</class>
</hibernate-mapping>


Fm4featuress.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 8, 2010 4:08:07 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class name="test.Fm4featuress" table="fm4featuress" catalog="navl">
<composite-id name="id" class="test.Fm4featuressId">
<key-many-to-one name="id" class="test.Xydataa" column="ID" />
<key-property name="dataId" column="DataId"/>
</composite-id>
<property name="value" type="string">
<column name="Value" length="20" not-null="true" />
</property>
</class>
</hibernate-mapping>

Main Class

from open session to close session

Error Stack Trace

org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): test.Fm4featuress
at org.hibernate.id.Assigned.generate(Assigned.java:33)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:334)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
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:535)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)


I got this error

Please help any one me what ia m doing wrong

i need the ouput

Xydataa

1 4 5
2 4 8
5 8 0

Fm4featuress
ID DataID
1 3
1 5
1 8
1 ...
2
2
2
2
5
5
5
5


Advance Thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic