-->
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: Error when saving DO
PostPosted: Mon Mar 08, 2004 4:37 am 
Newbie

Joined: Mon Mar 08, 2004 4:10 am
Posts: 6
Hi. I'm new to Hibernate group. When I want to save my persistent domain object,I take an exception as :
HibernateException("unmapped property: " + propertyName);

My codes are shown below:

Session Bean method
public void createKesinOSSOgrenciKayit(AbstractOgrenciDTO ogrDTO, OgrenciNufusDTO ogrNufusDTO, OgrenciAskerlikDTO ogrAskerlikDTO,
OgrenciAdresDTO ogrAdresDTO, OgrenciHarcDTO ogrHarcDTO, OgrenciOSSDTO ogrOSSDTO) throws KesinKayitControllerAppException, KesinKayitControllerSysException, java.rmi.RemoteException{
try {
getOgrenciDAO();
getOgrenciNufusDAO();
AbstractOgrenciDO asilOgrenci = new AbstractOgrenciDO(ogrDTO);
ogrenciDAO.saveOgrenci(asilOgrenci);
//ogrenciDAO.refresh(asilOgrenci);

OgrenciNufusDO ogrenciNufus = new OgrenciNufusDO(ogrNufusDTO);
// EXCEPTION IS TAKEN BELOW
ogrenciNufusDAO.saveOgrenciNufus(ogrenciNufus);
} catch (DAOSysException dse) {
getSessionContext().setRollbackOnly();
throw new KesinKayitControllerSysException(dse.getMessage());
} catch (DAOAppException dae) {
getSessionContext().setRollbackOnly();
throw new KesinKayitControllerAppException(dae.getMessage());
}

}

}

DAOImpl save method

public void saveOgrenciNufus(OgrenciNufusDO ogrenciNufus)
throws DAOSysException, DAOAppException {
Session session = getSession();
try {
session.save(ogrenciNufus);
session.flush();
} catch (HibernateException he) {
throw new DAOAppException(
he.getMessage());
} finally {
closeSession();
}
}

Domain Object

public class OgrenciNufusDO{

private Long id;
private String anaAdi;
private String babaAdi;
private String medeniHali;
private String dogumYeri;
private String tcKimlikNo;
private String kutukIl;
private String kutukIlce;
private String kutukMahalleKoy;
private String ciltNo;
private String siraNo;
private String aileSiraNo;

//setters and getters
}

Mapping files

<class name="iyte.oi.components.ogrenciler.ogrenci.model.AbstractOgrenciDO" discriminator-value="AbstractOgrenci"
table="OGRENCILER">
<id column="ID" name="id" type="long">
<generator class="identity"></generator>
</id>
<discriminator column="TIP" type="string" not-null="true"/>
<property name="ogrenciNo" column="OGRENCI_NO" not-null="true" type="string"/>
<property name="ad" column="AD" not-null="true" type="string"/>
<property name="soyad" column="SOYAD" not-null="true" type="string"/>
<property name="dogumTarihi" column="DOGUM_TARIHI" not-null="true" type="java.sql.Date"/>
<property name="cinsiyet" column="CINSIYET" not-null="true" type="string"/>
<property name="uyruk" column="UYRUK" not-null="true" type="string"/>
<property name="email" column="EMAIL" not-null="true" type="string"/>
<property name="kayitTarihi" column="KAYIT_TARIHI" not-null="false" type="java.sql.Date"/>
<property name="egitimDerecesi" column="EGITIM_DERECESI" not-null="true" type="string"/>
</class>

<class name="iyte.oi.components.ogrenciler.ozluk.model.OgrenciNufusDO" table="OGRENCI_NUFUS">
<id column="ID" type="long" name="id">
<generator class="foreign"><param name="property"></param></generator>
</id>
<property name="anaAdi" type="string" column="ANA_ADI"/>
<property name="babaAdi" type="string" column="BABA_ADI"/>
<property name="medeniHali" type="string" column="MEDENI_HALI"/>
<property name="dogumYeri" type="string" column="DOGUM_YERI"/>
<property name="tcKimlikNo" type="string" column="TC_KIMLIK_NO"/>
<property name="kutukIl" type="string" column="KUTUK_IL"/>
<property name="kutukIlce" type="string" column="KUTUK_ILCE"/>
<property name="kutukMahalleKoy" type="string" column="KUTUK_MAHALLE"/>
<property name="ciltNo" type="string" column="CILT_NO"/>
<property name="siraNo" type="string" column="SIRA_NO"/>
<property name="aileSiraNo" type="string" column="AILE_SIRA_NO"/>
</class>


I think this problem is from the foreign key of id for OgrenciNufus. But I'm not sure and I couldn't solve the problem. Thanks for your interest.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 8:54 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
When asking questions, give at least: the Hibernate version
# your mapping documents
# the Java code between sessionFactory.openSession() and session.close()
# the full stack trace of any exception that occurs
# the name and version of the database you are using
# a debug level Hibernate log excerpt is also appreciated

_________________
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.