Article View: pl.comp.lang.java
Article #143581Re: hibernate mapowanie kluczy obcych xml
From: mk
Date: Tue, 13 Jan 2009 16:18
Date: Tue, 13 Jan 2009 16:18
62 lines
3162 bytes
3162 bytes
mk pisze:
> Jarek pisze:
>
>> No tak to raczej z automatu nie zadziała.
>> Spróbuj raczej:
>>
>> Lista l = new Lista();
>> l.setId(idDoUsuniecia);
>> session.delete(l);
>> tx.commit();
>
> tu dostaje wyjątek:
>
> Exception in thread "AWT-EventQueue-0"
> org.hibernate.PropertyValueException: not-null property references a
> null or transient value: kopertownik.Lista.nazwa
>
>
>> a jak to nie zadziala to moze:
>>
>> Lista l = session.get(Lista.class, idDoUsuniecia);
>> session.delete(l);
>> tx.commit();
>
> tu też:
>
> 009-01-13 07:34:41 org.hibernate.util.JDBCExceptionReporter logExceptions
> WARNING: SQL Error: 0, SQLState: null
> 2009-01-13 07:34:41 org.hibernate.util.JDBCExceptionReporter logExceptions
> SEVERE: Zadanie wsadowe 0 delete from lista where id=108 zostało
> przerwane. Wywołaj getNextException by poznać przyczynę.
> 2009-01-13 07:34:41 org.hibernate.util.JDBCExceptionReporter logExceptions
> WARNING: SQL Error: 0, SQLState: 23503
> 2009-01-13 07:34:41 org.hibernate.util.JDBCExceptionReporter logExceptions
> SEVERE: BŁĄD: update or delete on table "lista" violates foreign key
> constraint "fk623639b6f4a8341" on table "listy"
> Szczegóły: Key (id)=(108) is still referenced from table "listy".
>
>>
>> Pozdrawiam
>> Jarek
>>
>>
>
> pozdr.
> mk
Już jest ok, usunołem tabele w bazie, wrzuciłem w osoby.hbm.xml
lazy="true" inverse="true"
a pod przycisk dałem takie coś:
Session s=factory.openSession();
Transaction tx=s.beginTransaction();
Lista l = (Lista) s.get(Lista.class,(Serializable)
jTable1.getValueAt(jTable1.getSelectedRow(),0 ));
s.delete(l);
tx.commit();
s.close();
pozdr.
mk
Technical Details
Message-ID:
<gkievq$nao$1@atlantis.news.neostrada.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.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> <gkg0et$f4i$1@atlantis.news.neostrada.pl> <gkgbia$9s2$1@inews.gazeta.pl> <gkgfsv$qs6$1@atlantis.news.neostrada.pl> <gkgkm9$49t$1@inews.gazeta.pl> <gkhd84$t5o$1@nemesis.news.neostrada.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.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: Tue, 13 Jan 2009 17:18:19 +0100 Organization: TP - http://www.tp.pl/ Lines: 62 Message-ID: <gkievq$nao$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> <gkg0et$f4i$1@atlantis.news.neostrada.pl> <gkgbia$9s2$1@inews.gazeta.pl> <gkgfsv$qs6$1@atlantis.news.neostrada.pl> <gkgkm9$49t$1@inews.gazeta.pl> <gkhd84$t5o$1@nemesis.news.neostrada.pl> NNTP-Posting-Host: acqs250.neoplus.adsl.tpnet.pl Mime-Version: 1.0 X-Trace: atlantis.news.neostrada.pl 1231863610 23896 83.10.250.250 (13 Jan 2009 16:20:10 GMT) X-Complaints-To: usenet@news.neostrada.pl NNTP-Posting-Date: Tue, 13 Jan 2009 16:20:10 +0000 (UTC) User-Agent: Thunderbird 2.0.0.19 (X11/20090105) In-Reply-To: <gkhd84$t5o$1@nemesis.news.neostrada.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit