-->
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: problem saving object
PostPosted: Wed Sep 08, 2004 9:31 am 
Newbie

Joined: Wed Sep 08, 2004 8:23 am
Posts: 2
Hibernate version:

hibernate 2

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="at.univie.auv.redbaron.model.MetaGruppen" table="META_GRUPPEN">
<meta attribute="class-description">
@author ZAL
</meta>

<id name="tid" column="TID">
<generator class="assigned"/>
</id>

<property name="i3vUserId" column="I3V_USER_ID" type="double" not-null="false"/>

<property name="i3vDate" column="I3V_DATE" type="string" not-null="false"/>

<property name="name" column="Name" type="string" not-null="false"/>

<property name="metaDarstellungsTypId" column="META_DARSTELLUNG_TYP_ID" type="double" not-null="false"/>

<many-to-one name="application" column="I3V_FILE_ID" class="at.univie.auv.redbaron.model.I3VFile" insert="false" update="true" cascade="all" />

<set name="metaGruppenSprache">
<key column="RELATION"/>
<one-to-many class="at.univie.auv.redbaron.model.MetaGruppenSprache" />
</set>

</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="at.univie.auv.redbaron.model.MetaGruppenSprache" table="META_GRUPPEN_SPRACHE">
<meta attribute="class-description">
@author ZAL
</meta>

<id name="tid" column="TID">
<generator class="assigned"/>
</id>

<property name="text" column="TEXT" length="4000" type="string" not-null="false"/>

<property name="i3vUserId" column="I3V_USER_ID" type="double" not-null="false"/>

<property name="foSpracheId" column="FO_SPRACHE_ID" type="double" not-null="false"/>

<property name="i3vDate" column="I3V_DATE" type="string" not-null="false"/>

<property name="metaTextObjectTypId" column="META_TEXTOBJEKT_TYP_ID" type="double" not-null="false"/>

<property name="relation" column="RELATION" type="double" not-null="false" />

</class>

</hibernate-mapping>



[bStruts Action:[/b]
MetaGruppen meta = (MetaGruppen) gruppe.get(1);
Set list = meta.getMetaGruppenSprache();
System.out.println("Metagruppen list \n" + list);
System.out.println("Metagruppen size \n" + list.size());

Object[] objArray = list.toArray();
MetaGruppenSprache metaSpeech = (MetaGruppenSprache) objArray[1];
System.out.println("MetaSpeech " + metaSpeech);

/* MetaGruppenSprache metaSpeech = (MetaGruppenSprache) list.get(1);

System.out.println("MetaSpeech " + metaSpeech);*/

metaSpeech.setText("OH BOY OH BOY OH BOY");
objArray[1] = metaSpeech;
System.out.println("Setting Metaspeech to Array \n " + metaSpeech);

//list.add(objArray);

System.out.println("Setting array to set");
meta.setMetaGruppenSprache(list);

System.out.println("Setting metagruppensprache to metagruppe");

/* System.out.println("Saving Gruppe .... ");
meta.setTid(new Double(666.55));
groups.save(meta);

System.out.println("Done Saving!!!!");*/


return mapping.findForward("groups");


Full stack trace of any exception that occurs:

rg.springframework.orm.hibernate.HibernateSystemException: this id generator generates long, integer, short; nested exception is net.sf.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short
net.sf.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short
at net.sf.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:38)
at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:73)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388)
at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482)
at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1475)
at net.sf.hibernate.impl.SessionImpl.update(SessionImpl.java:1355)
at org.springframework.orm.hibernate.HibernateTemplate$15.doInHibernate(HibernateTemplate.java:339)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:176)
at org.springframework.orm.hibernate.HibernateTemplate.update(HibernateTemplate.java:336)
at at.univie.auv.redbaron.dao.hibernate.MetaGruppenDAOHibernate.save(MetaGruppenDAOHibernate.java:51)
at at.univie.auv.redbaron.services.impl.MetaGruppenServicesImpl.save(MetaGruppenServicesImpl.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:60)

Name and version of the database you are using:

oracle 8i

Debug level Hibernate log excerpt:



hello everybody

currently i'm testing around how to get hibernate to do what i want ...
it isn't easy and the above things are showing may problem -
i've got a double value id and when i try to save my object the error
"exception is net.sf.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short
net.sf.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short" appears ...
i don't know if i'm mapping may objects right or wrong because i'm rather new to hibernate but i just want the following thing (just for test cases):

loading an object list - getting the first object - change the object and write the update to the database.
well seems to be easy ...

i'm loading meta_daten which has a one-to-many relation to meta_date_sprache - in meta_date_sprache there is text which i want to change - after the change i want to persist the change by saving the mate_daten object - hope this is not completly nonsense what i'm doing here ...

furthermore we are using spring an struts to make it more complicated ;-)

thanx in advance

greetinx


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.