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.  [ 2 posts ] 
Author Message
 Post subject: TransientObjectException
PostPosted: Thu Feb 05, 2004 11:45 am 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
Trying to make a cascade save the following exception is thrown:

et.sf.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: Common.Vigencia
at net.sf.hibernate.impl.SessionImpl.throwTransientObjectException(SessionImpl.java:2652)
at net.sf.hibernate.impl.SessionImpl.getEntityIdentifierIfNotUnsaved(SessionImpl.java:2644)
at net.sf.hibernate.type.EntityType.getIdentifier(EntityType.java:66)
at net.sf.hibernate.type.EntityType.isDirty(EntityType.java:164)
at net.sf.hibernate.type.TypeFactory.findDirty(TypeFactory.java:225)

The code:

Vigencia vigencia = new Vigencia();
Frecuencia frecuencia = new Frecuencia();
EEFrecuencia eeFrecuencia = new EEFrecuencia();
DiaPublicacion diaPublicacion = null;

vigencia.setFechaDesde((Date)txtVigenciaDesde.getValue());
vigencia.setFechaHasta((Date)txtVigenciaDesde.getValue());
eeFrecuencia.setVigencia(vigencia);

DefaultButtonModel model = (DefaultButtonModel)btnPorDiasSemana.getModel();
if (model.getGroup().isSelected(model)){
frecuencia.setDiasPublicacion(new java.util.ArrayList());

eeFrecuencia.setFrecuencia(frecuencia);
suplementoSeleccionado.setEeFrecuencia(new java.util.ArrayList());
suplementoSeleccionado.getEeFrecuencia().add(eeFrecuencia);
suplementoSeleccionado.setVigencia(vigencia);

try {
Transaction tx = GuiSGP.session.beginTransaction();

session.save(suplementoSeleccionado;

and the maps:

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

<hibernate-mapping>
<class name="Common.Vigencia" table="T_Vigencia">
<id name="idVigencia" column="P_IdVigencia" type="int" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="fechaDesde" column="A_FechaDesde" type="date"/>
<property name="fechaHasta" column="A_FechaHasta" type="date"/>
<property name="descripcion" column="A_Descripcion" type="string"/>
</class>
</hibernate-mapping>

Any idea?,


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 12:31 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
suplementoSeleccionado contains a new object vigencia (and others)
Either save() vigencia or use the cascade attribute features.

_________________
Emmanuel


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