Article View: pl.comp.lang.java
Article #143576Re: hibernate mapowanie kluczy obcych xml
From: mk
Date: Mon, 12 Jan 2009 17:58
Date: Mon, 12 Jan 2009 17:58
44 lines
2310 bytes
2310 bytes
mk pisze:
> Jarek pisze:
>
>> Na przykład tak:
>>
>> Session session=factory.openSession();
>> Transaction tx=session.beginTransaction();
>> Lista list = new Lista();
>> list.setNazwa(jTextField7.getText());
>> list.setUwagi(jTextField5.getText());
>> session.save(list);
>>
>> List<Osoba> osoby = session.createQuery("select o from Osoba o where
>> JAKIS WARUNEK").getResultList();
>>
>> for (Osoba o : osoby) {
>> list.getOsoby().add(o);
>> o.getListy().add(list);
>> }
>>
>> tx.commit();
>> session.close();
>>
>>
>> Pozdrawiam
>> Jarek
>
> Działa aż miło, wielkie dzięki.
>
> pozdr.
> mk
Jeszcze mam jeden problem :)
Nie działa mi kaskadowe usuwanie. Tzn jak mam listę do ktorej przypisani
są adresaci i chcę usunąc listę, to nie pozwala:
SEVERE: BŁĄD: update or delete on table "lista" violates foreign key
constraint "fk623639b6f4a8341" on table "listy"
Szczegóły: Key (id)=(105) is still referenced from table "listy".
możesz pomóc
dzięki
pozdr.
mk
Technical Details
Message-ID:
<gkg0et$f4i$1@atlantis.news.neostrada.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!newsfeed.neostrada.pl!atlantis.news.neostrada.pl!news.neostrada.pl!not-for-mailReferences:
<gk4i5e$hou$1@atlantis.news.neostrada.pl> <gk632c$7lf$1@inews.gazeta.pl> <gk854t$jo1$1@nemesis.news.neostrada.pl> <gk86qe$91c$1@inews.gazeta.pl> <gk892b$pi2$1@nemesis.news.neostrada.pl> <gk8ath$2og$1@inews.gazeta.pl> <gk9seg$t59$1@atlantis.news.neostrada.pl> <gkafg2$hd6$1@inews.gazeta.pl> <gkakui$pgh$1@atlantis.news.neostrada.pl> <gkcq6s$aep$1@inews.gazeta.pl> <gkdruv$216$1@atlantis.news.neostrada.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!newsfeed.neostrada.pl!atlantis.news.neostrada.pl!news.neostrada.pl!not-for-mail From: mk <mk@mk.pl> Newsgroups: pl.comp.lang.java Subject: Re: hibernate mapowanie kluczy obcych xml Date: Mon, 12 Jan 2009 18:58:07 +0100 Organization: TP - http://www.tp.pl/ Lines: 44 Message-ID: <gkg0et$f4i$1@atlantis.news.neostrada.pl> References: <gk4i5e$hou$1@atlantis.news.neostrada.pl> <gk632c$7lf$1@inews.gazeta.pl> <gk854t$jo1$1@nemesis.news.neostrada.pl> <gk86qe$91c$1@inews.gazeta.pl> <gk892b$pi2$1@nemesis.news.neostrada.pl> <gk8ath$2og$1@inews.gazeta.pl> <gk9seg$t59$1@atlantis.news.neostrada.pl> <gkafg2$hd6$1@inews.gazeta.pl> <gkakui$pgh$1@atlantis.news.neostrada.pl> <gkcq6s$aep$1@inews.gazeta.pl> <gkdruv$216$1@atlantis.news.neostrada.pl> NNTP-Posting-Host: acpp236.neoplus.adsl.tpnet.pl Mime-Version: 1.0 X-Trace: atlantis.news.neostrada.pl 1231783197 15506 83.10.221.236 (12 Jan 2009 17:59:57 GMT) X-Complaints-To: usenet@news.neostrada.pl NNTP-Posting-Date: Mon, 12 Jan 2009 17:59:57 +0000 (UTC) User-Agent: Thunderbird 2.0.0.19 (X11/20090105) In-Reply-To: <gkdruv$216$1@atlantis.news.neostrada.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit